kws.connect() ``` The problem is if I incorporate this into a script i.e.:
``` option_chain = opt_chain() # use the data after pulling x = option_chain[0] ```
The code gets stuck in the opt_chain and does not move onto the `x = option_chain[0]`.
Edit: If I close using `ws.stop()` then the next lines can be executed, but if I want to run the code again then I get the twisted.internet.error.ReactorNotRestartable error.
When are you calling option_chain = opt_chain()? Is this after kws.connect(). If it's after kws.connect(), then nothing will be called, this runs infinite loop on the main ticker thread.
option_chain = opt_chain()
? Is this afterkws.connect()
.If it's after
kws.connect()
, then nothing will be called, this runs infinite loop on the main ticker thread.