Hi,
today I started for the first time using quantconnect and the Lean engine. I'm curious what's the reason for such inredibly slow backtest performance? I use BasicTemplateAlgorithm.cs and I simply changed it to do raw SPY with second resolution for four days (from 2013/10/07 to 2013/10/11).
Originally the template had:
if (!Portfolio.Invested)
{
SetHoldings(_spy, 1);
Debug("Purchased Stock");
}
with this it would proabbly take hours to run the backtest, somehow I was getting "Purchased stock" message over and over again. So, I commented it out and made effectively my OnData do nothing and ... it would take huge amount of time to do nothing at all. I do C++, and I'd expect that basic SPY with second resolution that doesn't do too much complex computations would take a few secons to run over 10 years (which should be roughly 60M seconds).
In a couple of hours I'd be able to write from scratch a c++ program that reads thouse SPY zips and calls raw OnData and I'm pretty sure it will take perhaps thousand times less that it takes now. I'm sure it's not c# performance, but something else kills it. Any ideas?
Michael Manus
did you backtest it in the cloud? with the second resolution?
if so it is a cloud server from amazon or something like that QC pays for the community where you are not alone backtesting?
or is it a local backtest on your pc?
Pavel P
I ran on my own PC, but when I removed all the code from the OnData handler results were much better, seems that my C# skills resulted in something that made it super slow :)
Jared Broad
Feel free to post lessons you learned to make this thread useful. Common Mistakes:
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.
Pavel P
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!