Kline
Subscribe to the klines stream.
tip
If confirm
=true, this means that the candle has closed. Otherwise, the candle is still open and updating.
Available intervals:
1
3
5
15
30
(min)60
120
240
360
720
(min)D
(day)W
(week)M
(month)
Push frequency: 1-60s
Topic:
kline.{interval}.{symbol}
e.g., kline.30.BTCUSDT
Response Parameters
Parameter | Type | Comments |
---|---|---|
topic | string | Topic name |
type | string | Data type. snapshot |
ts | number | The timestamp (ms) that the system generates the data |
data | array | Object |
> start | number | The start timestamp (ms) |
> end | number | The end timestamp (ms) |
> interval | string | Kline interval |
> open | string | Open price |
> close | string | Close price |
> high | string | Highest price |
> low | string | Lowest price |
> volume | string | Trade volume |
> turnover | string | Turnover |
> confirm | boolean | Weather the tick is ended or not |
> timestamp | number | The timestamp (ms) of the last matched order in the candle |
Subscribe Example
const socket = new WebSocket('wss://stream-testnet.zoomex.com/v3/public/linear');
socket.onopen = function() {
const subscribeMsg = {
"op": "subscribe",
"args": ["kline.5.BTCUSDT"]
};
socket.send(JSON.stringify(subscribeMsg));
};
socket.onmessage = function(event) {
};
socket.onclose = function(event) {
};
Response Example
{
"topic": "kline.5.BTCUSDT",
"data": [
{
"start": 1672324800000,
"end": 1672325099999,
"interval": "5",
"open": "16649.5",
"close": "16677",
"high": "16677",
"low": "16608",
"volume": "2.081",
"turnover": "34666.4005",
"confirm": false,
"timestamp": 1672324988882
}
],
"ts": 1672324988882,
"type": "snapshot"
}