Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Extremely slow backtest

I'm just starting with Quantopian, as a way to tinker with Python, Machine Learning, and financial data. I have gotten to the good first step of getting an algorithm to build and make trades -- however my backtest is painfully slow, and I'm wondering if perhaps I'm doing something incredibly inefficient. I am running a 5-year backtest and I only got about a quarter of the way through in an hour. This seems unusually slow.

Any thoughts?

Thanks,
Marc

3 responses

Just a beginner's hunch -- but I'm thinking that perhaps the factors I am creating are operating on the entire stock portfolio each day, as opposed to a masked or filtered set. Should I be building custom factors perhaps?

making orders is slow, you're basically making a list of up to 1500 stocks with signals and ordering them every day. You want to use your pipeline to only get the top/bottom X stocks based on your bull_intensity and only order those. For X I would not go above 100.

Thanks, I thought that my bull_intensity filter would cull the list to a smaller lot, but you are indeed correct, I needed to clamp down on the number of securities and it really sped things up. Thanks.

Marc