Orderbook Options

orderbook_options Channel

Stream option orderbook updates in real-time. Receive initial snapshots and incremental order events (post_order, cancel_order, update_order).

Subscribe

Two subscription formats are supported:

By instrument name:

{
  "channel": "orderbook_options",
  "query": {
    "instrument_name": "BTC_USDC-31OCT25-130000-C",
    "direction": "buy",
    "options": {
      "skip_snapshot": true
    }
  }
}

By parameters (all optional for broad subscriptions):

{
  "channel": "orderbook_options",
  "query": {
    "pair": "BTC_USDC",
    "maturity": "31OCT25",
    "strike": 70000,
    "type": "C",
    "direction": "buy",
    "options": {
      "skip_snapshot": false
    }
  }
}
ParameterRequiredDescription
instrument_nameNoFull instrument name (e.g., "BTC_USDC-31OCT25-130000-C")
pairNoTrading pair (e.g., "BTC_USDC")
maturityNoExpiration date (e.g., "31OCT25")
strikeNoStrike price
typeNo"C" for Call, "P" for Put
directionNo"buy" or "sell"
options.skip_snapshotNoSkip initial orderbook snapshot (default: false)

When using instrument_name, it must match the pattern: {PAIR}-{MATURITY}-{STRIKE}-{TYPE}

Events

This channel delivers the following event types. See Orderbook Events for full event schemas.

EventDescription
post_orderNew order posted to the orderbook
cancel_orderOrder cancelled
update_orderOrder fill status updated (partial or complete fill)

Example

import WebSocket from 'ws';

const ws = new WebSocket('wss://staging.kyan.sh/ws');
const API_KEY = 'your-api-key-here';

ws.onopen = () => {
  ws.send(JSON.stringify({ type: 'auth', api_key: API_KEY }));
};

ws.onmessage = (event) => {
  const message = JSON.parse(event.data.toString());

  if (message.type === 'auth' && message.success) {
    ws.send(JSON.stringify({
      type: 'subscribe',
      subscriptions: [
        {
          channel: 'orderbook_options',
          query: { instrument_name: 'BTC_USDC-31OCT25-130000-C' }
        }
      ]
    }));
    ws.onmessage = handleMessages;
  }
};

function handleMessages(event: WebSocket.MessageEvent) {
  const message = JSON.parse(event.data.toString());

  if (message.event === 'post_order') {
    console.log('New order posted:', message.data);
  } else if (message.event === 'cancel_order') {
    console.log('Order cancelled:', message.data);
  } else if (message.event === 'update_order') {
    console.log('Order updated:', message.data);
  }
}