From 440bd2812fadb10b830c76a92601c454594fa692 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 24 Oct 2017 10:52:02 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E5=A2=9E=E5=8A=A0=E5=AF=8C=E9=80=94?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=AE=A2=E9=98=85=E6=9C=AC=E6=97=A5=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=A7=94=E6=89=98=E6=8E=A8=E9=80=81=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trader/gateway/futuGateway/futuGateway.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/vnpy/trader/gateway/futuGateway/futuGateway.py b/vnpy/trader/gateway/futuGateway/futuGateway.py index 86318aab..26071d60 100644 --- a/vnpy/trader/gateway/futuGateway/futuGateway.py +++ b/vnpy/trader/gateway/futuGateway/futuGateway.py @@ -201,8 +201,8 @@ class FutuGateway(VtGateway): return RET_OK, content # 只有港股实盘交易才需要解锁 - if self.market == 'HK' and self.env == 0: - self.tradeCtx.unlock_trade(self.password) + if self.market == 'HK' and self.env == 0: + self.tradeCtx.unlock_trade(self.password) # 设置回调处理对象 self.tradeCtx.set_handler(OrderHandler()) @@ -231,7 +231,7 @@ class FutuGateway(VtGateway): code, data = self.tradeCtx.place_order(orderReq.price, orderReq.volume, orderReq.symbol, side, priceType, self.env, - orderpush=True, dealpush=True) + order_deal_push=True) if code: self.writeError(code, u'委托失败:%s' %data) @@ -303,7 +303,7 @@ class FutuGateway(VtGateway): #---------------------------------------------------------------------- def qryPosition(self): """查询持仓""" - code, data = self.tradeCtx.position_list_query(self.env) + code, data = self.tradeCtx.position_list_query(envtype=self.env) if code: self.writeError(code, u'查询持仓失败:%s' %data) @@ -329,13 +329,13 @@ class FutuGateway(VtGateway): #---------------------------------------------------------------------- def qryOrder(self): """查询委托""" - code, data = self.tradeCtx.order_list_query("", self.env) + code, data = self.tradeCtx.order_list_query("", envtype=self.env) if code: self.writeError(code, u'查询委托失败:%s' %data) return - self.processOrder(data) + self.processOrder(data, qry=True) self.writeLog(u'委托查询成功') #---------------------------------------------------------------------- @@ -453,7 +453,7 @@ class FutuGateway(VtGateway): self.onTick(tick) #---------------------------------------------------------------------- - def processOrder(self, data): + def processOrder(self, data, qry=False): """处理委托推送""" for ix, row in data.iterrows(): order = VtOrderData() @@ -475,6 +475,11 @@ class FutuGateway(VtGateway): order.status = statusMapReverse.get(str(row['status']), STATUS_UNKNOWN) order.direction = directionMapReverse[str(row['order_side'])] self.onOrder(order) + + if qry: + self.tradeCtx.subscribe_order_deal_push(row['orderid'], + order_deal_push=True, + envtype=self.env) #---------------------------------------------------------------------- def processDeal(self, data):