How do you get total supply/market cap?

I’m trying to put something together and I need to know the market cap for a BSC token. I can get the token price but I can’t get the total supply. It must be possible to get it somehow mustn’t it? Poocoin uses BitQuery and they get all these details.

They get it directly from Web3, however, we have Supply but not for all tokens…

{
  ethereum(network: bsc) {
    address(address: {is: "0x55d398326f99059ff775485246999027b3197955"}) {
      annotation
      address
      smartContract {
        attributes {
          name
          type
          value
        }
        contractType
        currency {
          symbol
          name
          decimals
          tokenType
        }
      }
      balance
    }
  }
}

What do you mean by “They get it directly from Web3”?

Isn’t Web3 just a term for Blockchain-integrated internet? Or Is there some company with that name? Or how would someone access “Web3” in the way that poocoin does for supply and market cap info?

Sorry if that’s a stupid question.

Thank you

Web3.js is a utility that could be used for directly communicating with the blockchain. Here is a documentation that could assist you further.

https://web3js.readthedocs.io/

Thank you for this, but I don’t see circulating supply anywhere, or supply info in general.

I tried to do a search of the text on the website with “find in page” and couldn’t find “supply” or anything like that.

Do you have any insight on this?

I would like to get circulating supply.

I think of circulating as total supply minus locked and burned supply.

I’d be ok with total supply minus burned supply… if subtracting locked was an issue.

Thank you for your help.

If you are looking for getting the Total Supply of a token, you can get it using Bitquery’s Address API as shown in the following GraphQL query.

Hello,

Thx for reply. I want to calculate market cap based on this methodology…

Total supply (minus burned) multiplied by current/latest price.

Is there a single query that could give me all three, total supply, burned supply and price of a token?

Someone in the telegram group gave me this query to get burned supply and total minted, but I also want current/latest price within same query if possible.

Take a look at this…

{
ethereum(network: bsc) {
transfers(date: {since: null, till: null}, amount: {gt: 0}) {
burned: amount(
calculate: sum
receiver: {in: [“0x0000000000000000000000000000000000000000”, “0x000000000000000000000000000000000000dead”]}
)
minted: amount(
calculate: sum
sender: {in: [“0x0000000000000000000000000000000000000000”]}
)
currency(currency: {in: [“coin1”,“coin2”, “coin3”]}) {
symbol
name
address
}
}
}
}

Thx for your help!

Check this thread

Does the above GraphQL query provides a solution to what you are referring to as “Total Burned Supply” ??

No, that’s the query I provided to you guys in here earlier.

It sometimes works and sometimes doesn’t.

Because its calculating the burned sum based on specific transfers… it leaves some burned tokens out of the total because there’s other scenarios that result in tokens getting burned I guess.

Sometimes its correct, but a lot of the time it leaves some things out.

Updated here Blockchain API Documentation (V1 Graphql Docs) | Blockchain GraphQL API (V1 API Docs)