Kucoin / kucoin-python-sdk

MIT License
40 stars 11 forks source link

[Websocket] on minute close #96

Open AnimusXCASH opened 1 year ago

AnimusXCASH commented 1 year ago

Hi,

can someone assist me how to get the close value of klines through websocket?

thank you.

progressivehed commented 1 year ago

Hello

When you subscribe to that topic, the response will look like this:

{ "type":"message", "topic":"/market/candles:BTC-USDT_1hour", "subject":"trade.candles.update", "data":{ "symbol":"BTC-USDT", // symbol "candles":[ "1589968800", // Start time of the candle cycle "9786.9", // open price "9740.8", // close price "9806.1", // high price "9732", // low price "27.45649579", // Transaction volume "268280.09830877" // Transaction amount ], "time":1589970010253893337 // now(us) } }

So in JSON response that you get, the third element in dic that you get would be the close price. In Python you can easily parse it by json.load()

AnimusXCASH commented 1 year ago

thank you.