[Mod]修改DataRecording功能对于Tick时间戳的处理,兼容某些行情源Tick时间戳没有毫秒的情况

This commit is contained in:
vn.py 2018-07-23 17:55:36 +08:00
parent 384eb71b28
commit 81ad791747

View File

@ -175,7 +175,10 @@ class DrEngine(object):
# 生成datetime对象 # 生成datetime对象
if not tick.datetime: if not tick.datetime:
tick.datetime = datetime.strptime(' '.join([tick.date, tick.time]), '%Y%m%d %H:%M:%S.%f') if '.' in tick.time:
tick.datetime = datetime.strptime(' '.join([tick.date, tick.time]), '%Y%m%d %H:%M:%S.%f')
else:
tick.datetime = datetime.strptime(' '.join([tick.date, tick.time]), '%Y%m%d %H:%M:%S')
self.onTick(tick) self.onTick(tick)