[Mod]实现委托转换类型的加载判断

This commit is contained in:
vn.py 2017-09-20 15:48:18 +08:00
parent 7822d4ae27
commit a17c1d6e58
4 changed files with 55 additions and 88 deletions

File diff suppressed because one or more lines are too long

View File

@ -12,5 +12,7 @@
"logActive": true,
"logLevel": "debug",
"logConsole": true,
"logFile": true
"logFile": true,
"tdPenalty": ["IF", "IH", "IC"]
}

View File

@ -12,5 +12,7 @@
"logActive": true,
"logLevel": "debug",
"logConsole": true,
"logFile": true
"logFile": true,
"tdPenalty": ["IF", "IH", "IC"]
}

View File

@ -354,8 +354,9 @@ class DataEngine(object):
# 保存活动委托数据的字典(即可撤销)
self.workingOrderDict = {}
# 持仓细节字典, vtSymbol:PositionDetail
self.detailDict = {}
# 持仓细节相关
self.detailDict = {} # vtSymbol:PositionDetail
self.tdPenaltyList = globalSetting['tdPenalty'] # 平今手续费惩罚的产品代码列表
# 读取保存在硬盘的合约数据
self.loadContracts()
@ -466,6 +467,16 @@ class DataEngine(object):
detail = PositionDetail(vtSymbol)
self.detailDict[vtSymbol] = detail
# 设置持仓细节的委托转换模式
contract = self.getContract(vtSymbol)
if contract and 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
return detail
#----------------------------------------------------------------------