返回列表 发布新帖

XTquant中xtdata获取数据运行错误

1228 1
发表于 2024-5-8 10:01:30 | 显示全部楼层 阅读模式
使用xtdata获取数据时报错id:200003,timeout;券商版的miniqmt已经登录了啊。
报错如下:

Traceback (most recent call last):
  File "G:\Desktop\A.PY", line 18, in <module>
    kline_data = xtdata.get_market_data_ex([],code_list,period=period)
  File "G:\Desktop\xtquant\xtdata.py", line 456, in get_market_data_ex
    return _get_market_data_ex_ori_221207(field_list, stock_list, period, start_time, end_time, count, dividend_type, fill_data)
  File "G:\Desktop\xtquant\xtdata.py", line 514, in _get_market_data_ex_ori_221207
    ret = client.get_market_data3(field_list, stock_list, period, start_time, end_time, count, dividend_type, fill_data, 'v4', enable_read_from_local,
RuntimeError: func:requestFromCache, error:{ "ErrorID" : 200003, "ErrorMsg" : "timeout" }

代码如下:

from xtquant import xtdata
import time

# 设定一个标的列表
code_list = ["000001.SZ"]
print(1)
# 设定获取数据的周期
period = "1d"
print(2)
# 向服务器订阅数据
for i in code_list:
    xtdata.subscribe_quote(i,period=period,count=-1) # 设置count = -1来取到当天所有实时行情
print(3)
# 等待订阅完成
time.sleep(1)
print(4)
# 获取订阅后的行情
kline_data = xtdata.get_market_data_ex([],code_list,period=period)
print(5)
print(kline_data)


image.png

评论1

心如止水
发表于 2024-5-8 18:36:21 | 显示全部楼层
先去数据字典里面下载最新的xtquant包试试:

玩转qmt,上迅投qmt知识库
https://dict.thinktrader.net/dic ... A-xtquant-%E5%8C%85

回复

您需要登录后才可以回帖 登录 | 立即注册

客服专线

400-080-8112

用思考的速度交易,用真诚的态度合作,我们是认真的!
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2025 迅投QMT社区 版权所有 All Rights Reserved. 蜀ICP备19002686号-2
关灯 快速发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表