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

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.

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

Use the above query to get the latest price.

Total trading Volume

{
  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

{
  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)

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:

Hitting multiple queries using Aliasing.

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

https://bitquery.io/blog/graphql-alias-and-aggregation

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.

1 Like