Skip to main content

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

ParameterTypeComments
topicstringTopic name
typestringData type. snapshot
tsnumberThe timestamp (ms) that the system generates the data
dataarrayObject
> startnumberThe start timestamp (ms)
> endnumberThe end timestamp (ms)
> intervalstringKline interval
> openstringOpen price
> closestringClose price
> highstringHighest price
> lowstringLowest price
> volumestringTrade volume
> turnoverstringTurnover
> confirmbooleanWeather the tick is ended or not
> timestampnumberThe 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"
}