Subscribe to BOOK_TICKER
Send a SUBSCRIBE message naming BOOK_TICKER. The server answers with a SUBSCRIPTIONS confirmation, or an error. Pass the markets you want in instrument_codes, which is required; a missing or empty list is rejected with INVALID_INSTRUMENT_CODES_LIST. A further SUBSCRIBE adds instruments to the ones you already receive.
Real-time best bid and ask prices, with their quantities, for the instruments you subscribe to. A lightweight alternative to ORDER_BOOK for strategies that rely on top-of-book information. A BOOK_TICKER_SNAPSHOT with the current top of the book is sent for each instrument when you subscribe.
const payload = { "type": "SUBSCRIBE", "channels": [ { "name": "BOOK_TICKER", "instrument_codes": [ "BTC_EUR", "ETH_EUR" ] } ]};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => { socket.send(JSON.stringify(payload));});instrument_codes is required: a missing or empty list is rejected with INVALID_INSTRUMENT_CODES_LIST.
- payload
type*stringchannels*array<>1 <= items <= 1Subscribe to BTC_EUR and ETH_EUR top of book
{ "type": "SUBSCRIBE", "channels": [ { "name": "BOOK_TICKER", "instrument_codes": [ "BTC_EUR", "ETH_EUR" ] } ]}Reply
Sent back on the same channel.