How do I specify filter for monthly contracts in C#?
QUANTCONNECT COMMUNITY
How do I specify filter for monthly contracts in C#?
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.
Alexandre Catarino
You can define the filter with a Linq expression:
var option = AddOption("GOOG"); option.SetFilter(universe => universe.IncludeWeeklys().Strikes(-2, +2) .Expiration(TimeSpan.Zero, TimeSpan.FromDays(10))); // For weeklys only, change IncludeWeeklys() for WeeklysOnly()
Valery T
I am confused. Will that produce monthly contracts only?
Alexandre Catarino
Valery T, sorry. I misundestood your question.
By default we only get monthy contracts. So you don't need to do anything fancy, just use the normal SetFilter:
option.SetFilter(-1, +1, TimeSpan.Zero, TimeSpan.FromDays(60));
Valery T
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!