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

22:42:30 rb.SHFE-1m开始下载历史数据
22:42:34 数据下载失败,触发异常:
Traceback (most recent call last):
File "C:\veighna_studio\lib\site-packages\vnpy_ctabacktester\engine.py", line 422, in run_downloading
data: List[BarData] = self.datafeed.query_bar_history(req, self.write_log)
File "C:\veighna_studio\lib\site-packages\vnpy_tqsdk\tqsdk_datafeed.py", line 49, in query_bar_history
df: DataFrame = api.get_kline_data_series(
File "C:\veighna_studio\lib\site-packages\tqsdk\api.py", line 892, in get_kline_data_series
return self._get_data_series("get_kline_data_series", symbol, duration_seconds, start_dt, end_dt, adj_type)
File "C:\veighna_studio\lib\site-packages\tqsdk\api.py", line 970, in _get_data_series
self._ensure_symbol(symbol_list) # 检查合约代码是否存在
File "C:\veighna_studio\lib\site-packages\tqsdk\api.py", line 505, in _ensure_symbol
if not self.wait_update(deadline=deadline, _task=task):
File "C:\veighna_studio\lib\site-packages\tqsdk\api.py", line 1905, in wait_update
self._run_until_task_done(task=update_task, deadline=deadline)
File "C:\veighna_studio\lib\site-packages\tqsdk\baseApi.py", line 88, in _run_until_task_done
self._run_once()
File "C:\veighna_studio\lib\site-packages\tqsdk\baseApi.py", line 57, in _run_once
raise self._exceptions.pop(0)
File "C:\veighna_studio\lib\site-packages\tqsdk\symbols.py", line 41, in _run
raise Exception(f"查询合约服务报错 {query_result['error']}")
Exception: 查询合约服务报错 failed to execute graphql operation, errors: [variable instrument_id: [SHFE.rb] contains non-existent instrument: SHFE.rb]

Member
avatar
加入于:
帖子: 42
声望: 5

一般合约代码是rb后还有数字的,例如螺纹钢指数连续合约数据是rb99.SHFE,或者具体到某个合约rb2406.SHFE。
数据相关的规则可以参考米筐的官方文档: https://www.ricequant.com/doc/rqdata/python/futures-mod.html#%E6%9C%9F%E8%B4%A7%E8%A1%8C%E6%83%85%E6%95%B0%E6%8D%AE%E8%AF%B4%E6%98%8E
回测填写可以参考使用文档下载数据部分: https://www.vnpy.com/docs/cn/community/app/cta_backtester.html

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

沪公网安备 31011502017034号

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