我正在尝试取消所有订单但收到此错误消息
openOrder id: 62 ES FUT @ GLOBEX : BUY STP 13.0 PreSubmitted orderStatus - orderid: 62 status: PreSubmitted 已完成 0.0 剩余 13.0 lastFillPrice 0.0
openOrder id: 63 ES FUT @ GLOBEX : BUY LMT 13.0 PreSubmitted orderStatus - orderid: 63 status: PreSubmitted 已完成 0.0 剩余 13.0 lastFillPrice 0.0
openOrder id: 61 ES FUT @ GLOBEX : SELL STP LMT 13.0 已提交 orderStatus - orderid: 61 status: 已提交已填充 0.0 剩余 13.0 lastFillPrice 0.0
错误 -1 2104 市场数据农场连接正常:usfuture
错误 -1 2106 HMDS 数据场连接正常:ushmds
错误 -1 2158 Sec-def 数据场连接正常:secdefil
错误 -1 322 处理请求时出错:-'bt':原因 - jextend.bt.l(bt.java:59)
EReader 线程中未处理的异常
回溯(最近一次通话最后):
class IBapi(EWrapper, EClient):
posns = []
fname = 'OpenPos.txt'
def __init__(self):
EClient.__init__(self, self)
def nextValidId(self, orderId: int):
super().nextValidId(orderId)
self.nextorderId = orderId
def orderStatus(self, orderId, status, filled, remaining, avgFullPrice, permId, parentId, lastFillPrice, clientId, whyHeld, mktCapPrice):
print('orderStatus - orderid:', orderId, 'status:', status, 'filled', filled, 'remaining', remaining, 'lastFillPrice', lastFillPrice)
def openOrder(self, orderId, contract, order, orderState):
print('openOrder id:', orderId, contract.symbol, contract.secType, '@', contract.exchange, ':', order.action, order.orderType, order.totalQuantity, orderState.status)
def execDetails(self, reqId, contract, execution):
print('Order Executed: ', reqId, contract.symbol, contract.secType, contract.currency, execution.execId, execution.orderId, execution.shares, execution.lastLiquidity)
def run_loop():
app.run()
app = IBapi()
app.connect('127.0.0.1', 7497, 123)
time.sleep(2)
app.nextorderId = None
api_thread = threading.Thread(target=run_loop, daemon=True)
api_thread.start()
app.reqGlobalCancel()
time.sleep(3)
done=True
time.sleep(1)
app.disconnect()