qmt量化交易策略小白学习笔记第53期【qmt编程之期权数据】

qmt编程之获取期权数据

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

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

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

获取期权数据

获取指定期权标的对应的期权品种列表

为了获取与指定期权标的相关的期权品种列表,你需要使用此函数操作。根据你的需求,这个过程将需要输入期权标的(如某个公司的股票代码)作为参数,接下来,该函数将返回所有与此期权标的相关的期权品种信息。这样的功能使投资者能够对期权市场有更详尽、全面的掌握,从而做出更科学、合理的投资决策。

方式1:内置python
调用方法

内置python

#encoding:gbk
def init(ContextInfo):
  pass

def after_init(ContextInfo):
  data=ContextInfo.get_option_undl_data(undl_code_ref)
参数
字段 类型 说明
undl_code_ref string 期权标的代码
  • undl_code_ref:期权标的代码,如'510300.SH',传空字符串时获取全部标的数据
返回
提示
  • 指定期权标的返回的是 列表类型
  • 期权标的为空字符串返回的是 字典类型
示例
#encoding:gbk

def init(ContextInfo):
	ContextInfo.etf_code = "510050.SH"
	
def after_init(ContextInfo):
	data=ContextInfo.get_option_undl_data('510300.SH')
	print(data)
返回值
 ['10005347.SHO', '10005348.SHO', '10005349.SHO', '10005350.SHO', '10005351.SHO', '10005352.SHO', '10005353.SHO', '10005354.SHO', '10005355.SHO', '10005356.SHO', '10005357.SHO', '10005358.SHO', '10005359.SHO', '10005360.SHO', '10005361.SHO', '10005362.SHO', '10005363.SHO', '10005364.SHO', '10005387.SHO', '10005388.SHO', '10005391.SHO', '10005392.SHO', '10005467.SHO', '10005468.SHO', '10005783.SHO', '10005784.SHO', '10005785.SHO', '10005786.SHO', '10005787.SHO', '10005788.SHO', '10005789.SHO', '10005790.SHO', '10005791.SHO', '10005792.SHO', '10005793.SHO', '10005794.SHO', '10005795.SHO', '10005796.SHO', '10005797.SHO', '10005798.SHO', '10005799.SHO', '10005800.SHO', '10005867.SHO', '10005868.SHO', '10005875.SHO', '10005876.SHO', '10005897.SHO', '10005898.SHO', '10005931.SHO', '10005932.SHO', '10005933.SHO', '10005934.SHO', '10005935.SHO', '10005936.SHO', '10005937.SHO', '10005938.SHO', '10005939.SHO', '10005940.SHO', '10005941.SHO', '10005942.SHO', '10005943.SHO', '10005944.SHO', '10005945.SHO', '10005946.SHO', '10005947.SHO', '10005948.SHO', '10006007.SHO', '10006008.SHO', '10006019.SHO', '10006020.SHO', '10006021.SHO', '10006022.SHO', '10006023.SHO', '10006024.SHO', '10006043.SHO', '10006044.SHO', '10006045.SHO', '10006046.SHO', '10006047.SHO', '10006048.SHO', '10006049.SHO', '10006050.SHO', '10006051.SHO', '10006052.SHO', '10006053.SHO', '10006054.SHO', '10006055.SHO', '10006056.SHO', '10006057.SHO', '10006058.SHO', '10006059.SHO', '10006060.SHO', '10006117.SHO', '10006118.SHO', '10006135.SHO', '10006136.SHO', '10006137.SHO', '10006138.SHO', '10006139.SHO', '10006140.SHO', '10006141.SHO', '10006142.SHO']
方式2:原生python
调用方法

python

from xtquant import xtdata
xtdata.get_option_undl_data(undl_code_ref)
参数
字段 类型 说明
undl_code_ref string 期权标的代码
  • undl_code_ref:期权标的代码,如'510300.SH',传空字符串时获取全部标的数据
返回
提示
  • 指定期权标的返回的是 列表类型
  • 期权标的为空字符串返回的是 字典类型
示例
from xtquant import xtdata
print(xtdata.get_option_undl_data("510300.SH"))
返回值
 ['10005347.SHO', '10005348.SHO', '10005349.SHO', '10005350.SHO', '10005351.SHO', '10005352.SHO', '10005353.SHO', '10005354.SHO', '10005355.SHO', '10005356.SHO', '10005357.SHO', '10005358.SHO', '10005359.SHO', '10005360.SHO', '10005361.SHO', '10005362.SHO', '10005363.SHO', '10005364.SHO', '10005387.SHO', '10005388.SHO', '10005391.SHO', '10005392.SHO', '10005467.SHO', '10005468.SHO', '10005783.SHO', '10005784.SHO', '10005785.SHO', '10005786.SHO', '10005787.SHO', '10005788.SHO', '10005789.SHO', '10005790.SHO', '10005791.SHO', '10005792.SHO', '10005793.SHO', '10005794.SHO', '10005795.SHO', '10005796.SHO', '10005797.SHO', '10005798.SHO', '10005799.SHO', '10005800.SHO', '10005867.SHO', '10005868.SHO', '10005875.SHO', '10005876.SHO', '10005897.SHO', '10005898.SHO', '10005931.SHO', '10005932.SHO', '10005933.SHO', '10005934.SHO', '10005935.SHO', '10005936.SHO', '10005937.SHO', '10005938.SHO', '10005939.SHO', '10005940.SHO', '10005941.SHO', '10005942.SHO', '10005943.SHO', '10005944.SHO', '10005945.SHO', '10005946.SHO', '10005947.SHO', '10005948.SHO', '10006007.SHO', '10006008.SHO', '10006019.SHO', '10006020.SHO', '10006021.SHO', '10006022.SHO', '10006023.SHO', '10006024.SHO', '10006043.SHO', '10006044.SHO', '10006045.SHO', '10006046.SHO', '10006047.SHO', '10006048.SHO', '10006049.SHO', '10006050.SHO', '10006051.SHO', '10006052.SHO', '10006053.SHO', '10006054.SHO', '10006055.SHO', '10006056.SHO', '10006057.SHO', '10006058.SHO', '10006059.SHO', '10006060.SHO', '10006117.SHO', '10006118.SHO', '10006135.SHO', '10006136.SHO', '10006137.SHO', '10006138.SHO', '10006139.SHO', '10006140.SHO', '10006141.SHO', '10006142.SHO']
相关推荐
戊辰happy1 小时前
arcface
算法
浊酒南街2 小时前
决策树python实现代码1
python·算法·决策树
FreedomLeo13 小时前
Python机器学习笔记(十三、k均值聚类)
python·机器学习·kmeans·聚类
星光樱梦3 小时前
32. 线程、进程与协程
python
阿正的梦工坊3 小时前
深入理解 PyTorch 的 view() 函数:以多头注意力机制(Multi-Head Attention)为例 (中英双语)
人工智能·pytorch·python
冠位观测者3 小时前
【Leetcode 热题 100】208. 实现 Trie (前缀树)
数据结构·算法·leetcode
西猫雷婶3 小时前
python学opencv|读取图像(十九)使用cv2.rectangle()绘制矩形
开发语言·python·opencv
liuxin334455664 小时前
学籍管理系统:实现教育管理现代化
java·开发语言·前端·数据库·安全
海绵波波1074 小时前
flask后端开发(10):问答平台项目结构搭建
后端·python·flask
码农W4 小时前
QT--静态插件、动态插件
开发语言·qt