diff --git a/vnpy/trader/vtEngine.py b/vnpy/trader/vtEngine.py index 34c92479..1e1dffc1 100644 --- a/vnpy/trader/vtEngine.py +++ b/vnpy/trader/vtEngine.py @@ -470,13 +470,16 @@ class DataEngine(object): # 设置持仓细节的委托转换模式 contract = self.getContract(vtSymbol) - if contract and contract.exchange is EXCHANGE_SHFE: - detail.mode = detail.MODE_SHFE + if contract: + # 上期所合约 + if contract.exchange is EXCHANGE_SHFE: + detail.mode = detail.MODE_SHFE + + # 检查是否有平今惩罚 + for productID in self.tdPenaltyList: + if str(productID) in contract.symbol: + detail.mode = detail.MODE_TDPENALTY - for productID in self.tdPenaltyList: - if str(productID) in contract.symbol: - detail.mode = detail.MODE_TDPENALTY - return detail #----------------------------------------------------------------------