Hello quant experts,
I am curious about when the algo will remove the option contracts we added using AddOptionContract with the OptionChainProvider. I've tried to to explicitly call RemoveOptionContract in some key places in the algo, for i.e., after closing the position using such contracts, or using a schedule after the market closes but I had more troubles doing that than just leaving the option contracts quietly there.
Louis Szeto
Hi Rafael
The algorithm will not remove that unless we call RemoveOptionContract explicitly. It shouldn't be a big drag since the contract will have no more data after it expires. Given the logic you suggested, you could do so in OnOrderEvent when the closing order is Filled and self.Portfolio[contract].Invested == False.
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.
Rafael Trevisan
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!