def on_connect(ws, response): # Callback on successful connect. # Subscribe to a list of instrument_tokens (RELIANCE and ACC here). ws.subscribe([738561])
# Set RELIANCE to tick in `full` mode. ws.set_mode(ws.MODE_LTP, [738561])
def on_close(ws, code, reason): # On connection close stop the event loop. # Reconnection will not happen after executing `ws.stop()` ws.stop()
# Infinite loop on the main thread. Nothing after this will run. # You have to use the pre-defined callbacks to manage subscriptions. kws.connect()
$$$$$$ ERROR$$$$$$
ReactorNotRestartable Traceback (most recent call last) in 34 # Infinite loop on the main thread. Nothing after this will run. 35 # You have to use the pre-defined callbacks to manage subscriptions. ---> 36 kws.connect()
It works only on the anaconda session for the first time. If the connection is interrupted, the ReactorNotRestartable error comes back. Close your jupyter notebook session and restart. Or restart your kernel. It should work then.
I tried restarting Jupiter lab twice or thrice
I am very new to programming languages and also trading.
I am not able to troubleshoot, looking for ready to deploy code.
can anyone post the code or link of the code? or am I using the right code it is just the issue with anaconda?
Thanks.