Returns bar chart data to track token price changes over time.
Endpoint: getBars
Method: POST
Arguments
| Name | Type | Description |
|---|---|---|
| countback | Int | guarantees number of bars returned is at most this number |
| currencyCode | String | The currency to use for the response. Can be |
| from | Int! | The unix timestamp for the start of the requested range. Required |
| quoteToken | QuoteToken | The token of interest within the token's top pair. Can be |
| removeEmptyBars | Boolean | Whether to remove empty bars from the response. Default is |
| removeLeadingNullValues | Boolean | Whether to remove leading null values from the response. To fetch a token's entire history, set resolution to |
| resolution | String! | The time frame for each candle. Available options are |
| statsType | TokenPairStatisticsType | The type of statistics returned. Can be |
| symbol | String! | The ID of the pair or token ( |
| symbolType | SymbolType | specify the type of symbol you want to fetch values for (TOKEN |
| to | Int! | The unix timestamp for the end of the requested range. Required |
Response
| Name | Type | Description |
|---|---|---|
| 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] ! | Liquidity in USD |
| o | [Float] ! | The opening price. |
| pair | Pair! | The pair that is being returned |
| s | String! | The status code for the batch:
for successful data retrieval and
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 |
| 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
Ask questions, share what you're working on and request new features 👬👭