当前位置: 首页> 房产> 建筑 > qmt量化交易策略小白学习笔记第6期【qmt如何获取股票历史涨跌停价格】

qmt量化交易策略小白学习笔记第6期【qmt如何获取股票历史涨跌停价格】

时间:2025/7/11 1:17:27来源:https://blog.csdn.net/fanglue3705/article/details/139121658 浏览次数:0次

qmt如何获取股票历史涨跌停价格

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

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

感谢关注,需免费开通量化回测与咨询实盘权限,可以和博主联系!

获取股票历史涨跌停价格

提示

  1. 获取该数据前需要先调用xtdata.download_history_data进行下载,period参数选择"stoppricedata"

  2. 该数据通过get_market_data_ex接口获取,period参数选择"stoppricedata"

  3. 若是只需要最新一天的涨跌停价格,可通过get_instrument_detail的UpStopPriceDownStopPrice字段获取

  4. 该数据是VIP权限数据

调用方法

get_market_data_ex([],stock_list,period="stoppricedata",start_time = "", end_time = "")

参数

参数名称类型描述
field_listlist数据字段列表,传空则为全部字段
stock_listlist合约代码列表
periodstring周期
start_timestring起始时间
end_timestring结束时间
countint数据个数。默认参数,大于等于0时,若指定了 start_timeend_time,此时以 end_time 为基准向前取 count 条;若 start_timeend_time 缺省,默认取本地数据最新的 count 条数据;若 start_timeend_timecount 都缺省时,默认取本地全部数据

返回值

返回一个 {stock_code:pd.DataFrame} 结构的dict对象,默认的列索引为取得的全部字段. 如果给定了 fields 参数, 则列索引与给定的 fields 对应.

示例

python


from xtquant import xtdatastock_list = xtdata.get_stock_list_in_sector("沪深A股")[:5]# 下载涨跌停价格数据
for i in stock_list:xtdata.download_history_data(i, 'stoppricedata', '', '')# 获取涨跌停价格数据
data = xtdata.get_market_data_ex([], stock_list, 'stoppricedata', '', '')print(data)

返回值

{'000001.SZ':                time    涨停价   跌停价0      663004800000   0.00  0.001      663609600000   0.00  0.002      664214400000   0.00  0.003      664819200000   0.00  0.004      665424000000   0.00  0.00...             ...    ...   ...7824  1701360000000  10.65  8.717825  1701619200000  10.63  8.697826  1701705600000  10.59  8.677827  1701792000000  10.43  8.537828  1701878400000  10.45  8.55[7829 rows x 3 columns],'000002.SZ':                time    涨停价    跌停价0      663004800000   0.00   0.001      664214400000   0.00   0.002      665078400000   0.00   0.003      665164800000   0.00   0.004      665424000000   0.00   0.00...             ...    ...    ...7816  1701360000000  12.58  10.307817  1701619200000  12.54  10.267818  1701705600000  12.30  10.067819  1701792000000  11.87   9.717820  1701878400000  11.94   9.77[7821 rows x 3 columns],'000004.SZ':                time    涨停价    跌停价0      663004800000   0.00   0.001      663609600000   0.00   0.002      663782400000   0.00   0.003      663868800000   0.00   0.004      663955200000   0.00   0.00...             ...    ...    ...7687  1701360000000  19.09  15.627688  1701619200000  19.71  16.137689  1701705600000  19.94  16.327690  1701792000000  19.00  15.547691  1701878400000  18.72  15.32[7692 rows x 3 columns],'000005.SZ':                time   涨停价   跌停价0      661536000000  0.00  0.001      661622400000  0.00  0.002      661708800000  0.00  0.003      661968000000  0.00  0.004      662054400000  0.00  0.00...             ...   ...   ...7303  1701360000000  1.47  1.337304  1701619200000  1.47  1.337305  1701705600000  1.48  1.347306  1701792000000  1.48  1.347307  1701878400000  1.47  1.33[7308 rows x 3 columns],'000006.SZ':                time   涨停价   跌停价0      704304000000  0.00  0.001      704390400000  0.00  0.002      704476800000  0.00  0.003      704563200000  0.00  0.004      704822400000  0.00  0.00...             ...   ...   ...7491  1701360000000  5.09  4.177492  1701619200000  5.14  4.207493  1701705600000  5.12  4.197494  1701792000000  5.07  4.157495  1701878400000  5.27  4.31[7496 rows x 3 columns]}


 

关键字:qmt量化交易策略小白学习笔记第6期【qmt如何获取股票历史涨跌停价格】

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: