问题描述
嗨,我正在尝试使用 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 进行了更改,似乎已经解决了问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)