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
}
}
}| Parameter | Required | Description |
|---|---|---|
instrument_name | No | Full instrument name (e.g., "BTC_USDC-31OCT25-130000-C") |
pair | No | Trading pair (e.g., "BTC_USDC") |
maturity | No | Expiration date (e.g., "31OCT25") |
strike | No | Strike price |
type | No | "C" for Call, "P" for Put |
direction | No | "buy" or "sell" |
options.skip_snapshot | No | Skip 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.
| Event | Description |
|---|---|
post_order | New order posted to the orderbook |
cancel_order | Order cancelled |
update_order | Order 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);
}
}Updated about 15 hours ago
