1、添加策略至\vnstudio\Lib\site-packages\vnpy\app\cta_strategy\
2、进行cta回测,出现错误
3、删除策略
4、重启vnstation,
5、还是出现错误log
6、输出的log如下:
15:16:33 初始化CTA回测引擎
15:16:33 策略文件strategies.atr_demo_1加载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 110, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Andy\strategies\atr_demo_1.py", line 7, in <module>
class AtrThreeDemo(CtaTemplate):
File "C:\Users\Andy\strategies\atr_demo_1.py", line 43, in AtrThreeDemo
def init__(self, cta_engine: Any, strategy_name: str, vt_symbol: str, setting: dict):
NameError: name 'Any' is not defined
15:16:33 策略文件加载完成
15:16:33 RQData数据接口初始化成功