From d43969ca1d1e3f9b263dc8f3ed479526d737fd30 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 23 Jul 2018 22:16:44 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86futuGa?= =?UTF-8?q?teway=E7=9A=84=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/gateway/futuGateway/futuGateway.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vnpy/trader/gateway/futuGateway/futuGateway.py b/vnpy/trader/gateway/futuGateway/futuGateway.py index 85491b2a..bb7eb19c 100644 --- a/vnpy/trader/gateway/futuGateway/futuGateway.py +++ b/vnpy/trader/gateway/futuGateway/futuGateway.py @@ -67,13 +67,13 @@ class FutuGateway(VtGateway): self.ip = 0 self.market = '' self.password = '' - self.env = 1 # 默认仿真交易 + self.env = TrdEnv.SIMULATE # 默认仿真交易 self.fileName = self.gatewayName + '_connect.json' self.filePath = getJsonPath(self.fileName, __file__) self.tickDict = {} - self.tradeSet = set() # 保存成交编号的集合,防止重复推送 + self.tradeSet = set() # 保存成交编号的集合,防止重复推送 self.qryEnabled = True self.qryThread = Thread(target=self.qryData) @@ -283,7 +283,7 @@ class FutuGateway(VtGateway): contract.name = row['name'] contract.productClass = vtProductClass contract.size = int(row['lot_size']) - contract.priceTick = 0.01 + contract.priceTick = 0.001 self.onContract(contract) @@ -328,10 +328,10 @@ class FutuGateway(VtGateway): pos.direction = DIRECTION_LONG pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction]) - pos.position = int(row['qty']) + pos.position = float(row['qty']) pos.price = float(row['cost_price']) pos.positionProfit = float(row['pl_val']) - pos.frozen = int(row['qty']) - int(row['can_sell_qty']) + pos.frozen = float(row['qty']) - float(row['can_sell_qty']) if pos.price < 0: pos.price = 0 if pos.positionProfit > 100000000: pos.positionProfit = 0 @@ -491,8 +491,8 @@ class FutuGateway(VtGateway): order.vtOrderID = '.'.join([self.gatewayName, order.orderID]) order.price = float(row['price']) - order.totalVolume = int(row['qty']) - order.tradedVolume = int(row['dealt_qty']) + order.totalVolume = float(row['qty']) + order.tradedVolume = float(row['dealt_qty']) order.orderTime = row['create_time'].split(' ')[-1] order.status = statusMapReverse.get(row['order_status'], STATUS_UNKNOWN)