VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 9
声望: 0

我的CTA 策略有个 tick时间管理模块,加载在temple.py,部分代码如下:

----------------------------------------------------------------------

def __init__(self, size=10):
    """Constructor"""
    self.count = 0  # 缓存计数
    self.size = size  # 缓存大小
    self.inited = False  # True if count>=size

    self.TicklastPriceArray = np.zeros(self.size)
    self.TickaskVolume1Array = np.zeros(self.size)
    self.TickbidVolume1Array = np.zeros(self.size)
    self.TickaskPrice1Array = np.zeros(self.size)
    self.TickbidPrice1Array = np.zeros(self.size)
    self.TickopenInterestArray = np.zeros(self.size)
    self.TickvolumeArray = np.zeros(self.size)

最后加载CTA策略显示:

Traceback (most recent call last):
File "c:\vnstudio\vnpy\lib\site-packages\vnpy\app\cta_strategy\ui\widget.py", line 149, in add_strategy
class_name, strategy_name, vt_symbol, setting
File "c:\vnstudio\vnpy\lib\site-packages\vnpy\app\cta_strategy\engine.py", line 611, in add_strategy
strategy = strategy_class(self, strategy_name, vt_symbol, setting)
File "c:\vnstudio\vnpy\lib\site-packages\vnpy\app\cta_strategy\strategies\AAAAA.py", line 75, in init
self.Tick_arry=TickArrayManager(self.P)
File "c:\vnstudio\vnpy\lib\site-packages\vnpy\app\cta_strategy\template.py", line 442, in init
NameError: name 'np' is not defined

无论我在主策略.py或者temple.py 中加入 import numpy as np,都会报错,急急急

Administrator
avatar
加入于:
帖子: 4502
声望: 322
c:\vnstudio\vnpy\lib\site-packages\vnpy\app\cta_strategy\template.py

这个文件里,文件头部漏了import numpy as np

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】