Skip to main content
The candleSnapshot query returns historical OHLCV (open/high/low/close/volume) candles for a contract over a specified time range. Candles are returned in ascending time order. The last candle in the response may represent the current open (in-progress) bar, indicated by "closed": false — at most one such bar will appear, always at the end of the array.
For real-time updates, subscribe to the WebSocket candle channel after loading historical data with this endpoint. The WebSocket push will keep your local candle state current without repeated polling.

Request

string
required
Must be "candleSnapshot".
string
required
The contract ID to fetch candles for, expressed as a decimal string (e.g. "1"). Use the contractId from configs.
string
required
Candle interval. See the supported intervals table below for all valid values.
integer
Start of the time range as Unix milliseconds (inclusive). Defaults to 0 (earliest available data) if omitted.
integer
End of the time range as Unix milliseconds (inclusive). Defaults to max int64 (latest available data) if omitted.

Supported Intervals

Passing an interval string not listed above returns HTTP 400 BAD_REQUEST. Validate the interval value in your client before sending the request.
If the asset does not exist or no trades have occurred in the requested time range, the response returns "candles": [] with HTTP 200. This is not an error — simply an empty result.

Response

Candle Fields

string
Contract ID (same as asset).
string
Interval identifier.
integer
Bucket open time in Unix milliseconds (inclusive). This is the start of the candle period.
integer
Bucket close time in Unix milliseconds (exclusive). The next candle’s t equals this value.
string
Opening price of the candle (raw integer string). Divide by 10^priceScale from configs to get the display value.
string
Highest price traded during the candle period (raw integer string).
string
Lowest price traded during the candle period (raw integer string).
string
Closing price of the candle (raw integer string). For an open bar (closed: false), this is the last traded price so far.
string
Total traded volume during the candle period (raw integer string). Divide by 10^qtyScale from configs to get the display value.
integer
Number of individual trades that occurred during the candle period.
boolean
true if this candle is finalized (the period has ended); false if this is the current open bar that is still accumulating trades. At most one false candle will appear, always as the last element in the array.