It looks like you're new here. If you want to get involved, click one of these buttons!
"Can't stop reactor that isn't running.")
twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
Before this another error occurs ::
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (None)
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (None)
ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
Unhandled Error
Can anyone please help me out with this? I don't understand why this error is occuring while live streaming the data.
You can go through this thread.
Thanks for the reply. I went through this thread but couldn't get a suitable solution.
But I saw in one comment that you have mentioned to remove
threaded=True
fromkws.connect( threaded=True)
I am using this
threaded
option because I am using Tkinter alongwith kiteconnect. Since tkinter also has a mainloop I had to use this, otherwise I was not able to update LTP in tkinter window.One thing to mention is that I am not using
threading
module for this case. Puttingkws.connect(threaded=True)
serves my purpose of properly updating the LTP in tkinter window.Do you have any suggestions for this?
You might be blocking main thread by not passing on to another thread in correct way.Can you go through this thread to see an example of multi-threading.
If the code(which is exactly like your documentation) is buggy the provide me the exact code line which has bug and why
Please Note : I didn't use on_close() on purpose because I don't want the execution to stop. And that is too according to your suggestion provided in different discussion thread. Below are the are the error messages occurs at different time Please do not say here that these error only occurring at my side and everywhere its working fine BECAUSE below is the link for another discussion thread where someone else has faced the same issue and there also you guys didn't provide the solution
https://kite.trade/forum/discussion/5426/error-while-live-streaming-data#latest
If these evidence are not enough then please let me know what else is required and how I can provide them
I know you guys just closed my last thread without providing the solution. So i am putting here again the issue
@enigma
Did you find any solution for this
Any updates ?
Connection error: 1006 - connection was closed uncleanly
is very common and is thrown by websocket quite regularly. U may end up losing few ticks but otherwise there is no impact, the websocket recovers by itself and reconnects and ticks continue.. I would say log the error and ignore it. My guess is that when websocket is unable to subscribe to parent due to network fault or simple overload it get disconnected by server and reconnects.. anyway that's something @zartimus or @sujith need to confirm.The problem is , I am converting these ticks in 5min candles and after that I do many calculation like body and shadow length,ATR etc. These calculation are necessary to generate buy or sell call. So if there are missing ticks frequently then all the output of those calculations will be changed , which generate wrong Trade Calls.
Do you have any trick to overcome this issue or get data for those missing ticks?
@zartimus @sujith Can you confirm this behavior of your websocket ?
Hi,
I still didn't get any solution. The thread which @rakeshr has mentioned didn't provide any suitable solution for the problem.
Hi @razcads ... Can you give some solution to handle the error.. Like any code sample if you could.
We are talking about algo trading here (and that's the bussiness opportunity Zerodha is monetizing with our money). Algo trading doesn't have discretion of an human being to swallow these errors gracefully. I have already endured big holes in my trading account due to crappy APIs and my discussion is still unanswered (as expected, as it takes balls to acknowledge failures and brains to rectify them).
On top of that, these guys are always ready with the template response "Hello {{foolish_customer.name}}, everything seems to be working fine on our end, please check your network."
kws.connect( threaded=True)
this will create one thread. So whenever at runtime I want to add new token/token_list should I be executing this code again?@drunkNifty :: Were you able to develop full code without these kinds of errors. If you have can you share some suggestions.. that would be really appreciated.
@razcads :: Surely I will try and let you know