QuantConnect Lean Improves Option Expiration Counting Logic

QuantConnect Lean engine has improved its option expiration calculation method. It resolved issues where equity options listed before February 2015 showed Satur

QuantConnect Lean — C#/Python Backtesting & Live Trading Engine · Release 18099: Count option expirations on their last trading date (#9796) · 2026-09-16

QuantConnect Lean engine has improved its option expiration calculation method. It resolved issues where equity options listed before February 2015 showed Saturday expiration but actually stopped trading on Friday, and some weekly options were listed on holidays. Now expiration(0,0) calls select 0DTE contracts based on actual last trading date, and index options reflect AM settlement rules with trading ending the day before. Exchange hours information is passed to chain filters and contracts for accurate expiration determination.

weltiq perspective: Option strategy backtests now have expiration selection logic that matches actual tradable timing, improving accuracy for 0DTE strategies and similar approaches.

Release Notes Excerpt

Count days to the last trading date in the chain pickers at(), closest_expiry(), select() and days_to_expiry count Saturday and holiday expiries on the previous trading day, matching the shared filters. Count expirations on their last trading date Equity options listed before February 2015 carry the OCC Saturday expiration date but stop trading on the Friday, and some weeklies are listed on holidays. ContractSecurityFilterUniverse.GetLastTradingDate feeds Expiration(), the option base moves non trading dates back to the previous open day, memoized per date, and the strategy pickers use the same date, so expiration(0, 0) selects a 0 DTE contract on its last trading day. Use OptionSymbol.GetLa…

Source: https://github.com/QuantConnect/Lean/releases/tag/18099