TheGraph Uniswap Subgraph returning strange values for Volume and Liquidity
I'm using the python graphql client lib to pull some basic token data from Uniswap.
Docs here: https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2?query=Example%20query
My query:
query = """
query($contract: String!) {
token(id:$contract) {
symbol
name
decimals
tradeVolume
totalLiquidity
derivedETH
}
}
"""
What's strange is that on Uniswap frontend it lists BAT having:
Total Liquidity: $5,478,617
24H Volume: $1,592,080
However the data returned from that query looks like this:
'name': 'Basic Attention Token',
'symbol': 'BAT',
'totalLiquidity': '3451749.888732987018538912',
'tradeVolume': '359698970.546531556838535503'}}}
I cannot figure out what the heck units these are supposed to be. I've tried calculating as ETH and BAT and can't seem to come up with dollar figures even close to the frontend.
Anyone know what I'm missing?
1 ответ
It is not possible to answer, without knowing your parameters values, like $contract (token id)
query($contract: String!) {
token(id:$contract) {
Note also, that uniswap token has also fields tradeVolumeUSD, untrackedVolumeUSD that may be what you were looking for.
{
tokens{
symbol
name
decimals
tradeVolume
totalLiquidity
tradeVolumeUSD
untrackedVolumeUSD
derivedETH
}
}