Get Chart Data

Returns bar chart data to track token price changes over time.

Endpoint: getBars

Method: POST

Arguments

NameTypeDescription
currencyCodeString

The currency to use for the response. Can be USD (default) or TOKEN.

fromInt!

The unix timestamp for the start of the requested range.

Required
quoteTokenQuoteToken

The token of interest within the token's top pair. Can be token0 or token1.

removeEmptyBarsBoolean

Whether to remove empty bars from the response. Default is false.

removeLeadingNullValuesBoolean

Whether to remove leading null values from the response. To fetch a token's entire history, set resolution to 1D, from value to 0 and removeLeadingNullValues to true. Default is false.

resolutionString!

The time frame for each candle. Available options are 1, 5, 15, 30, 60, 240, 720, 1D and 7D.

Required
statsTypeTokenPairStatisticsType

The type of statistics returned. Can be FILTERED or UNFILTERED

symbolString!

The ID of the pair or token (pairAddress:networkId or tokenAddress:networkId). If a token contract address is provided, the token's top pair is used. For example, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2:1 returns WETH's top pair on Ethereum.

Required
toInt!

The unix timestamp for the end of the requested range.

Required

Response

NameTypeDescription
buyers[Int]!The number of unique buyers
buys[Int]!The number of buys
buyVolume[String]!The buy volume in USD
c[Float]!The closing price.
h[Float]!The high price.
l[Float]!The low price.
liquidity[String]!Liqudity in USD
o[Float]!The opening price.
sString!The status code for the batch: ok for successful data retrieval and no_data for empty responses signaling the end of server data.
sellers[Int]!The number of unique sellers
sells[Int]!The number of sells
sellVolume[String]!The sell volume in USD
t[Int!]!The timestamp for the bar.
traders[Int]!The number of traders
transactions[Int]!The number of transactions
v[Int]!The volume.
volume[String]The volume with higher precision.
volumeNativeToken[String]The volume in the native token for the network

πŸ“˜

O, H, L, C, V, T, and S are in their abbreviated format so that you can easily insert the data into the TradingView charting library.

Example

Historical Bar Chart Query

This query returns 1 day candles for Wrapped Ethereum (0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) on the Ethereum network (1) over a one-week period from Wed Jun 01 2022 (1654041600) to Wed Jun 08 2022 (1654646400).

{
  getBars(
    symbol: "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:1"
    from: 1678743827
    to: 1678744027
    resolution: "1"
    quoteToken: token1
  ) {
    o
    h
    l
    c
    v
    volume
    s
  }
}

Explore

πŸ‘‹

Join our Discord

Ask questions, share what you're working on and request new features πŸ‘¬πŸ‘­