qmt量化交易策略小白学习笔记第45期【qmt编程之期货行情数据--如何获取日线行情、tick行情】

qmt编程之获取期货行情数据

qmt更加详细的教程方法,会持续慢慢梳理。

也可找寻博主的历史文章,搜索关键词查看解决方案 !

感谢关注,咨询免费开通量化回测与获取实盘权限,欢迎和博主联系!

获取日线行情数据

示例
复制代码
from xtquant import xtdata
xtdata.get_market_data_ex([],['rb2401.SF'],period='1d')
返回值
复制代码
# 返回结果
{'rb2401.SF':                    time    open    high     low   close   volume  \
 20230117  1673884800000  4001.0  4027.0  3973.0  4011.0     1038   
 20230118  1673971200000  4027.0  4051.0  4014.0  4037.0      314   
 20230119  1674057600000  4043.0  4085.0  4043.0  4080.0      352   
 20230120  1674144000000  4075.0  4076.0  4050.0  4070.0      502   
 20230130  1675008000000  4127.0  4157.0  4080.0  4084.0      992   
 ...                 ...     ...     ...     ...     ...      ...   
 20231017  1697472000000  3658.0  3672.0  3637.0  3647.0  1068036   
 20231018  1697558400000  3652.0  3660.0  3605.0  3615.0  1361935   
 20231019  1697644800000  3615.0  3650.0  3595.0  3644.0  1313338   
 20231020  1697731200000  3650.0  3659.0  3601.0  3610.0  1418587   
 20231023  1697990400000  3600.0  3616.0  3558.0  3573.0  1513440   
 
                 amount  settelementPrice  openInterest  preClose  suspendFlag  
 20230117  4.148817e+07            3996.0           573    4061.0            0  
 20230118  1.267393e+07            4036.0           713    4011.0            0  
 20230119  1.431537e+07            4066.0           821    4037.0            0  
 20230120  2.040859e+07            4065.0           944    4080.0            0  
 20230130  4.090941e+07            4123.0          1201    4070.0            0  
 ...                ...               ...           ...       ...          ...  
 20231017  3.900789e+10            3652.0       1870289    3657.0            0  
 20231018  4.950385e+10            3634.0       1951142    3647.0            0  
 20231019  4.759753e+10            3624.0       1886883    3615.0            0  
 20231020  5.149242e+10            3629.0       1880167    3644.0            0  
 20231023  5.423026e+10               0.0       1961524    3610.0            0  
 
 [183 rows x 11 columns]}

获取tick行情

示例
复制代码
from xtquant import xtdata
xtdata.get_market_data_ex([],['rb2401.SF'],period='tick')
返回值
复制代码
time	lastPrice	open	high	low	lastClose	amount	volume	pvolume	stockStatus	openInt	lastSettlementPrice	askPrice	bidPrice	askVol	bidVol	settlementPrice	transactionNum
20230925085900	1695603540500	3778.0	3786.0	3787.0	3766.0	3779.0	1.291532e+10	341961	0	0	1651554	3773.0	[3779.0, 3780.0, 3781.0, 3782.0, 3783.0]	[3777.0, 3776.0, 3775.0, 3774.0, 3773.0]	[635, 0, 0, 0, 0]	[138, 0, 0, 0, 0]	0.0	0
20230925090000	1695603600500	3779.0	3786.0	3787.0	3766.0	3779.0	1.296989e+10	343405	0	0	1652373	3773.0	[3780.0, 3781.0, 3782.0, 3783.0, 3784.0]	[3778.0, 3777.0, 3776.0, 3775.0, 3774.0]	[916, 0, 0, 0, 0]	[168, 0, 0, 0, 0]	0.0	0
20230925090001	1695603601000	3780.0	3786.0	3787.0	3766.0	3779.0	1.307600e+10	346211	0	0	1651646	3773.0	[3787.0, 3788.0, 3789.0, 3790.0, 3791.0]	[3779.0, 3778.0, 3777.0, 3776.0, 3775.0]	[420, 0, 0, 0, 0]	[20, 0, 0, 0, 0]	0.0	0
20230925090001	1695603601500	3783.0	3786.0	3787.0	3766.0	3779.0	1.309460e+10	346703	0	0	1651496	3773.0	[3784.0, 3785.0, 3786.0, 3787.0, 3788.0]	[3776.0, 3775.0, 3774.0, 3773.0, 3772.0]	[46, 0, 0, 0, 0]	[89, 0, 0, 0, 0]	0.0	0
20230925090002	1695603602000	3783.0	3786.0	3787.0	3766.0	3779.0	1.312842e+10	347597	0	0	1651258	3773.0	[3784.0, 3785.0, 3786.0, 3787.0, 3788.0]	[3782.0, 3781.0, 3780.0, 3779.0, 3778.0]	[41, 0, 0, 0, 0]	[7, 0, 0, 0, 0]	0.0	0
...	...	...	...	...	...	...	...	...	...	...	...	...	...	...	...	...	...	...
20230928145958	1695884398500	3690.0	3690.0	3717.0	3684.0	3682.0	3.781059e+10	1021634	0	0	1697198	3684.0	[3690.0, 0.0, 0.0, 0.0, 0.0]	[3690.0, 0.0, 0.0, 0.0, 0.0]	[54, 0, 0, 0, 0]	[126, 0, 0, 0, 0]	0.0	0
20230928145959	1695884399000	3690.0	3690.0	3717.0	3684.0	3682.0	3.781148e+10	1021658	0	0	1697179	3684.0	[3690.0, 0.0, 0.0, 0.0, 0.0]	[3690.0, 0.0, 0.0, 0.0, 0.0]	[20, 0, 0, 0, 0]	[112, 0, 0, 0, 0]	0.0	0
20230928145959	1695884399500	3690.0	3690.0	3717.0	3684.0	3682.0	3.781395e+10	1021725	0	0	1697158	3684.0	[3690.0, 0.0, 0.0, 0.0, 0.0]	[3690.0, 0.0, 0.0, 0.0, 0.0]	[20, 0, 0, 0, 0]	[46, 0, 0, 0, 0]	0.0	0
20230928150000	1695884400000	3690.0	3690.0	3717.0	3684.0	3682.0	3.781502e+10	1021754	0	0	1697143	3684.0	[3690.0, 0.0, 0.0, 0.0, 0.0]	[3690.0, 0.0, 0.0, 0.0, 0.0]	[10, 0, 0, 0, 0]	[63, 0, 0, 0, 0]	0.0	0
20230928150000	1695884400500	3690.0	3690.0	3717.0	3684.0	3682.0	3.781502e+10	1021754	0	0	1697143	3684.0	[3690.0, 0.0, 0.0, 0.0, 0.0]	[3690.0, 0.0, 0.0, 0.0, 0.0]	[10, 0, 0, 0, 0]	[63, 0, 0, 0, 0]	3700.0	0
149943 rows × 18 columns
相关推荐
降临-max1 天前
JavaSE---网络编程
java·开发语言·网络·笔记·学习
湖边看客1 天前
antd x6 + vue3
开发语言·javascript·vue.js
橘颂TA1 天前
【剑斩OFFER】算法的暴力美学——只出现一次的数字 ||
算法·leetcode·动态规划
q***47431 天前
PostgreSQL 中进行数据导入和导出
大数据·数据库·postgresql
十六年开源服务商1 天前
WordPress运维服务怎样提供客户服务支持
运维
小离a_a1 天前
flex垂直布局,容器间距相等
开发语言·javascript·ecmascript
chxii1 天前
PHP 配置全解析:Apache vs Nginx 的线程安全差异与 Windows 实战指南
运维·php
BBB努力学习程序设计1 天前
Python面向对象编程:从代码搬运工到架构师
python·pycharm
寰宇视讯1 天前
奇兵到家九周年再进阶,获36氪“WISE2025商业之王 年度最具商业潜力企业”
大数据
傻啦嘿哟1 天前
物流爬虫实战:某丰快递信息实时追踪技术全解析
java·开发语言·数据库