# Getting token related data such as Marketcap, price, volume, price change

**URL:** https://community.bitquery.io/t/getting-token-related-data-such-as-marketcap-price-volume-price-change/822
**Category:** GraphQL Tutorials
**Created:** [January 19, 2022, 9:16am UTC](https://community.bitquery.io/t/getting-token-related-data-such-as-marketcap-price-volume-price-change/822 "2022-01-19T09:16:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)
#### Post date: [January 19, 2022, 9:16am UTC](https://community.bitquery.io/t/getting-token-related-data-such-as-marketcap-price-volume-price-change/822/1 "2022-01-19T09:16:50Z")

</div>

We will try to get the following data for a token -

Price  
Marketcap  
Volume  
Volume 24h  
Circulating supply  
1H % Change  
24H Change  
7D Change  
No. of Holders

**Price**  
To get the price you need to get the latest trade for a given token. Following is the query example for that.

> **[Latest trade of a token](https://ide.bitquery.io/Latest-trade-of-a-token)**
>
> Latest trade of a token

**Marketcap**  
To get the market cap you need total supply and price. (Latest Price \* Total Circulating Supply = Current market cap)

we can provide you with supply parameters through our APIs. however, circulating supply depends on many things and direct APIs can’t provide it.

API to get a supply of a token - [Getting the total supply of a coin via Address API](https://graphql.bitquery.io/ide/HDFuI26Lnw)

Use the above query to get the latest price.

**Total trading Volume**

```auto
{
  ethereum(network: ethereum) {
    dexTrades(baseCurrency: {is: "0xf4d2888d29d722226fafa5d9b24f9164c092421e"}) {
      tradeAmount(in: USDT)
    }
  }
}

```

“Volume 24H”

check this post [Volumn and count per hour, minute or days or week](https://community.bitquery.io/t/volumn-and-count-per-hour-minute-or-days-or-week/974)

```auto
{
  ethereum(network: ethereum) {
    dexTrades(baseCurrency: {is: "0xf4d2888d29d722226fafa5d9b24f9164c092421e"}
    time: {since: "2022-01-18T00:00:00" till: "2022-01-18T23:59:59"}
    ) {
      tradeAmount(in: USDT)
    }
  }
}

```

**Price change 1 hour**  
To get the price change you need to know how to get the price at a certain time, use this query to accomplish that. ([price at certain point](https://graphql.bitquery.io/ide/price-at-certain-point))

Based on this you can use get a price change for 1hour, day or 7 days.

Here is the article that will help you further:

> [@Volumn and count per hour, minute or days or week](https://community.bitquery.io/t/volumn-and-count-per-hour-minute-or-days-or-week/974):
>
> I am showing how to use time interval to get metrics based on second, mint, hourly, weekly or monthly. { ethereum(network: bsc) { dexTrades( date: {since: "2022-04-06"} exchangeAddress: {is: "0xca143ce32fe78f1f7019d7d551a6402fc5350c73"} baseCurrency: {is: "0xe9e7cea3dedca5984780bafc599bd69add087d56"} quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"} ) { count tradeAmount(in: USD) timeInterval{ hour (count: 4) } …

**Hitting multiple queries using Aliasing.**

You can use aliasing to query multiple data in one API call, read the following article for that.

> **[Bitquery - How to use GraphQL Alias and Aggregation?](https://bitquery.io/blog/graphql-alias-and-aggregation)**
>
> In this article, we will talk about how to use alias and aggregation with GraphQL queries.

**No. of Holders**

The number of holder APIs are not yet released at the time of writing this (19 Jan), it will be live soon.

You can ask more questions at our [Telegram](https://t.me/bloxy_info).

---

<div class="post-metadata">

### Author: ![Divya](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@Divya](https://community.bitquery.io/u/Divya)
#### Post date: [September 18, 2023, 9:27am UTC](https://community.bitquery.io/t/getting-token-related-data-such-as-marketcap-price-volume-price-change/822/2 "2023-09-18T09:27:43Z")

</div>

# Update

## How to calculate the marketcap of a token ?

`Market capitalization = Latest token price * Total supply`

Above, we have already shown how to get the USD price of an asset; now, let’s get the supply.

**Query to get supply**

`Total supply = Initial Supply + Minted supply - Burned supply`

In the following query, we will get the initial supply from the contract attributed and then use transfer API to get mint and burns by checking how many tokens were sent or received from the dead address.

[Open this query on IDE](https://ide.bitquery.io/Supply-of-Drip-token).

```auto
{
  ethereum(network: bsc) {
    address(address: {is: "0x20f663cea80face82acdfa3aae6862d246ce0333"}) {
      annotation
      address
      smartContract {
        attributes {
          name
          value
        }
        contractType
        currency {
          symbol
          name
          decimals
          tokenType
        }
      }
    }
    transfers(date: {since: null, till: null}, amount: {gt: 0}) {
      minted: amount(
        calculate: sum
        sender: {is: "0x0000000000000000000000000000000000000000"}
      )
      burned: amount(
        calculate: sum
        receiver: {is: "0x0000000000000000000000000000000000000000"}
      )
      currency(currency: {is: "0x20f663cea80face82acdfa3aae6862d246ce0333"}) {
        symbol
        name
      }
    }
  }
}

```

Note: In many cases token attributes shown as null in those cases you should find other ways to get supply of the token.

Read more in docs here [Bitquery V2 API Docs | Bitquery](https://docs.bitquery.io/v1)
