Skip to main content

Subscribing

Market-data messages are delivered by subscription. Private account messages are not - they arrive automatically once the connection is authenticated.

Subscribe​

Send message type 151 with join: true:

[151, { "type": 151, "channel": "orderbook", "event": "BTCUSDT", "join": true }]
FieldTypeDescription
channelstringChannel name - see the table below.
eventstringChannel-specific key, usually the pair symbol (BTCUSDT).
joinbooleantrue to subscribe, false to unsubscribe.

Channels​

ChanneleventPushesType
tickerallAll tickers401
tickerpair symbol, BTCUSDTPair ticker402
tradepair symbol, BTCUSDTTrade422
orderbookpair symbol, BTCUSDTFull order book431
obdiffpair symbol, BTCUSDTOrder book difference432

Subscription result​

The server answers with a result message (type 100):

[100, { "type": 100, "ok": true, "message": "join|orderbook:BTCUSDT" }]

message is always "<join|leave>|<channel>:<event>".

Immediately after a successful join, if the server already holds a cached snapshot for that channel/event, it pushes that snapshot as a separate message - so you normally receive a full picture before the first incremental update.

Unsubscribe​

Send the same message with join: false. Two behaviours to be aware of:

  • Unsubscribe is answered only when it actually removed something. Leaving a channel you were not subscribed to produces no reply at all - not an ok: false.
  • Re-subscribing to a channel/event you are already on replies ok: false. That is an "already subscribed" signal, not a failure to deliver data; your existing subscription is untouched.