CTA引擎处理行情tick时,增加对异常数据的捕捉和过滤
This commit is contained in:
parent
a26cb7e09d
commit
08fc156595
@ -2,6 +2,6 @@
|
||||
"brokerID": "9999",
|
||||
"mdAddress": "tcp://180.168.146.187:10011",
|
||||
"tdAddress": "tcp://180.168.146.187:10001",
|
||||
"userID": "000300",
|
||||
"password": "19890624"
|
||||
"userID": "simnow申请",
|
||||
"password": "simnow申请"
|
||||
}
|
@ -254,10 +254,15 @@ class CtaEngine(object):
|
||||
|
||||
# 推送tick到对应的策略实例进行处理
|
||||
if tick.vtSymbol in self.tickStrategyDict:
|
||||
# 添加datetime字段
|
||||
if not tick.datetime:
|
||||
tick.datetime = datetime.strptime(' '.join([tick.date, tick.time]), '%Y%m%d %H:%M:%S.%f')
|
||||
|
||||
# tick时间可能出现异常数据,使用try...except实现捕捉和过滤
|
||||
try:
|
||||
# 添加datetime字段
|
||||
if not tick.datetime:
|
||||
tick.datetime = datetime.strptime(' '.join([tick.date, tick.time]), '%Y%m%d %H:%M:%S.%f')
|
||||
except ValueError:
|
||||
self.writeCtaLog(traceback.format_exc())
|
||||
return
|
||||
|
||||
# 逐个推送到策略实例中
|
||||
l = self.tickStrategyDict[tick.vtSymbol]
|
||||
for strategy in l:
|
||||
|
Loading…
Reference in New Issue
Block a user