{
"symbol" : "$symbol0, $symbol1",
"topic" : "$topic",
"event" : "sub",
// customizable parameter
"params" : {
// kline max limit is 2000, default is 1
"limit" : "$limit",
// Whether data is returned in binary format, default to false
"binary" : "false"
}
}
name
Explanation
limit
Specify number of entries returned
binary
Whether returned values is in binary format. DEFAULT value is false
Heartbeat
The client need to send a PING message to the server regularly through the Websocket, which then the server replies with PONG. If the client does not send the message every 5 minutes, the server will close the connection.
Request
{
"ping": 1535975085052
}
Response
{
"pong": 1535975085052
}
Trade Streams
The Trade Streams push raw trade information; each trade has a unique buyer and seller.
After successful handshake and connected to server, the server will return the latest 60 trades. After this payload, the following will be real-time trades.
Variable "v" acts as an tradeId. This variable is shared across different symbols; however, each ID is unique. For example, suppose in the last 5 seconds 3 trades happened in BTCUSDT, ETHUSDT, and XRPUSDT. Their version (which is "v") will be consecutive: 112, 113, 114.
Subscription message structure:
{
"symbol": "$symbol0, $symbol1",
"topic": "trade",
"event": "sub",
"params": {
"binary": false // Whether data returned is in binary format
}
}
Full depth streams all orderbook data, therefore the data frequency is relatively low. If you wish to get higher frequency streams, please see below to subscribe to merged depth. Notice: "mergedDepth" has fewer data.
dumpScale must be specified for this endpoint. It it the precision of the ticker, it cannot be larger than the specified precision. Check precision at brokerInfo (token, options, and contracts).
Order book price and quantity depth updates used to locally manage an order book pushed every second.
In the Diff. (difference) depth stream, the quantity doesn"t necessarily mean the corresponding quantity to the price anymore. If the quantity is 0, it means this previous price level is not in the orderbook anymore. If the quantity is > 0, it means the updated quantity for this price level.
Suppose now we have received the first depth data payload:
["0.00181860", "155.92000000"] // price, quantity
If the next payload is:
["0.00181860", "12.3"]
This means that this price level"s quantity has changed.
If the next payload is:
["0.00181860", "0"]
This means that this price level is not in orderbook anymore.