Hi,
I have a backtest that analyzes the SP 500 for the past 10 years and finds the top 5 gainers and losers for each month. It buys the top 5 gains and shorts the top 5 losers at the beginning of the month and the liquidates at the end of the month. It works but very, very slowly. Is there any way optimize my algorithm?
Right now it checks the date and if it's the first of the month it buys/shorts and then does another check to see if it's the end of the month and liquidates if it is. It doesn't need anything better than daily resolution but I believe that's not an option currently? Also, I initially tried this so that the algo was analyzing the sp500 and finding the top/worst 5. But I thought the slowness was due to this so I did a bunch of data crunching and hardcoded the top/worst 5 in my algo. Unfortunately, I didn't see an improvement in speed.
Thanks!
Jocelyn
JayJayD
Jared Broad
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.
Jocelyn Chang
Jocelyn Chang
JayJayD
2015-01-30 16:00:00 Algorithm Id:() completed in 12.15 seconds at 20k data points per second. Processing total of 245,704 data points.
Another backtest, with a 3 years period:2015-05-29 16:00:00 Algorithm Id:() completed in 143.27 seconds at 15k data points per second. Processing total of 2,193,810 data points.
And your algorithm:2005-03-31 16:00:00 Algorithm Id:() completed in 599.70 seconds at 12k data points per second. Processing total of 7,315,466 data points.
So, in one hand, seems the engine is slower as the data points increases. In the other, your algo uses <7M data for just 3 months! That's my two cents. JJJocelyn Chang
Jared Broad
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.
Jocelyn Chang
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!