from tqsdk import TqApi, TqSim, TqBacktest, TqAuth import datetime api = TqApi(TqSim(), backtest=TqBacktest(start_dt=datetime.date(2019, 9, 20), end_dt=datetime.date(2020, 9, 1)),web_gui=True, auth=TqAuth("***", "***")) api.get_quote("DCE.m2009")
以上是代码(隐去了账户密码) 问题是从十月3号或4号某个时间开始的,之前一直正常。试过了大部分2020年9,10月份的合约都有类似问题 以下是报错
runfile('E:/TQ_final/problem.py', wdir='E:/TQ_final') 在使用天勤量化之前,默认您已经知晓并同意以下免责条款,如果不同意请立即停止使用:https://www.shinnytech.com/blog/disclaimer/ INFO - 您可以访问 http://127.0.0.1:50872 查看策略绘制出的 K 线图形。 Traceback (most recent call last): File "E:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-938996f8327a>", line 1, in <module> runfile('E:/TQ_final/problem.py', wdir='E:/TQ_final') File "E:\PyCharm Community Edition 2019.2.2\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "E:\PyCharm Community Edition 2019.2.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:/TQ_final/problem.py", line 5, in <module> api.get_quote("DCE.m2009") File "E:\Anaconda3\lib\site-packages\tqsdk\api.py", line 378, in get_quote self._ensure_symbol(symbol) File "E:\Anaconda3\lib\site-packages\tqsdk\api.py", line 407, in _ensure_symbol if not self.wait_update(deadline=deadline): File "E:\Anaconda3\lib\site-packages\tqsdk\api.py", line 1219, in wait_update self._run_once() File "E:\Anaconda3\lib\site-packages\tqsdk\api.py", line 2203, in _run_once raise self._exceptions.pop(0) File "E:\Anaconda3\lib\site-packages\tqsdk\api.py", line 1883, in _md_handler raise Exception(f"查询合约服务报错 {query_result['error']}") Exception: 查询合约服务报错 failed to execute graphql operation, errors: [instrumentId: DCE.m2009 dose not exist]
ringo 已回答的问题 2020年10月14日