I got the same issue on when my bot traded on 0DTE SPX on 20250108 (i.e. fire an option trade every morning that expires at day-end), and my bot could not trade on that day because IB had set both the expiry and last trade day to 20250109 (instead of 20250108) in the relevant contract spec. I then simply skip trading for that day and restart trading on 10 Jan, and things went normally, believing that such extra holiday would not happen too frequently.
?
However, yesterday (20250117), my bot got similar (not the same) as the above error. When I define an option contract by :
leg1 = Option('SPX', '20250117', 6035, 'C', 'SMART', currency='USD', multiplier=100, tradingClass='SPXW')
?
The contents of the above leg1 AFTER passing to ib.qualifyContracts() was (I used to print the leg1 contents for error tracing purpose) :
Option(conId=736830804, symbol='SPX', lastTradeDateOrContractMonth='20250118', strike=6035.0, right='C', multiplier='100', exchange='SMART', currency='USD', localSymbol='SPXW ?250117C06035000', tradingClass='SPXW')
?
As you can see, the returned lastTradeDateOrContractMonth became '20250118'.? Any idea why there is a discrepancy in the expiry date? and how to fix it ?
?
Thanks a million in advance