Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Ambiguous Contract on qualifyContracts for SPXW Option
Interesting observation. Would love to have your opinions.?
?
I have been using this script to validate the option contracts using `qualifyContracts`. Today, I am getting ambiguous contracts error for this Option Contract. I know about few days when monthly and weekly expiries coincide. But, this is a different case. Both of the possible contracts suggested are SPXW trading class and the only difference is in the contract ID. Is it possible somehow that this has some relation with AM vs PM settlement? I am noticing this for first time.
?
?
?
Regards,
Pratik ?
? |
This is because IB screwed something up and marked the AM expiration as SPXW instead of SPX. Today was the first time I have ever seen this. IB support told me they were aware of the issue and were working on it. Not sure if they resolved it today or not? On Wed, Jan 8, 2025, 2:59?PM Pratik Babhulkar via <praditik=[email protected]> wrote:
|
Yeah this is one of those edge cases that we all dread... My bot had the same issue and could not run.
?
Notice the localSymbol code allows you to break the ambiguity: one is for today, the other for tomorrow, but I don't think it can be traded since the market will be closed, so your only choice is today. |
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 |
to navigate to use esc to dismiss