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.

removeLeadingNullValuesBoolean

Whether to remove leading null values from the response. Only valid with 1D resolution. To fetch a token's entire history, set the from value to 0 and set 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
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
c[Float]!The closing price.
h[Float]!The high price.
l[Float]!The low price.
o[Float]!The opening price.
sString!The status code for the bar. 200 responses are ok.
t[Int!]!The timestamp for the bar.
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 :two-men-holding-hands::two-women-holding-hands: