如何获取期权数据?


(胖大帅) #1

如何获取期权数据,有哪些字段呢?


(iQuant) #2

这里的期权是上证50ETF期权,期权的数据分为日线数据和分钟数据,主要是行情相关的字段。下面是一个获取的例子:

克隆策略

    {"Description":"实验创建于2018/5/6","Summary":"","Graph":{"EdgesInternal":[],"ModuleNodes":[{"Id":"-143","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bigquant-options-SHAO-bar1m.h5","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[],"OutputPortsInternal":[{"Name":"data","NodeId":"-143","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"Comment":"","CommentCollapsed":true},{"Id":"-188","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"bigquant-options-SHAO.h5","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[],"OutputPortsInternal":[{"Name":"data","NodeId":"-188","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-143' Position='279,196,200,200'/><NodePosition Node='-188' Position='716.938232421875,202.4312286376953,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
    In [7]:
    # 本代码由可视化策略环境自动生成 2018年5月6日 21:55
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.use_datasource.v1(
        datasource_id='bigquant-options-SHAO-bar1m.h5'
    )
    
    m2 = M.use_datasource.v1(
        datasource_id='bigquant-options-SHAO.h5'
    )
    
    [2018-05-06 21:53:37.690988] INFO: bigquant: use_datasource.v1 开始运行..
    [2018-05-06 21:53:37.717639] INFO: bigquant: 命中缓存
    [2018-05-06 21:53:37.719574] INFO: bigquant: use_datasource.v1 运行完成[0.028592s].
    
    In [6]:
    m1.data.read_df().tail()
    
    Out[6]:
    Code OUTMESSAGE amount close date high low open open_intl volume
    1733683 10001332.SHAO NaN 8940 0.0894 2018-05-04 14:56:00 0.0898 0.0894 0.0898 1293 10
    1733684 10001332.SHAO NaN 0 0.0894 2018-05-04 14:57:00 0.0894 0.0894 0.0894 1293 0
    1733685 10001332.SHAO NaN 0 0.0894 2018-05-04 14:58:00 0.0894 0.0894 0.0894 1293 0
    1733686 10001332.SHAO NaN NaN NaN 2018-05-04 14:59:00 NaN NaN NaN None None
    1733687 10001332.SHAO NaN 1792 0.0896 2018-05-04 15:00:00 0.0896 0.0896 0.0896 1235 2
    In [8]:
    m2.data.read_df().tail()
    
    Out[8]:
    Code amount close date delta fetch_date gamma high low open open_intl option_name rho settle theta vega volume
    85895 10001328.SHAO 175179 0.2528 2018-05-04 00:00:00 NaN 2018-05-04 16:02:15.215318 NaN 0.2544 0.2393 0.2393 203 50ETF沽12月2.80 NaN 0 NaN NaN 70
    85896 10001329.SHAO 266947 0.2841 2018-05-04 00:00:00 NaN 2018-05-04 16:02:15.215318 NaN 0.2864 0.2759 0.2802 436 50ETF沽12月2.85 NaN 0 NaN NaN 95
    85897 10001330.SHAO 294187 0.3171 2018-05-04 00:00:00 NaN 2018-05-04 16:02:15.215318 NaN 0.3178 0.3083 0.312 804 50ETF沽12月2.90 NaN 0 NaN NaN 94
    85898 10001331.SHAO 2.6885e+06 0.3413 2018-05-04 00:00:00 NaN 2018-05-04 16:02:15.215318 NaN 0.3582 0.339 0.3566 993 50ETF购12月2.45 NaN 0 NaN NaN 777
    85899 10001332.SHAO 527429 0.0896 2018-05-04 00:00:00 NaN 2018-05-04 16:02:15.215318 NaN 0.091 0.0858 0.0898 1235 50ETF沽12月2.45 NaN 0 NaN NaN 589