Skip to Content
Connection

Subscribe

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

Before you can receive or send messages on a channel, you must subscribe to it. Only one channel can be named per SUBSCRIBE message. Each channel section documents its exact subscribe message and confirmation.

Subscribing is additive: a further SUBSCRIBE to a channel you already have adds its instruments to the ones you receive, and never removes any. MARK_PRICE is the exception, where a new SUBSCRIBE replaces the selection. To drop instruments, UNSUBSCRIBE from the channel and subscribe again.

Connection-level messages on the shared socket: authentication, generic subscribe and unsubscribe, heartbeats and errors.

Code Sample
const payload = {  "type": "SUBSCRIBE",  "channels": [    {      "name": "TRADING"    }  ]};const socket = new WebSocket("wss://streams.fast.onetrading.com/");socket.addEventListener("open", () => {  socket.send(JSON.stringify(payload));});

Messages

You can only subscribe to one channel in a single SUBSCRIBE message. ORDER_BOOK, PRICE_TICKS and BOOK_TICKER require an instrument_codes property alongside the channel name; MARK_PRICE takes it optionally. A further SUBSCRIBE to the same channel adds instruments rather than replacing them, except on MARK_PRICE. See each channel for its exact subscribe message.

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

Subscribe to the TRADING channel

{  "type": "SUBSCRIBE",  "channels": [    {      "name": "TRADING"    }  ]}

Reply

Receive

Sent back on the same channel.