Connection was closed uncleanly

srbhable
Hello Team,

I am facing similar problem as shown in this thread:

https://kite.trade/forum/discussion/7399/kiteconnect-ticker-connection-error-1006-connection-was-closed-uncleanly-none

I went through the same in detail. However, I have only one query regarding the 2nd method explained by rakeshhr sir.

I have a main function in my code which I am keeping in on ticks () function.

"
def on_ticks(ws,ticks):
helper_method(ticks)
main()
"
is the main() to be kept in the while loop on_ticks() as explained in threading method or below the logging.debug code?
and if the same is to be placed in while loop on_ticks(), the whether the main function itself also need to be placed there? (below helper function)

will be highly obliged with the help.

Regards,
Saurabh
Tagged:
  • rakeshr
    is the main() to be kept in the while loop on_ticks() as explained in threading method or below the logging.debug code?
    Depends on what you are looking to perform inmain method. If it need tick data as input, you can pass it inside on_ticks() or else outside while loop. Difficult to suggest unless defination of main method is clear.
  • srbhable
    Hello Sir,

    main method is not working on the ticks directly. Helper method is working on the same directly.
    However, main function is dependent on tasks performed by helper methods on ticks.

    So to explain, helper method is taking the ticks continuously and trying to check for whether renko bars are formed. Once renko is formed it is passed to dataframe and that dataframe is used by main function.
    Also, if I keep main function outside while loop, how to make it run every minute?
  • rakeshr
    if I keep main function outside while loop, how to make it run every minute?
    You can go through this article to know about this.
Sign In or Register to comment.