Skip to main content
The candle channel delivers live OHLCV updates for a contract at a specified interval. The current open bar is pushed approximately every 500 ms as new trades arrive within the bar. When a bar closes at an interval boundary, the server pushes the finalized closed bar (with "closed": true) immediately followed by the first update for the new open bar — so your chart never misses a transition. To show historical candles before the subscription starts, call the REST candleSnapshot endpoint first, then use the WebSocket stream for all subsequent updates.

Subscribing

string
required
The numeric contract ID to receive candles for.
string
required
The candle interval. Accepts the same values as the candleSnapshot REST endpoint: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1M.

Push message format

Field reference

number
Server send timestamp in Unix milliseconds.
string
Contract ID. Matches the asset value in your subscription.
string
Interval of this candle (e.g., "1m").
number
Bar open time — Unix milliseconds at the start of this interval bucket.
number
Bar close time — Unix milliseconds at the end of this interval bucket (exclusive).
string
Open price of the bar (raw string). This is the price of the first trade in the interval.
string
Highest trade price within the bar (raw string).
string
Lowest trade price within the bar (raw string).
string
Close price of the bar (raw string). For an open bar, this is the price of the most recent trade so far.
string
Total traded volume within the bar (raw string).
number
Number of individual trades that make up this bar.
boolean
false for an in-progress open bar. true for a finalized closed bar — this message is pushed exactly once at the interval boundary and will not be updated further.

Initialising a chart

1

Fetch historical candles via REST

Call the candleSnapshot endpoint with your chosen asset and interval to load historical OHLCV data. Render these bars as the initial chart state.
2

Subscribe to the WebSocket candle channel

Subscribe using the same asset and interval. Buffer incoming WebSocket messages while the REST response is in-flight.
3

Merge on bar open time (t)

Once you have both datasets, use data.t as the key. Replace or append bars from the WebSocket stream — for any bar where data.t matches an existing bar from REST, the WebSocket version is newer and should take precedence.
4

Handle closed-bar events

When you receive a message with "closed": true, finalize that bar in your chart. The next message will carry the new open bar with a later t value.
You can subscribe to multiple intervals for the same asset simultaneously — for example, 1m and 1h — each as a separate subscription. They operate independently and do not interfere with each other.
All price and volume values are raw strings. Apply the contract’s decimal precision before rendering values on a chart.