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)
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.
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?
main
method. If it need tick data as input, you can pass it insideon_ticks()
or else outside while loop. Difficult to suggest unless defination of main method is clear.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?