Candle Chart Data
Endpoint
GET /api/v1/candles
Description
This endpoint returns data for a given token and liquidity pair that can be used to create a candlestick chart. This endpoint is designed seamlessly with Trading View advanced charts.
Understanding the asset_id
Parameter
asset_id
ParameterThe choice of asset_id
determines the viewpoint from which market data is analyzed and presented in the candlestick chart:
Chart Perspective: The orientation of the chart is directly influenced by the
asset_id
.When the
asset_id
corresponds to the first token in the pair (token0), the chart displays the price movements and trading activity with this token as the focal point.Conversely, if the
asset_id
is set to the second token in the pair (token1), the chart is oriented to highlight the price dynamics and transactions from the perspective of this token.
For example, with a trading pair of BNB (token0) and USDT (token1):
If
asset_id
is BNB:The chart will showcase the price fluctuations and trade volumes of BNB, with each candlestick representing BNB's price performance against USDT over the specified time intervals.
If
asset_id
is USDT:The perspective shifts to USDT's standpoint, with the chart illustrating how USDT's price moves relative to BNB, effectively making BNB the base token in this context.
Query String Parameters
asset_id (required): A string in the format <TOKEN_CONTRACT_ADDRESS>:<NETWORK_ID> that identifies the token you are interested in, in the LP pair. This should be either the token1_id or token0_id on the trading pair.
from (required): The date should be in ISO 8601 format (e.g., 2024-02-16T02:00:00Z).
to (required): The date should be in ISO 8601 format (e.g., 2024-02-16T02:00:00Z).
pair_id (required): A string in the format <PAIR_CONTRACT_ADDRESS>:<NETWORK_ID>.
interval (required): Interval you are interested in. (1m, 5m, 15m, 30m, 1h, 4h, 1d).
Headers
x-api-key (required): A valid API key.
Example
Response
Response Object
high
: The highest price over the interval.low
: The lowest price over the interval.open: The opening price for the interval (first data point).
close
: The closing price for the interval (last data point).volume
: The volume of the token over the interval.
Response Codes
200
: Success. Returns the USD price for the given token.400
: Bad Request. The tokenId, interval, or days query string parameter is not provided or days is greater than 90 or less than 1.403: Forbidden. The x-api-key header is not provided or is invalid.
404
: Not Found. No price updates found within the given time range
Last updated