Closed kadnan closed 1 year ago
I found the reason: valid_option_contract_details.append(details)
should be: valid_option_contract_details.append(option_contract)
But then it gave another error which I better ask here:
Ambiguous contract: Option(symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='PUT'), possibles are [Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='SMART', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='AMEX', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='CBOE', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='PHLX', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='PSE', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='ISE', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='BOX', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='BATS', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='NASDAQOM', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='CBOE2', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='NASDAQBX', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='MIAX', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='GEMINI', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='EDGX', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='MERCURY', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='PEARL', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='EMERALD', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA'), Contract(secType='OPT', conId=611049133, symbol='TSLA', lastTradeDateOrContractMonth='20230310', strike=15.0, right='P', multiplier='100', exchange='IBUSOPT', currency='USD', localSymbol='TSLA 230310P00015000', tradingClass='TSLA')]
Hi @kadnan the method 'ib.qualifyContracts' take the contracts as input. and This will fill in the missing fields in the contract, especially the conId. But sometimes the contacts can be Ambiguous. So while creating the option_contract = Option('TSLA',lastTradeDateOrContractMonth=expiration,strike=strike,right='PUT') I would suggest you also specify more details about the contract. (I think giving exchange = 'SMART' will do the trick in this case.)
I am calling
qualifyContracts
on the list ofOptions
object and it is giving an error:Below is my code:
Ib sync Version: 0.9.81