Option Exercise Consistency
Expected Behavior
Options are exercised with the same underlying price whether we subscribe to extended hours or not.
Actual Behavior
The exercised price is different.
Potential Solution
Do not use prices outside the market hours.
Reproducing the Problem
backtest_1401e01, use extended_market_hours=False for different results.
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
Thanks Alex! This is a significant issue, please fix it asap.
The option is getting exercised when it's delisted, BacktestingBrokerage->OptionNotificationEventArgs->BTH->HandleOptionNotification. There are a couple of side effects I can see, (A) OptionPortfolioModel if SettlementType.Cash it's using the underlying.Close to calculate cash & DefaultExerciseModel using underlying.Close to determine if ITM or not
Could use https://github.com/QuantConnect/Lean/issues/1608 Maybe
Security.cs
/// <summary>
///
/// </summary>
public virtual Session Session => Cache.Session;
SecurityCache.cs
/// <summary>
///
/// </summary>
public Session Session { get; private set; }
- handles the updates
class Session : IBar
Volume