Subscribing & Unsubscribing
Last updated
Last updated
Once connected to the WebSocket API you can subscribe to various feeds using the subscribe
or unsubscribe
commands.
These commands should be JSON with the following properties:
Property | Type | Description |
---|---|---|
To begin receiving feed messages, you must send a subscribe
message to the server indicating which feeds to receive. This message is mandatory—you may be disconnected if no subscribe
has been received.
To ensure optimal performance, we suggest maintaining a separate Websocket connection for market data subscriptions (orderbooks, tickers, trades) to ensure high-frequency market data doesn't impact the delivery of your time-sensitive account level updates, such as balances or open-orders messages.
Once a subscribe
message is received the server responds with a subscribe
message that lists all feeds you are subscribed to. Subsequent subscribe messages add to the list of subscriptions.
To unsubscribe from a feed or feeds, send an unsubscribe
message. The structure is equivalent to subscribe
messages.
Once a unsubscribe
message is received the server responds with an unsubscribe
message that lists all feeds you are unsubscribed from.
type
string
Command you are sending to the WebSocket (subscribe
or unsubscribe
).
feeds
string[]
List of the feeds that should be subscribed/unsubscribed to/from, respectively.