qmt编程之获取期货数据
qmt更加详细的教程方法,会持续慢慢梳理。
也可找寻博主的历史文章,搜索关键词查看解决方案 !
感谢关注,咨询免费开通量化回测与获取实盘权限,欢迎和博主联系!
期货席位
提示
1.该数据通过get_market_data
和get_market_data_ex
接口获取
2.获取数据前需要先用download_history_data
下载历史数据
3.VIP数据
参数
period
参数传入futureholderrank
返回值
- 返回dict { field1 : value1, field2 : value2, ... }
- value1, value2, ... :pd.DataFrame 数据集,index为stock_list,columns为time_list
示例
from xtquant import xtdata
# 下载期货席位
xtdata.download_history_data('','futureholderrank','','')
#查询螺纹钢席位数据,period参数填写'futureholderrank'
print(xtdata.get_market_data_ex([],['rb2401.SF'],period='futureholderrank')['rb2401.SF'])
返回值
{'rb2401.SF': time tradingVolumeRank \
20230406 1680710400000 [{'4': '国泰君安', '5': 2400, '6': 382}, {'4': '东证...
20230407 1680796800000 [{'4': '中信期货', '5': 2847, '6': 2079}, {'4': '东...
20230410 1681056000000 [{'4': '中泰期货', '5': 4791, '6': 4239}, {'4': '东...
20230411 1681142400000 [{'4': '东证期货', '5': 4925, '6': 1081}, {'4': '中...
20230412 1681228800000 [{'4': '华泰期货', '5': 6743, '6': 5298}, {'4': '浙...
... ... ...
20230922 1695312000000 [{'4': '东证期货', '5': 363143, '6': -235457}, {'4...
20230925 1695571200000 [{'4': '东证期货', '5': 470528, '6': 107385}, {'4'...
20230926 1695657600000 [{'4': '东证期货', '5': 427734, '6': -42794}, {'4'...
20230927 1695744000000 [{'4': '东证期货', '5': 291031, '6': -136703}, {'4...
20230928 1695830400000 [{'4': '东证期货', '5': 323971, '6': 32940}, {'4':...
buyPositionRank \
20230406 [{'4': '海证期货', '5': 18021, '6': 11}, {'4': '中泰...
20230407 [{'4': '海证期货', '5': 18035, '6': 14}, {'4': '中泰...
20230410 [{'4': '海证期货', '5': 18048, '6': 13}, {'4': '中泰...
20230411 [{'4': '海证期货', '5': 18048, '6': 0}, {'4': '中泰期...
20230412 [{'4': '海证期货', '5': 18083, '6': 35}, {'4': '浙商...
... ...
20230922 [{'4': '国泰君安', '5': 119476, '6': -8964}, {'4':...
20230925 [{'4': '国泰君安', '5': 118274, '6': -1202}, {'4':...
20230926 [{'4': '国泰君安', '5': 129658, '6': 11384}, {'4':...
20230927 [{'4': '国泰君安', '5': 123275, '6': -6383}, {'4':...
20230928 [{'4': '国泰君安', '5': 118341, '6': -4934}, {'4':...
sellPositionRank
20230406 [{'4': '中泰期货', '5': 13816, '6': 99}, {'4': '光大...
20230407 [{'4': '中泰期货', '5': 13695, '6': -121}, {'4': '...
20230410 [{'4': '中泰期货', '5': 16135, '6': 2440}, {'4': '...
20230411 [{'4': '中泰期货', '5': 15623, '6': -512}, {'4': '...
20230412 [{'4': '中泰期货', '5': 15620, '6': -3}, {'4': '财信...
... ...
20230922 [{'4': '国泰君安', '5': 152616, '6': -6835}, {'4':...
20230925 [{'4': '国泰君安', '5': 159635, '6': 7019}, {'4': ...
20230926 [{'4': '国泰君安', '5': 152998, '6': -6637}, {'4':...
20230927 [{'4': '国泰君安', '5': 148873, '6': -4125}, {'4':...
20230928 [{'4': '国泰君安', '5': 146983, '6': -1890}, {'4':...
[121 rows x 4 columns]}