Skip to Content
Order book

Subscribe to ORDER_BOOK

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

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.

Code Sample
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));});

Messages

application/json
  1. payload
type*string
channels*array<>
Items1 <= items <= 1
orderBookBtcEth

Subscribe to BTC_EUR and ETH_EUR order books

{  "type": "SUBSCRIBE",  "channels": [    {      "name": "ORDER_BOOK",      "instrument_codes": [        "BTC_EUR",        "ETH_EUR"      ]    }  ]}

Reply

Receive

Sent back on the same channel.