MarketCap of a Token

Let’s say if you want the Marketcap of a Binance Smart Chain token (BSC token) or Etheruem token or any other chain token.

Here are the steps

1- Get total Supply
2- Getting Latest Price

Getting the Total supply of a token

To get the total supply, you can use our Address APIs to get the smart contract attributes. For example check the following query

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

To get the latest price, try following example query

1 Like

Admins keep referring to this. It doesn’t work. It often returns a supply of 0.

Yes, we don’t have supply for many tokens, i suggest to fetch them on web3 apis directly.

MarketCap = Supply * Price

To get supply, you can use token holder API

Supply of a SAND token - Blockchain Data API (more on docs Token Holders API | Blockchain Data API (V2))

To get the latest price, use dex trade API

more on docs (Bitquery V1 API Documentation | Blockchain Data API (V1 Docs))