vn.py官网
开源量化社区
Member
avatar
加入于:
帖子: 33
声望: 1

升级到了2.6版本,设置是这样的。

description

启动策略的时候,要用历史数据,触发异常,报错如下:


[Test] 触发异常已停止

Traceback (most recent call last):

File "C:\vnstudio\lib\site-packages\vnpy_ctastrategy\engine.py", line 622, in call_strategy_func
func()
File "C:\Users\Bo\strategies\Apollo_Viscount_15min_OrderControl.py", line 87, in on_init
self.load_bar(10)
File "C:\vnstudio\lib\site-packages\vnpy_ctastrategy\template.py", line 306, in load_bar
use_database
File "C:\vnstudio\lib\site-packages\vnpy_ctastrategy\engine.py", line 577, in load_bar
bars = self.query_bar_from_datafeed(symbol, exchange, interval, start, end)
File "C:\vnstudio\lib\site-packages\vnpy_ctastrategy\engine.py", line 151, in query_bar_from_datafeed
data = self.datafeed.query_history(req)

AttributeError: 'RqdataDatafeed' object has no attribute 'query_history'

Super Moderator
avatar
加入于:
帖子: 39
声望: 2

是下载数据时报错,还是跑策略时报错?

Member
avatar
加入于:
帖子: 33
声望: 1

RQ小助手 wrote:

是下载数据时报错,还是跑策略时报错?

跑策略的时候

Member
avatar
加入于:
帖子: 3164
声望: 185

可以pip install --upgrade vnpy_ctastrategy试试

Member
avatar
加入于:
帖子: 33
声望: 1

xiaohe wrote:

可以pip install --upgrade vnpy_ctastrategy试试

谢谢,按照这个方法已解决

Member
avatar
加入于:
帖子: 3
声望: 0

08:35:21 初始化CTA回测引擎
08:35:21 策略文件加载完成
08:35:24 ----------------------------------------
08:35:24 MA201.CZCE-1m开始下载历史数据
08:35:24 数据下载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio26\lib\site-packages\vnpy_ctabacktester\engine.py", line 404, in run_downloading
data = self.datafeed.query_bar_history(req)
File "c:\vnstudio26\lib\site-packages\vnpy_rqdata\rqdata_datafeed.py", line 164, in query_bar_history
adjust_type="none"
File "c:\vnstudio26\lib\site-packages\rqdatac\decorators.py", line 150, in wrap
return func(args, **kwargs)
File "c:\vnstudio26\lib\site-packages\rqdatac\services\get_price.py", line 103, in get_price
order_book_ids, market
File "c:\vnstudio26\lib\site-packages\rqdatac\services\get_price.py", line 222, in classify_order_book_ids
ins_list = ensure_instruments(order_book_ids, market=market)
File "c:\vnstudio26\lib\site-packages\rqdatac\validators.py", line 168, in ensure_instruments
all_instruments = _all_instruments_dict(market)
File "c:\vnstudio26\lib\site-packages\rqdatac\decorators.py", line 129, in wrapper
value = user_function(
args, kwargs)
File "c:\vnstudio26\lib\site-packages\rqdatac\services\basic.py", line 139, in _all_instruments_dict
ins = _all_cached_instruments_list(market)
File "c:\vnstudio26\lib\site-packages\rqdatac\decorators.py", line 129, in wrapper
value = user_function(*args,
kwargs)
File "c:\vnstudio26\lib\site-packages\rqdatac\services\basic.py", line 134, in _all_cached_instruments_list
return _all_instruments_list(market)
File "c:\vnstudio26\lib\site-packages\rqdatac\services\basic.py", line 112, in _all_instruments_list
ins = [Instrument(i) for i in get_client().execute("all_instruments", market=market)]
File "c:\vnstudio26\lib\site-packages\rqdatac\client.py", line 31, in execute
raise RuntimeError("rqdatac is not initialized")
RuntimeError: rqdatac is not initialized

Member
avatar
加入于:
帖子: 3
声望: 0

最开始提升 rqdatac not install

pip install rqdatac 然后:
pip install --upgrade vnpy_ctastrategy 也升级了,还是报错。

Member
avatar
加入于:
帖子: 298
声望: 73

hill-陆 wrote:

最开始提升 rqdatac not install

pip install rqdatac 然后:
pip install --upgrade vnpy_ctastrategy 也升级了,还是报错。

看看这个:
https://www.vnpy.com/forum/topic/7712-sheng-ji-dao-2-6ban-ben-hou-hui-ce-xia-zai-shu-ju-shi-yu-dao-xia-mian-de-cuo-wu-:

Member
avatar
加入于:
帖子: 3
声望: 0

感谢大神的分享~

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

沪公网安备 31011502017034号