0

嗨,我正在尝试使用 IB Native API 下组合订单,但它一直被弹出窗口拒绝:

弹出

错误消息是“拒绝 - 字段 #6079 中的值无效”。我不知道#6079 是哪个字段。

我的代码看起来像这样(之前存储了 conid):

contract = Contract()
contract.symbol = "DJX"
contract.secType = "BAG"
contract.currency = "USD"
contract.exchange = "SMART"

leg1 = ComboLeg()
leg1.conId = 492705004
leg1.ratio = 1
leg1.action = "BUY"
leg1.exchange = "SMART"
leg1.openClose = 0
leg1.designatedLocation = ""

leg2 = ComboLeg()
leg2.conId = 492705004
leg2.ratio = 1
leg2.action = "SELL"
leg2.exchange = "SMART"
leg2.openClose = 0
leg2.designatedLocation = ""

contract.comboLegs = []
contract.comboLegs.append(leg1)
contract.comboLegs.append(leg2)
    
order = Order()
order.account = acc
order.action = "BUY"
order.orderType = "LMT"
order.totalQuantity = 1
order.orderComboLegs = []
legPrices = [340, 39]
for price in legPrices:
    comboLeg = OrderComboLeg()
    comboLeg.price = price
    order.orderComboLegs.append(comboLeg)

order.smartComboRoutingParams = []
order.smartComboRoutingParams.append(TagValue("NonGuaranteed", "1"))

app.placeOrder(this_id, contract=contract, order=order)

有人能帮我吗?

谢谢

编辑:我认为当 conid 相同时会出现此错误,我已经更改了不同的 conid,它似乎已经解决了问题。

4

0 回答 0