Skip to main content

Subscribe to per-market channels

Server replies with a confirmation listing the channels that became newly-subscribed:

Subscribe to per-wallet channels

Confirmation:
You can subscribe to multiple wallets on one connection: each subscribe request scopes to one wallet. Mixing market-keyed and wallet-keyed channels in a single subscribe request is allowed, the server partitions them by keying, but each group needs its matching field: market-keyed channels require market, wallet-keyed channels require user.
Recommended: send one subscribe per keying. If you mix groups and a required field is missing, the server emits the INVALID_MESSAGE error for the first offending group and stops processing the rest of that request — the other groups in the same frame are silently skipped. To avoid this, send market channels (with market), wallet channels (with user), and global channels in separate subscribe frames. It’s cheap and unambiguous.
For each newly-subscribed channel that has a snapshot semantic orderbook, trades, ticker), the server immediately pushes a snapshot frame on the same connection. Subsequent frames for that channel are incremental updates limit_orders / user_orders user_fills have no snapshot, they’re event-driven only. If you’re already subscribed to a channel, you get an ALREADY_SUBSCRIBED error for that channel (channel-by-channel partially-new subscriptions still proceed for the new ones). Unknown channel names return INVALID_MESSAGE.

Subscribe to kline / mid_kline

Kline subscriptions take a resolution instead of a channels list, because only one resolution per market per connection is active at a time. Re-subscribing to a different resolution replaces the current one.
Valid resolutions: "1", "5", "15", "30", "60", "240", "D", "W", "M". Anything else returns INVALID_RESOLUTION. Confirmation:
Followed immediately by a snapshot of the current bar.

Subscribe to global channels

Global channels are connection-wide and need no key. A market field, if present, is ignored for these channels (harmless to send for parity with your other subscribe calls). The subscribed confirmation for a global channel echoes a market field. Because global channels are routed through the market-subscribe path internally, the confirmation for e.g. mini_tickers comes back as {"op":"subscribed","channels":["mini_tickers"],"market":"11111111111111111111111111111111"} (a placeholder all-ones address, or the market you passed if you passed one). Ignore the market field on global-channel confirmations, it carries no meaning. Match the confirmation on the channels array instead.

Unsubscribing

Unsubscribing a channel you weren’t subscribed to returns NOT_SUBSCRIBED. (The resolution in unsubscribe_kline / unsubscribe_mid_kline is required by the message shape but ignored — there’s only one active resolution per market to remove.)

Resync

If your client detects a gap or out-of-order sequence (e.g., it missed an orderbook delta), request a fresh snapshot for that market without re-subscribing:
The server re-sends a snapshot for every snapshot-bearing channel currently subscribed for that market (orderbook, trades, ticker, kline, mid_kline).