参考的接口文档是:
XtQuant.XtData 行情模块.md
数据字典_行业数据.md
文档中关于相关接口的原文大意如下:
download_history_contracts():下载过期(退市)合约信息
- 过期(退市)标的列表可以通过
get_stock_list_in_sector 获取
- 过期板块名称可以通过:
print([i for i in xtdata.get_sector_list() if "过期" in i])
查看
我们按文档原示例做了测试,步骤如下:
from xtquant import xtdata
xtdata.connect()
print("开始 download_history_contracts...")
xtdata.download_history_contracts()
print("完成")
expired = [i for i in xtdata.get_sector_list() if "过期" in i]
print(f"含'过期'字样板块数:{len(expired)}")
print(expired[:10])
实际结果是:
- xtdata.connect() 正常
- xtdata.download_history_contracts() 能正常返回
- 但执行完后:
expired = [i for i in xtdata.get_sector_list() if "过期" in i]
返回结果仍然是 []
也就是说:
- download_history_contracts() 已完成
- 但 get_sector_list() 中并没有出现文档示例所说的包含“过期”字样的板块名称
- 如果当前版本不再通过“过期”板块暴露,是否有新的标准方式获取退市/过期标的列表?
补充说明:
- get_sector_list() 本身是可正常返回的,当前返回数量为 851
- 只是其中没有任何包含“过期”字样的分组名称
|