Hello, I am trying to get token’s market cap and 24h volume in my project.
To calculate market cap, I should get circulating supply of the token.
And also how can I get 24h volume?
Thanks.
For marketcap you need supply and token price.
We don’t have supply, but you can get the token price using our APIs. Check this thread.
Trading Volume uses the following queries.
Pancake Trade Volume for different currency pairs
Pancake Pool's volume for a date (change smart contract address based on your need, if you need a token’s trading volume, then replace contract with token’s smart contract)
Thanks for your reply. I have already know how to get token price.
And I have an another question. I made the following query to get token price.
{
ethereum(network: bsc) {
dexTrades(
any: [{exchangeName: {is: “Pancake”}, baseCurrency: {is: “0xb63A911AE7Dc40510E7Bb552b7Fcb94c198bBE2D”}, quoteCurrency: {is: “0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c”}}, {baseCurrency: {is: “0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c”}, quoteCurrency: {is: “0xe9e7cea3dedca5984780bafc599bd69add087d56”}}]
options: {desc: [“block.height”], limitBy: {each: “baseCurrency.symbol”, limit: 1}}
) {
baseCurrency {
symbol
}
block {
height
}
quoteCurrency {
symbol
}
quote: quotePrice
}
}
}
But it takes 10-11 seconds to fetch the result from bitquery.io.
I wonder what my mistakes are or what to do.
Thank you.
Add date filter and use latest date…for example
date: {since: "2021-05-24"}
Use the latest date