Merge pull request #1112 from nanoric/fix_ctpGateway_onRspQryInvestorPosition_KeyError_before_qryInstrument
[Fix] ctpGateway: 修正一个在查询持仓时,若未查询过该合约大小则出错的BUG
This commit is contained in:
commit
3790777475
@ -734,6 +734,8 @@ class CtpTdApi(TdApi):
|
|||||||
pos.ydPosition = data['Position'] - data['TodayPosition']
|
pos.ydPosition = data['Position'] - data['TodayPosition']
|
||||||
|
|
||||||
# 计算成本
|
# 计算成本
|
||||||
|
if pos.symbol not in self.symbolSizeDict:
|
||||||
|
return
|
||||||
size = self.symbolSizeDict[pos.symbol]
|
size = self.symbolSizeDict[pos.symbol]
|
||||||
cost = pos.price * pos.position * size
|
cost = pos.price * pos.position * size
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user