Can't stop reactor that isn't running.
-
I'm trying to get the ltp using websocket, and when i try to close the program in between using ctrl+c, i get errors "Can't stop reactor that isn't running", how to automatically exit the program after printing LTP only once?
def on_tick(ws, tick):
for i in tick:
for j, k in i.items():
if j == 'ltp':
print(k)
#how to exit here? -
@kiran1808 said in Can't stop reactor that isn't running.:
how to automatically exit the program after printing LTP only once?
If your sole objective is to print LTP once, then you should use ltpData function.
obj.ltpData('exchange', 'tradingsymbol', token)
It prints LTP only once.
-
If I remember correct code is the token number of the scrip that you subscribed.
-
@rajanprabu that doesnt work:
def on_tick(ws, tick):
for i in tick:
for j, k in i.items():
if j == 'ltp':
print(k)
on_close(WS,'S562xxxx','test_stop') -