If I have a lot of slow method calls in my OnData is it possible for it to timeout and to proceed to the next data tick in backtests before all of the calculations are completed and orders placed? I am doing minutely resolution and I noticed that when I add another line of code that takes significant time/memory to initialize my returns in the backtest drop from around +60% to -30%. The line doesn't do any orders or affect anything else at the moment, but if it is executing too slowly is it possible that the next minute happens before the OnData is done? The backtest itself is less than a minute
Jing Wu
It depends on your algorithm logic. OnData () method is called in the data resolution. If you only need to execute the line that slows down the algorithm for like once a day or once a week instead of every minute, you can utilize the scheduled event API
You can move the code into the schedule event method.
Jordan Bakke
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!