kline streams OHLCV bars off the last-traded-price. Kline uses its own
subscribe_kline op with a resolution (only one resolution per market per
connection — re-subscribing replaces it).
Step 1 - subscribe with a resolution.
"1", "5", "15", "30", "60", "240" (minutes),
"D", "W", "M". Anything else → INVALID_RESOLUTION.
Step 2 - seed with the current-bar snapshot (type: "snapshot").
Step 3 - update the live bar
Everytype: "update" carries the current bar. The bar’s time is unix-seconds (not ms) of
the bar open. A new bar is signaled implicitly: when an update arrives with a time greater
than your current bar’s time, the previous bar has closed, commit it and start the new
one. There is no explicit “bar closed” message.
Historical bars come from RESTGET /v1/klines), not the stream — the WSklinechannel only carries the current open bar and its updates. Load history via REST, then attach the stream for the live bar.mid_klineis identical but built from the book mid(best_bid + best_ask) / 2) instead of trade prints, usesubscribe_mid_klineand switch onmsg.ch === "mid_kline". The two are independent streams; subscribe to whichever (or both) you need.