'BitQuery wrong data/not real time
Hi I started playing with BitQuery graphql to see if it would help me with querying blockchain data. I love the idea of single API for most of the blockchains.
I have a problem tho. The data that Im getting back is critically not accurate and I don't know why.
{
ethereum(network: bsc) {
dexTrades(
exchangeAddress: {is: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"}
baseCurrency: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}
quoteCurrency: {is: "0x55d398326f99059ff775485246999027b3197955"}
) {
baseCurrency {
symbol
}
quoteCurrency {
symbol
}
quotePrice
}
}
}
Given this query I want to get the Price of Cake/USDT. Which it returns as
{
"ethereum": {
"dexTrades": [
{
"baseCurrency": {
"symbol": "Cake"
},
"quoteCurrency": {
"symbol": "USDT"
},
"quotePrice": 16.96659680611786
}
]
}
}
But When I check with the PancakeSwap Exchange directly or coinmarketcap the price is 40% lower that BitQuery result...
PancakeSwap Price = 10.70
Coingeko Price = 10.75
Am I doing something wrong? Or BitQUery is broken? Or what can be the case? Any Ideas?
Solution 1:[1]
We are doing the same. I am actually playing around also in bitquery coz I'm trying to build something and I also encountered this one. And what I found out is that "quotePrice" is not the actual price of the coin or token. It is just the average quote price that you can use to get the actual price. You still need to compute for price using an intermediary either WETH, etc..
See more info here: https://bitquery.io/blog/dex-price-index
Solution 2:[2]
The data returned from Bitquery seems to be correct as I checked from https://pancakeswap.finance/info/tokens which comes out to be around $8.60.
Your GraphQL query returns a different value somehow. I have tried to change the GraphQL query you made which you can check from this link
The GraphQL query is as follows:-
{
ethereum(network: bsc) {
dexTrades(
exchangeAddress: {is: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73"}
baseCurrency: {is: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"}
quoteCurrency: {is: "0x55d398326f99059ff775485246999027b3197955"}
) {
baseCurrency {
symbol
}
quoteCurrency {
symbol
}
quotePrice(calculate: any)
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dharman |
Solution 2 | sayon-bitquery |