Index Candles
index_candles
OHLC candle updates for index prices. Sent on every price update within the candle period. Subscribe to a specific pair and resolution, e.g. index_candles:BTC_USDC:60 for 1-hour candles.
Channel: index_candles:{pair}:{resolution}
Example: index_candles:BTC_USDC:60
Available resolutions: 1S, 1 (1m), 3, 5, 15, 30, 60 (1h), 120, 240, 360, 480, 720, D, 1D, 3D, W, M
Payload
{
"pair": "BTC_USDC",
"timeframe": "60",
"time": 1764043200,
"open": 2910.50,
"high": 2920.00,
"low": 2900.00,
"close": 2915.00,
"is_closed": false
}| Field | Type | Description |
|---|---|---|
pair | string | Trading pair (e.g. BTC_USDC) |
timeframe | string | Resolution matching the channel (e.g. 60) |
time | integer | Candle open timestamp — bucket start in Unix seconds |
open | number | Opening price (first price in the period) |
high | number | Highest price in the period |
low | number | Lowest price in the period |
close | number | Closing price (most recent price) |
is_closed | boolean | true when the candle period has ended |
Subscribe — Raw WebSocket
const ws = new WebSocket("wss://staging.kyan.sh/stream/websocket");
let id = 0;
ws.onopen = () => ws.send(JSON.stringify({ id: ++id, connect: {} }));
ws.onmessage = (e) => {
const msg = JSON.parse(e.data);
if (Object.keys(msg).length === 0) { ws.send("{}"); return; } // ping
if (msg.id === 1) {
ws.send(JSON.stringify({
id: ++id,
subscribe: { channel: "index_candles:BTC_USDC:60" },
}));
return;
}
if (msg.push?.pub) {
const { pair, timeframe, time, open, high, low, close, is_closed } = msg.push.pub.data;
}
};Related channels
Channels providing related data.
| Channel | Why |
|---|---|
| Index Price | Live tick-level source that this candle aggregates. |
| Perps BBO | Current perps top-of-book for the same pair. |
| Funding Rate | Funding rate for the perps instrument on the same pair. |
Updated about 2 months ago
