Date and time stamp for streaming data

avinashcherukuri
I am getting the streaming data using the following code for Nifty 50, however am not getting the date & time stamp. Moreover, while my request is for full mode, I am getting only quote. Can you help, what I am missing?
====================================
from kiteconnect import WebSocket
api_key = "XXX"
public_token = "XXX"
user_id = "XXX"
tokens =[53372167]
pa=WebSocket(api_key,public_token,user_id)
def on_tick(tick,wbskt):
print(tick)

def on_connect(wbskt):
wbskt.subscribe(tokens)
wbskt.set_mode(wbskt.MODE_FULL,tokens)

pa.on_tick=on_tick
pa.on_connect=on_connect
pa.connect()
===================================
Output format
[{'tradeable': False, 'mode': 'quote', 'instrument_token': 256265, 'last_price': 10511.9, 'ohlc': {'high': 10538.1, 'low': 10510.95, 'open': 10518.2, 'close': 10454.95}, 'change': 0.54}]
[{'tradeable': False, 'mode': 'quote', 'instrument_token': 256265, 'last_price': 10511.35, 'ohlc': {'high': 10538.1, 'low': 10510.95, 'open': 10518.2, 'close': 10454.95}, 'change': 0.54}]
[{'tradeable': False, 'mode': 'quote', 'instrument_token': 256265, 'last_price': 10511.35, 'ohlc': {'high': 10538.1, 'low': 10510.7, 'open': 10518.2, 'close': 10454.95}, 'change': 0.54}]
[{'tradeable': False, 'mode': 'quote', 'instrument_token': 256265, 'last_price': 10511.7, 'ohlc': {'high': 10538.1, 'low': 10510.7, 'open': 10518.2, 'close': 10454.95}, 'change': 0.54}]
  • avinashcherukuri
    please read tokens=[256265]
  • sujith
    You seem to be using an old version of Kite Connect which will be deprecated soon. You need to use Kite Connect 3.
    You can check out the kite3 branch for latest Kite Connect.
    By default when you subscribe for data, it will be subscribed in Quote mode and from the second tick, you will receive data in full mode.
Sign In or Register to comment.