Hello, I'm running a backtest for selling weekly straddles on SPX. It seems to be pulling the prior day's close price instead of the current price when placing a trade, and for the life of me I can't figure out why. This is most apparent on 2/25/22, when it sells a straddle at 15:30 at a strike of 4,295 but the premium on the call is 3x the premium on the put side and the SPX closes at 4,385. I've tried calculating the strike based on both delta and abs(strike-self.underlying.Price), but neither method works. I don't think it's a FillForward issue because I set that to false. It seems so simple, can someone please help me figure out how to get the most recent underlying price available in that slice? TIA
Louis Szeto
Hi Ben
I'll recommend a daily resolution Identity indicator.
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.
Ben
Louis,Â
Thanks for the response. I'll try to understand the Identity indicator from the article you linked, but in the meantime, can you provide some color as to why I would need it and what exactly the issue is with my code?
Thanks
Louis Szeto
Hi Ben
Sorry I misunderstood you question. Your code is fine, but just seems there is a missing data issue on the price of SPX.
Please follow this data issue thread on fixing progress.
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.
Ben
Thank you Louis. I spent hours researching Slice and Trade Bars to figure out where I went wrong, because I thought the presence of FillForward=false eliminated the possibility of missing data. For my education, how did you figure that out? I can't tell from your screenshot. And how would you recommend I check for missing data so I can skip that week if so?
Thanks much
Louis Szeto
Hi Ben
The debugger stopped at 15:30, but the history only stopped at 14:30 of the same day. You can't really have a check on missing data, but you could check if spx has a slice data by
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.
Ben
I tried that, but that slice does contain the key. It's just stale. So what I did is logged the price every min as prev_price and then skipped the trade if prev_price == self.underlying.Price.
Ben
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!