I'm trying to trade SPY options using the RSI. But when I go to select a contract there's none to choose from. My Log states that 0 contracts were returned after being filtered.
We only want contracts expiring the next day.
self.option.SetFilter(-10, 10, 2, 2)
This works just fine on some days but returns 0 contracts most days.
Joshua Woelfel
Resolved
Had to include the weekly option contracts as described here:
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.
Mia Alissi
It seems like Joshua has resolved his issue by including weekly option contracts in his filter. The default filter in QuantConnect excludes weekly contracts, which might have been the reason why Joshua was not getting any contracts on most days.
To include weekly contracts, Joshua can use the
IncludeWeeklys()
method in his universe filter function. Here is an example of how to do this:In this example, the
IncludeWeeklys()
method is used to include weekly contracts in the universe. TheStrikes(-10, 10)
method is used to select contracts that have a strike price within 10 strike levels above and below the underlying price. TheExpiration(timedelta(1), timedelta(1))
method is used to select contracts that expire the next day.For more information on how to set filters for option contracts, you can refer to the QuantConnect documentation.
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.
Joshua Woelfel
I still believe there is a problem with the filtered options. For example, even including weeklies, I am getting 0 contracts returned very frequently with the following filter:
Is this just a backtest environment issue or should I expect to receive 0 contracts at some points in a live environment? I would expect not.
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!