Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.codex.io/llms.txt

Use this file to discover all available pages before exploring further.

Returns

TokenBarsResponse
TokenBarsResponse
See TokenBarsResponse

Arguments

symbol
String!
required
The ID of the token (tokenAddress:networkId). For example, 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2:1 returns aggregated bar data for WETH pairs on Ethereum.
from
Int!
required
The unix timestamp for the start of the requested range.
to
Int!
required
The unix timestamp for the end of the requested range.
resolution
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.
currencyCode
QuoteCurrency
The currency to use for the response. Can be USD or TOKEN. Default is USD. Use currencyCode: TOKEN for native token pricing. See QuoteCurrency
removeLeadingNullValues
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.
removeEmptyBars
Boolean
Whether to remove empty bars from the response. This is useful for eliminating gaps in low-activity tokens. Default is false.
statsType
TokenPairStatisticsType
The type of statistics returned. Can be FILTERED or UNFILTERED. Default is UNFILTERED. See TokenPairStatisticsType
countback
Int
Guarantees number of bars returned is at most this number. Use countback: 1500 with from: 0 for maximum results.

Example

Test this query in the Explorer →
{
  getTokenBars(
    symbol: "So11111111111111111111111111111111111111112:1399811149"
    from: 1753121580
    to: 1758303571
    resolution: "5"
    countback: 10
    removeEmptyBars: true
  ) {
    o
    h
    c
    l
    volume
  }
}

Usage Guidelines

  • For data from mid-2025 onwards (timestamp 1753121580), getTokenBars returns an aggregated price across all pools. Anything before that falls back to the top pair.
  • Historical data only includes OHLC data; volume/traders data cannot be aggregated across all pools on the fly.
  • Includes more historical data than getBars because it iterates through top pairs rather than using a single pair.
  • Response time is slightly faster for current data, but the difference from getBars is negligible.
  • Refer to getBars for additional usage guidelines and troubleshooting tips.
Pricing for aggregate charts will no longer only use the top pair. Weighted average pricing will be used across a token’s top pairs, based on liquidity/recency, while filtering out lower quality pairs from contributing.

Troubleshooting Tips

Use getTokenBars when you want aggregate price data for a token across all its trading pairs — it uses weighted average pricing based on liquidity. Use getBars when you want price data for a specific trading pair.
  • 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 removeLeadingNullValues: true
You can use getTokenBars to do an initial fetch of bars and then subscribe to onTokenBarsUpdated to keep it updated in real-time. More info on creating real-time charts is available here.
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.
  • Detailed Token Page: Build a comprehensive token detail page with price, holders, trades, and real-time updates
  • Charts: Render token charts with OHLCV data and real-time updates