We migrated to the use of Universes in order to return fundamental data and to subscribe to options in advance of obtaining Greeks data at runtime. (Prior methods using AddOptionContract() required the next cycle of OnData() in order to warm up the chain data to get those values.) Now, upon adding an equity security by way of coarse and fine universe selection, we also invoke AddOption for that equity. Thus, the chains and their contracts are subscribed and automatically filled forward.
With this, though, we have a new issue, which is how to obtain an Enumerable or IEnumerable or List of the already subscribed options contracts? It's difficult in Slice.OptionChains without using a for loop. The options securities are in the universe, but how can we access the universe without looping through the universe manager? Perhaps that's not the way either.
Does anyone know of a way to get these contracts into something we can poll or query that does not involve “re-subscribing” with AddOptionContract()? Thank you in advance for your help.
Louis Szeto
Hi Craig
We recommend using AddOptionContract, not AddOption, when working with Universe Selection. The algorithm can call OptionChainProvider+AddOptionContract in Universe Selection Model. The Greeks and Implied Volatility will be available in the following iteration. E.g.: call AddOptionContract at 9:35, greeks will be available at 9:36 in minute resolution data. It's not possible to select options based on the greeks at Universe Selection Model because the historical data requests don't include this information. A possible solution will be doing initial filtering in Universe Selection Model, and further filtering by greeks in OnData.
Please check the attached backtest as an example.
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.
Craig McWilliams
Louis, are you still available to discuss this topic. I have questions, but don't want to write them if you're no longer available. Thank you, Craig
Louis Szeto
Hi Craig
Please be welcome to post them. It would help the community on this topic. Supporting staffs, community ambassadors and our fellow community members are willing to help!
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.
Craig McWilliams
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!