Im using ib_insync (python) API to create a straddle order, it works previously but has failed since yesterday, giving this error. i dont understand this error as BAG is a valid contract request
Has anyone else come across a similar issue and how did you solve it?
Error 321, reqId 587: Error validating request.-'bV' : cause - 'BAG' isn't supported for contract data request. Please enter a valid security type, contract: Contract(secType='BAG', symbol='bkng', exchange='SMART', currency='USD', comboLegs=[ComboLeg(conId=681941486, ratio=1, action='SELL', exchange='SMART', openClose=0, shortSaleSlot=0, designatedLocation='', exemptCode=-1), ComboLeg(conId=681941216, ratio=1, action='BUY', exchange='SMART', openClose=0, shortSaleSlot=0, designatedLocation='', exemptCode=-1)])
Unknown contract: Contract(secType='BAG', symbol='bkng', exchange='SMART', currency='USD', comboLegs=[ComboLeg(conId=681941486, ratio=1, action='SELL', exchange='SMART', openClose=0, shortSaleSlot=0, designatedLocation='', exemptCode=-1), ComboLeg(conId=681941216, ratio=1, action='BUY', exchange='SMART', openClose=0, shortSaleSlot=0, designatedLocation='', exemptCode=-1)])
This is the code
symbol = "TSLA"
strike = '192.5'
expiry = '20240223'
call_contract = Option(symbol=symbol, lastTradeDateOrContractMonth=expiry, strike=strike,right="C",exchange="SMART",currency="USD")
put_contract = Option(symbol=symbol, lastTradeDateOrContractMonth=expiry, strike=strike,right="P",exchange="SMART",currency="USD")
underlying_contract = Stock(symbol=symbol,exchange="SMART",currency="USD")
ib.qualifyContracts(call_contract, put_contract, underlying_contract)
# Create a straddle contract
contract = Contract()
contract.symbol = symbol
contract.secType = "BAG"
contract.currency = "USD"
#contract.strike =
contract.exchange = "SMART"
leg1 = ComboLeg()
leg1.conId = call_contract.conId
leg1.ratio = 1
leg1.action = "BUY" # Change to BUY
leg1.exchange = "SMART"
leg2 = ComboLeg()
leg2.conId = put_contract.conId
leg2.ratio = 1
leg2.action = "BUY" # Change to BUY
leg2.exchange = "SMART"
contract.comboLegs = []
contract.comboLegs.append(leg1)
contract.comboLegs.append(leg2)
# Qualify the straddle contract
ib.qualifyContracts(contract)
# Place a straddle order
order = LimitOrder("BUY", 10, 10, tif="DAY") # algos only DAY
trade = ib.placeOrder(contract, order)