From e2b1da9e3a4dcf50fe92d86b833b5615113f2a37 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 9 Oct 2017 10:00:08 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=E4=BF=AE=E5=A4=8D=E6=8C=81=E4=BB=93?= =?UTF-8?q?=E5=9D=87=E4=BB=B7=E8=AE=A1=E7=AE=97=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/gateway/ctpGateway/ctpGateway.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnpy/trader/gateway/ctpGateway/ctpGateway.py b/vnpy/trader/gateway/ctpGateway/ctpGateway.py index cd5ad269..67240c04 100644 --- a/vnpy/trader/gateway/ctpGateway/ctpGateway.py +++ b/vnpy/trader/gateway/ctpGateway/ctpGateway.py @@ -701,15 +701,15 @@ class CtpTdApi(TdApi): pos.ydPosition = data['Position'] # 计算成本 - cost = pos.price * pos.position + size = self.symbolSizeDict[pos.symbol] + cost = pos.price * pos.position * size # 汇总总仓 pos.position += data['Position'] pos.positionProfit += data['PositionProfit'] # 计算持仓均价 - if pos.position and pos.symbol in self.symbolSizeDict: - size = self.symbolSizeDict[pos.symbol] + if pos.position and pos.symbol in self.symbolSizeDict: pos.price = (cost + data['PositionCost']) / (pos.position * size) # 读取冻结