bug fix
This commit is contained in:
parent
37e31c34dd
commit
99f2de2161
@ -796,7 +796,8 @@ class CtpTdApi(TdApi):
|
||||
# 计算持仓均价
|
||||
if pos.position and pos.symbol in self.symbolSizeDict:
|
||||
size = self.symbolSizeDict[pos.symbol]
|
||||
pos.price = (cost + data['PositionCost']) / (pos.position * size)
|
||||
if size > 0 and pos.position > 0:
|
||||
pos.price = (cost + data['PositionCost']) / abs(pos.position * size)
|
||||
|
||||
# 读取冻结
|
||||
if pos.direction is DIRECTION_LONG:
|
||||
|
Loading…
Reference in New Issue
Block a user