I’m trying to get real-time price data from pumpfun on the Solana network using bitquery api. However I’m met with this error, I’ve tried the examples on both v1 and v2, nothing seems to work:
{'errors': [{'message': 'Field does not exist on type. Please check your query.', 'locations': [{'line': 3, 'column': 3}], 'path': ['subscription', 'Solana'], 'extensions': {'code': 'undefinedFiel
d', 'typeName': 'Subscription', 'fieldName': 'Solana'}}], 'extensions': {'subId': 'sub-86eb1017250ec4e53cb633d4726f941eb6da5f08'}} Traceback (most recent call last):
File "/Users/dekahalane/Documents/GitHub/solana-trade-bot/bitquery_pump.py", line 109, in <module>
tokenBNBprice = jsonResp['data']['solana']['tokenPrice'][0]['quotePrice']
~~~~~~~~^^^^^^^^
KeyError: 'data'
here’s the link to the code ive tried:
and this:
query getData($base0: String, $base1: String, $quote0: String){
Solana{
tokenPrice: dexTrades(
baseCurrency: {is: $base0}
quoteCurrency: {is: $quote0}
) {
quotePrice
}
busdPrice: dexTrades(
baseCurrency: {is: $base1}
quoteCurrency: {is: $quote0}
) {
quotePrice
}
}
}
params = {
"base0" : token_list["MILF"],
"base1" : token_list["PO"],
"quote0" : token_list["SOL"]
}
json = {"query" : query, "variables": params}
headers = {"X-API-KEY" : API_KEY}
response = requests.post(BASE_URL, json = json, headers = headers)
if response.status_code == 200:
jsonResp = response.json()
Traceback:
{'errors': [{'message': 'Field does not exist on type. Please check your query.', 'locations': [{'line': 3, 'column': 3}], 'path': ['query getData', 'Solana'], 'extensions': {'code': 'undefinedField', 'typeName': 'Query', 'fieldName': 'Solana'}}, {'message': 'Variable $base0 is declared by getData but not used', 'locations': [{'line': 2, 'column': 2}], 'path': ['query getData'], 'extensions': {'code': 'variableNotUsed', 'variableName': 'base0'}}, {'message': 'Variable $base1 is declared by getData but not used', 'locations': [{'line': 2, 'column': 2}], 'path': ['query getData'], 'extensions': {'code': 'variableNotUsed', 'variableName': 'base1'}}, {'message': 'Variable $quote0 is declared by getData but not used', 'locations': [{'line': 2, 'column': 2}], 'path': ['query getData'], 'extensions': {'code': 'variableNotUsed', 'variableName': 'quote0'}}]}