Back

Speeding up backtests

Hello everyone,

when backtesting my latest algortihm which is working with second data for 10 different stocks it takes around five minute for a backtest over a period of five days. I think this could definitely be quicker. How much of a difference would it make to buy additional RAM? I already have one update. Or is my internet connection to slow? I have 16 MBit/s currently.

Kind regards,

Christian Lauer

Update Backtest








Wow this seems slow. It's not doing anything fancy as far as I can tell. Then again, I'm using C#.

One thing that can be slow: Subscribed indicators and by extension maybe consolidators. Calling .Update() manually on them from OnData is typically faster (at least in C# case). Still, I doubt it accounts for massive slowness here.

0

4k/sec is slow for second data. In C# its 50k/sec. 10 second symbols - 23,400 samples per symbol-day; 1,170,000 points + your scheduled events. My guess is all of the dictionary enumerators are slowing it down (vs using object access). 

We're still learning / understanding the python-C# interactions but saw one support request where commenting out a single (pandas) line caused it to finish 10x faster and use 1/10th RAM. 

0

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.


"4k/sec is slow for second data. In C# its 50k/sec. 10 second symbols - 23,400 samples per symbol-day; 1,170,000 points + your scheduled events. My guess is all of the dictionary enumerators are slowing it down (vs using object access). 

We're still learning / understanding the python-C# interactions but saw one support request where commenting out a single (pandas) line caused it to finish 10x faster and use 1/10th RAM. "

 

Interesting, At some point if you learn what types of operations are better than others it would be good to compile that into some sort of speed optimization tutorial post. I am getting 4k data points per second in python as well and had no idea that was abnormal.

1

Update Backtest





0

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.


Loading...

This discussion is closed