Hello fellow QC user, thanks for popping by.
I'm writing this post because I'm baffled by SPY price's mismatch in two different toy backtests. Both backtests span the same period -- 1 Jan 2015 to 3 Jan 2015. I can't figure out what is causing this mismatch but then again I could be too tired after a long day.
Backtest 1:
This backtest looks fine. All the SPY prices tally – SPY benchmark numbers, printed SPY prices, and the filled market order tally (all at about $180).
Backtest 2:
Is supposed to be identical to backtest 1 but is not.
Log of SPY prices
Urban
With a wee bit of trial and error, i found that commenting out the lines that add options in Backtest 2 causes it to give the same results as BackTest 1. But.. why should it? Is this a bug?
Louis Szeto
Hi Urban
In backtest 1, it is using split-and-dividend-adjusted price, while in backtest 2, raw price is used. Since LEAN haven't supported split adjustment for options, it'd force any underlying equities using raw price if their option is added to the universe, instead of adjusted price in default. If you add
in Initialize method of backtest 1's algorithm, it'll yield the same result of backtest 2.
Best
Louis
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.
Urban
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!