Returns
BarsResponse
See BarsResponse
Arguments
String!
required
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.Int!
required
The unix timestamp for the start of the requested range.
Int!
required
The unix timestamp for the end of the requested range.
String!
required
The time frame for each candle. Available options are
1S, 5S, 15S, 30S, 1, 5, 15, 30, 60, 240, 720, 1D, 7D. Resolutions lower than 1 minute are only updated for the last 24 hours due to the volume of data produced.String
The currency to use for the response. Can be
USD or TOKEN. Default is USD. Use currencyCode: TOKEN for native token pricing.Boolean
Whether to remove leading null values from the response. Default is
false. To fetch a token’s entire history, set resolution to 1D, from value to 0 and removeLeadingNullValues to true.Boolean
Whether to remove empty bars from the response. This is useful for eliminating gaps in low-activity tokens. Default is
false.QuoteToken
The token of interest within the token’s top pair. Can be
token0 or token1. If omitted, the base token is inferred automatically. You can invert the pair by quoting the other token.
See QuoteTokenTokenPairStatisticsType
The type of statistics returned. Can be
FILTERED or UNFILTERED. Default is UNFILTERED.
See TokenPairStatisticsTypeInt
Guarantees number of bars returned is at most this number. Use
countback: 1500 with from: 0 for maximum results.SymbolType
Specify the type of symbol you want to fetch values for. Can be
TOKEN or POOL.
See SymbolTypeOn launchpads where a token’s pair address equals its contract address at launch (e.g. four.meme on BNB Chain, Flap on Robinhood Chain), pass
symbolType: TOKEN alongside a tokenAddress:networkId symbol. This follows the token to its current top pair after it migrates to a separate AMM pool — otherwise the query can resolve to the original launch pool and return a frozen, 0-volume price. See the troubleshooting tips below for details.Example
Test this query in the Explorer →Usage Guidelines
- Maximum datapoints: 1500 per request
- Use
countback: 1500withfrom: 0for maximum results - Add
removeEmptyBars: trueto eliminate gaps in low-activity tokens - Use
currencyCode: "TOKEN"for native token pricing instead of USD - For charting by Market cap: multiply price data by
circulatingSupplyfromEnhancedToken - For volume, be sure to use
volumeinstead ofv. Due to large volume numbers exceeding max integer lengths, we needed to deprecatevin place ofvolume.
Troubleshooting Tips
When should I use getBars vs getTokenBars?
When should I use getBars vs getTokenBars?
Use
getBars when you want price data for a specific trading pair. Use getTokenBars when you want aggregate price data for a token across all its trading pairs — it uses weighted average pricing based on liquidity.Wrong or inconsistent base token in pair (Token0 vs Token1)
Wrong or inconsistent base token in pair (Token0 vs Token1)
Omit
quoteToken parameter to auto-detect the correct base token of the pair automatically.Null or empty values returned
Null or empty values returned
-Check that your timestamp window is accurate and long enough for the resolution requested.
-Ensure the token has started trading (we do not index tokens until trades occur)
-Use
-Ensure the token has started trading (we do not index tokens until trades occur)
-Use
removeLeadingNullValues: trueLaunchpad token returns stale, flat, or 0-volume data (frozen price)
Launchpad token returns stale, flat, or 0-volume data (frozen price)
Some launchpads deploy a token where the pair address equals the token contract address at launch, then migrate to a separate AMM pool once the bonding curve completes. Passing a bare
tokenAddress:networkId symbol can resolve to the original launch pool, which stops trading after migration and returns a frozen, gap-filled price with 0 volume.Fix: add symbolType: TOKEN (all caps) to your query. This resolves to the token’s current top pair and follows it across migration. getTokenBars is unaffected as it’s already token-scoped.Affected launchpads include four.meme (BNB Chain) and Flap (Robinhood Chain, networkId 4663).Integrating data with TradingView
Integrating data with TradingView
Our API fits right into TradingView’s library. You can find docs for integrating with TradingView at https://www.tradingview.com/free-charting-libraries/.
Updating charts in real-time
Updating charts in real-time
You can use
getBars to do an initial fetch of bars and then subscribe to onBarsUpdated to keep it updated in real-time. More info on creating real-time charts is available here.Incorrect values or errors returned with resolutions under 1m
Incorrect values or errors returned with resolutions under 1m
Our chart data for under 1m (
1S, 5S, 15S, 30S) only goes back 24 hours due to the volume of data required at those resolutions.Can I get sparklines for a past time period?
Can I get sparklines for a past time period?
No —
tokenSparklines only returns recent values. To approximate a sparkline for a past time window, call getBars for the desired range and extract the closing values for each bar.Related Recipes
- Charts: Render token charts with OHLCV data and real-time updates