Hi,
Let me explain what I did and provide some examples: I am using this query pasted here:
query MyQuery {
ethereum(network: ethereum) {
dexTrades(date: {is: “2024-01-02”}
options: {desc: “count”,offset: 0}) {
baseCurrency {
symbol
name
address
decimals
}
quoteCurrency {
symbol
name
address
decimals
}
poolAddress: smartContract {
address {
address
}
}
exchange {
address {
address
}
name
fullNameWithId
fullName
}
protocol
count
quotePrice
}
}
}
which provides a list of all pools in Ethereum, which pairs are traded in the pool and the quote price amongst other data. I tried some trades based on this data and realised that the prices seemed to be off. So I did some random comparison - reading the quote directly from slot0 for Uniswap V3 for example and saw differences sometimes 2 / 3% but other times much larger particularly in low liquidity pools.
So I wrote my own program that basically takes the pool list from this query and reads slot0 from all pools - for Uniswap V3 - and uses the reserves method from Uniswap V2 pools to calculate my own quotes. I then compared them all with the ones provided by BitQuery.
Now, I admit there could be some slippage as the process takes some time to run from the time that BitQuery finishes to the point I had read all the pools. However the process runs in my own server against my own Ethereum node - it takes only 3 minutes - so the slippage shouldn’t be this big.
All prices are off, some by small amounts, others by large amounts.
I’ve just run the process at 9.00 AM CET and these are some examples showing pair, pool, quote I obtained, quote given by BitQuery and the percentage difference.
ARGO_WETH 0xd5FC1a6F75cD465c46e2f15f74B9AC0016b18386 Quote: 2.892971139624078e-06 BitQuery Quote: 2.812494046014538e-06 Perc: 1.0286141383031835
WETH_KIN 0x746948ce62c04868a55c69c59dd5A6298e94dfF5 Quote: 214663102.70979157 BitQuery Quote: 208074270.08756238 Perc: 1.03166577308889
BANANA_WETH 0xcfa9a297a406a48D1137172C18de04c944b47Ba9 Quote: 0.00036226040108887234 BitQuery Quote: 0.0003381790507145382 Perc: 1.0712088768463117
sfrxETH_wstETH 0xBA12222222228d8Ba445958a75a0704d566BF2C8 Quote: 0.9267574190387676 BitQuery Quote: 0.07566874650013723 Perc: 12.247558759772595
WETH_NETH 0xd521b36D772a4A993d5D904BA34bA3Ad93C10955 Quote: 1.0298830239782477 BitQuery Quote: 1.0577561919519731 Perc: 0.9736487782479547
CU_WETH 0x52b5EE1F39293573d1Ef5404266d9efa1A597FF6 Quote: 1.7351035302569967e-13 BitQuery Quote: 1.4631124646096568e-13 Perc: 1.1858989464079948
I can provide the whole file if required but not sure I can attach something here.
Thanks
Adrian