Hello everyone, I have been looking at https://www.quantconnect.com/docs/v2/writing-algorithms/trading-and-orders/option-strategies/call-calendar-spread and noticed some strange behaviour in this implementation. A calendar call is when we sell near-term and buy far-term keeping the same strike. Getting 100% ATM is almost impossible so we get slight ITM or OTM instead. Now, if I use weeklies, and if I change X in the snippet ( return universe.IncludeWeeklys().Strikes(-1, 1).Expiration(timedelta(4),timedelta(X)) ) to 30,50,90: it gives me the same contracts regardless (AAPL 220506C00157500 & AAPL 220520C00157500). 

My understanding of the Expiration method in this context is we define with it , - near and far terms. The incorrect contract pick is caused by 

calls = [i for i in chain if i.Strike == atm_strike and i.Right == OptionRight.Call]

taking a strike from the chain and then excluding all contracts that do not have this strike limiting our choice. It would be good to have some data validation because we may have a case (i.e. we happen to hit a strike of 145.25 when the rest of the chain is spaced 0,50) where for very liquid equities we may have a narrow trading spread.   

any thoughts on this? unless I am mad and missing something …   

 

Author