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
}
FieldTypeDescription
pairstringTrading pair (e.g. BTC_USDC)
timeframestringResolution matching the channel (e.g. 60)
timeintegerCandle open timestamp — bucket start in Unix seconds
opennumberOpening price (first price in the period)
highnumberHighest price in the period
lownumberLowest price in the period
closenumberClosing price (most recent price)
is_closedbooleantrue 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.

ChannelWhy
Index PriceLive tick-level source that this candle aggregates.
Perps BBOCurrent perps top-of-book for the same pair.
Funding RateFunding rate for the perps instrument on the same pair.