LT Kline
Subscribe to the leveraged token kline 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_lt.{interval}.{symbol}
e.g., kline_lt.30.BTC3SUSDT
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). It is current timestamp if it does not reach to the end time of candle |
> interval | string | Kline interval |
> open | string | Open price |
> close | string | Close price |
> high | string | Highest price |
> low | string | Lowest price |
> confirm | boolean | Weather the tick is ended or not |
> timestamp | number | The timestamp (ms) of the last matched order in the candle |
Subscribe Example
from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="spot",
)
def handle_message(message):
print(message)
ws.lt_kline_stream(
interval=30,
symbol="EOS3LUSDT",
callback=handle_message
)
while True:
sleep(1)
Response Example
{
"type": "snapshot",
"topic": "kline_lt.5.EOS3LUSDT",
"data": [
{
"start": 1672325100000,
"end": 1672325399999,
"interval": "5",
"open": "0.416039541212402799",
"close": "0.41477848043290448",
"high": "0.416039541212402799",
"low": "0.409734237314911206",
"confirm": false,
"timestamp": 1672325322393
}
],
"ts": 1672325322393
}