python-kucoin
python-kucoin copied to clipboard
Could we bring the the "Subject" object from the Websocket Ticker Response?
Hi there! First of all, thanks a lot for all your work. Without your libraries I doubt I would have been able to immerse myself in dealing with Binance or Kucoin APIs.
I do have a question about the Websocket. When I subscribe to get all the symbols ('/market/ticker:all') the response does only contain the "data" object, so it does not say to what pair does it relate to.
Is there any way of bringing the "subject" object as well?
async def main():
global loop
async def handle_evt(msg):
print(msg["data"])
client = Client(api_key, api_secret, api_passphrase)
ksm = await KucoinSocketManager.create(loop, client, handle_evt)
await ksm.subscribe('/market/ticker:all')
response from code above:
{'bestAsk': '5.8412', 'bestAskSize': '98.0368', 'bestBid': '5.82', 'bestBidSize': '9.476', 'price': '5.8323', 'sequence': '1615121675585', 'size': '1.9945', 'time': 1639786832796}
Kucoin Documentation response example with the subject object:
{
"type":"message",
"topic":"/market/ticker:all",
"subject":"BTC-USDT",
"data":{
"sequence":"1545896668986",
"bestAsk":"0.08",
"size":"0.011",
"bestBidSize":"0.036",
"price":"0.08",
"bestAskSize":"0.18",
"bestBid":"0.049"
}
}
Thanks a lot in advance!