策略初始化时运行load_tick,加载我自己储存的数据,该数据中tick的datetime是字符串格式,我用pd.to_datetime转化成datetime对象,那么此时tzinfo应该是None,也就是offset-naive,但是策略初始化时报错
test_strat: 触发异常已停止
Traceback (most recent call last):
File "g:\vnpy\vnstudio\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 664, in call_strategy_func
func(params)
File "g:\vnpy\vnstudio\lib\site-packages\vnpy\app\cta_strategy\strategies\mixed_signal_strategy.py", line 76, in on_tick
self.bg.update_tick(tick)
File "g:\vnpy\vnstudio\lib\site-packages\vnpy\trader\utility.py", line 214, in update_tick
if self.last_tick and tick.datetime < self.last_tick.datetime:
File "pandas/_libs/tslibs/c_timestamp.pyx", line 78, in pandas._libs.tslibs.c_timestamp._Timestamp.richcmp
TypeError: can't compare offset-naive and offset-aware datetimes
这个是因为vnpy里面的tick的datetime是默认offset-aware的吗,还是因为从CTP接收的tick的datetime是offset-aware的...