Websocket code in Python - returns local time in ticks

SahityaY
SahityaY edited December 16 in Python client
Hi Team,

I am trying to stream the ticks data. Streaming seems to work fine, but the timestamp is showing local time of machine.
The highlighted is the machine timestamp, but the actual time for the exchange should be 10:30+ AM.



35950594 : 28.5 : 2024-12-16 09:04:34
[['35950594', datetime.datetime(2024, 12, 16, 9, 4, 34), 28.5]]


Code snippet :
def on_ticks(ws, ticks):
for tick in ticks:
global streaming_data_list
instrument=str(tick['instrument_token'])
timestamp=tick['exchange_timestamp']
ltp=tick['last_price']
print(f"{instrument} : {ltp} : {timestamp}")
streaming_data_list.append([instrument,timestamp,ltp])
print(streaming_data_list)

the first and the 2nd ouput lines pasted above are related to the first and 2nd print statements respectively.

My understanding was, the ticks data will contain the exchange datetime.
Can someone please clarify?
Sign In or Register to comment.