Subscribe to ORDER_BOOK
Send a SUBSCRIBE message naming ORDER_BOOK. The server answers with a SUBSCRIPTIONS confirmation, or an error. Pass the markets you want in instrument_codes, which is required. A further SUBSCRIBE adds instruments to the ones you already receive, and sends a fresh snapshot for each instrument it names.
Real-time order book data for the subscribed markets: an initial snapshot giving a complete view of active bids and asks, then incremental updates as changes occur, such as new orders, modifications, or cancellations. The snapshot is always the first order book message you receive for an instrument, and unum_bids and unum_asks let you check that no update has been missed.
const payload = { "type": "SUBSCRIBE", "channels": [ { "name": "ORDER_BOOK", "instrument_codes": [ "BTC_EUR", "ETH_EUR" ] } ]};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => { socket.send(JSON.stringify(payload));});- payload
type*stringchannels*array<>1 <= items <= 1Subscribe to BTC_EUR and ETH_EUR order books
{ "type": "SUBSCRIBE", "channels": [ { "name": "ORDER_BOOK", "instrument_codes": [ "BTC_EUR", "ETH_EUR" ] } ]}Reply
Sent back on the same channel.