WebSocket
Subscribe to binary options market statistics and underlying price candles.
Binary options markets use the shared order-book, trade and account channels listed below, alongside two binary-options-specific channels: bo_market_stats and up_down_candle. The market_stats and spot_market_stats channels exclude binary options.
Connect to wss://mainnet.zklighter.elliot.ai/stream. Follow the existing WebSocket reference for connection handling and reconnects.
Shared WebSocket channels
The WebSocket reference covers these general-purpose channels, including their subscription formats, authentication and response payloads. For subscriptions that take a market ID, use the binary options market_id returned by events.
| Channel | Binary options data |
|---|---|
| order_book/{MARKET_INDEX} | Order-book snapshots and updates for a market |
| trade/{MARKET_INDEX} | Public trades for a market |
| account_all/{ACCOUNT_ID} | Account data, with binary options positions in bo_positions |
| account_all_positions/{ACCOUNT_ID} | Account positions, including bo_positions |
| account_market/{MARKET_ID}/{ACCOUNT_ID} | Account data for one market, with its binary options position in bo_position |
| account_orders/{MARKET_INDEX}/{ACCOUNT_ID} and account_all_orders/{ACCOUNT_ID} | Account orders for one market or across markets |
| account_all_trades/{ACCOUNT_ID} | Account trades, including binary options trades |
Binary options market stats
Sends the stats object of a binary options market, for one market or all of them.
{
"type": "subscribe",
"channel": "bo_market_stats/{MARKET_INDEX}"
}Subscribe to all binary options markets:
{
"type": "subscribe",
"channel": "bo_market_stats/all"
}For bo_market_stats/all, the bo_market_stats payload is an object keyed by market ID, not an array. Each value is a market stats object. For a single-market subscription, bo_market_stats is that market's stats object directly.
The all-market stream can include old, settled and not-yet-open markets. Filter for status: "active", then check start_timestamp, end_timestamp and is_frozen in the market definition returned by events before placing orders. Do not assume every market in this stream is currently tradeable.
Response fields
For a single-market update, channel is bo_market_stats:{MARKET_INDEX}, type is update/bo_market_stats, and timestamp is an integer. The bo_market_stats object contains:
| Field | Type | Meaning |
|---|---|---|
symbol | string | Market symbol |
market_id | integer | Market ID |
mid_price, best_ask_price, best_bid_price, last_trade_price | string | Order book and last-trade prices |
daily_base_token_volume, daily_quote_token_volume | number | Daily base and quote volume |
daily_price_low, daily_price_high, daily_price_change | number | Daily price statistics |
lifetime_quote_token_volume, lifetime_base_token_volume | number | Lifetime quote and base volume |
open_interest | string | Open interest |
status | string | inactive, active, waiting-for-settlement, in-settlement or settled |
outcome | integer | 0: none; 1: No/Down; 2: Yes/Up |
See Market lifecycle for each status.
Up/Down candlesticks
Live candles of the underlying price of a series. Resolutions: 1s (every price observation) and 30s. The first message (subscribed/up_down_candle) is a snapshot of the last 300 candles (or fewer if less history is available); updates carry the changed candle(s).
{
"type": "subscribe",
"channel": "up_down_candle/{SYMBOL}/{DURATION}/{RESOLUTION}"
}Example subscription
Use symbol and duration from the selected event’s metadata returned by events. The values below illustrate the channel format.
{
"type": "subscribe",
"channel": "up_down_candle/btc/15m/1s"
}Response fields
For the example above, channel is up_down_candle:btc:15m:1s. Updates have type: "update/up_down_candle", an integer timestamp, and a candles array. Each candle contains:
| Field | Type | Meaning |
|---|---|---|
symbol | string | Underlying asset, for example btc |
duration | string | Observation-window duration, for example 15m |
resolution | string | 1s or 30s |
timestamp | integer | Candle bucket start, in Unix seconds |
open, high, low, close | string | Underlying prices as decimal strings |
provider | string | Price provider |
feed_id | string | Underlying price feed identifier |
These candles describe the underlying price feed, not the binary options order book. Use upDownCandles for REST history; see Discover markets for an example.
Updated about 10 hours ago
