Hi,
I am experiencing problems sending comboLeg orders. Specifically, I get the following error message:
"Rejected - Invalid value in field # 6079"
This message is displayed in the TWS as a pop-up window (not in Python).
I tried to send the comboLeg order using the following code:
1. Get contract IDs
m_contract_object1 = IBcontract()
m_contract_object1.secType = 'STK'
m_contract_object1.symbol = 'EWA'
m_contract_object1.currency = 'USD'
m_contract_object1.exchange = 'SMART'
m_contract_object2 = IBcontract()
m_contract_object2.secType = 'STK'
m_contract_object2.symbol = 'EWC'
m_contract_object2.currency = 'USD'
m_contract_object2.exchange = 'SMART'
cdetails1 = client.get_contract_details(m_contract_object1)
cdetails2 = client.get_contract_details(m_contract_object2)
print cdetails1['conId'] # returns 2586606
print cdetails2['conId'] # returns 2586548
2. Create ComboLegs
leg1 = ComboLeg()
leg2 = ComboLeg()
leg1.conId = cdetails1['conId']
leg1.ratio = 1
leg1.action = 'BUY'
leg1.exchange = 'SMART'
leg1.openClose = 0
leg1.shortSaleSlot = 0
leg1.designatedLocation = ""
leg2.conId = cdetails2['conId']
leg2.ratio = 1
leg2.action = 'SELL'
leg2.exchange = 'SMART'
leg2.openClose = 0
leg2.shortSaleSlot = 0
leg2.designatedLocation = ""
3. Create new contract and order
contract = IBcontract()
contract.secType = 'BAG'
contract.symbol = 'EWA'
contract.currency = 'USD'
contract.exchange = 'SMART'
contract.comboLegs = ComboLegList([leg1, leg2])
order = IBOrder()
order.action = 'BUY'
order.totalQuantity = 1
order.orderType = 'MKT'
order.lmtPrice = 1
client.place_order(contract,order)
Hi,
I am experiencing problems sending comboLeg orders. Specifically, I get the following error message:
"Rejected - Invalid value in field # 6079"
This message is displayed in the TWS as a pop-up window (not in Python).
I tried to send the comboLeg order using the following code:
1. Get contract IDs
m_contract_object1 = IBcontract()
m_contract_object1.secType = 'STK'
m_contract_object1.symbol = 'EWA'
m_contract_object1.currency = 'USD'
m_contract_object1.exchange = 'SMART'
m_contract_object2 = IBcontract()
m_contract_object2.secType = 'STK'
m_contract_object2.symbol = 'EWC'
m_contract_object2.currency = 'USD'
m_contract_object2.exchange = 'SMART'
cdetails1 = client.get_contract_details(m_contract_object1)
cdetails2 = client.get_contract_details(m_contract_object2)
print cdetails1['conId'] # returns 2586606
print cdetails2['conId'] # returns 2586548
2. Create ComboLegs
leg1 = ComboLeg()
leg2 = ComboLeg()
leg1.conId = cdetails1['conId']
leg1.ratio = 1
leg1.action = 'BUY'
leg1.exchange = 'SMART'
leg1.openClose = 0
leg1.shortSaleSlot = 0
leg1.designatedLocation = ""
leg2.conId = cdetails2['conId']
leg2.ratio = 1
leg2.action = 'SELL'
leg2.exchange = 'SMART'
leg2.openClose = 0
leg2.shortSaleSlot = 0
leg2.designatedLocation = ""
3. Create new contract and order
contract = IBcontract()
contract.secType = 'BAG'
contract.symbol = 'EWA'
contract.currency = 'USD'
contract.exchange = 'SMART'
contract.comboLegs = ComboLegList([leg1, leg2])
order = IBOrder()
order.action = 'BUY'
order.totalQuantity = 1
order.orderType = 'MKT'
order.lmtPrice = 1
client.place_order(contract,order)