Skip to Content
Order book

Order book updates

Receive
/
Serverwss://streams.fast.onetrading.com

After subscribing, you receive an ORDER_BOOK_SNAPSHOT per instrument, then ORDER_BOOK_UPDATE messages as the book changes. You only receive updates for the instrument_codes you specified.

The snapshot comes first. The server holds back updates for an instrument until its snapshot has been sent, then sends the held updates in order, leaving out any the snapshot already includes. (If no snapshot is available for an instrument, its updates are sent without one.)

Sequencing. Every snapshot and update carries unum_bids and unum_asks. Each update advances both by exactly 1. Keep the values from the last message you applied, and apply an update only when its unum_bids and unum_asks are each 1 more than those. If an update skips ahead, you have missed one: discard your copy of the book and send SUBSCRIBE for that instrument again, which sends a fresh snapshot.

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.

Code Sample
const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("message", (event) => {  console.log(event.data);});

Messages