【经验分享】看板因子数据读取

策略分享
标签: #<Tag:0x00007f0dc54c5598>

(小Q) #1

封装了一个模块批量抽取因子看板数据

克隆策略

    {"Description":"实验创建于2021/1/13","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-26:input_1","SourceOutputPortId":"-30:data"}],"ModuleNodes":[{"Id":"-26","ModuleId":"BigQuantSpace.board_factor_read.board_factor_read-v1","ModuleParameters":[{"Name":"features","Value":"['alpha_36805', 'alpha_33704', 'alpha_37722', 'alpha_35438', 'alpha_38663', 'alpha_38503']","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-26"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-26","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-30","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2020-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2020-10-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-30"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-30","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"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='-26' Position='257,329,200,200'/><NodePosition Node='-30' Position='146,218,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":false}
    In [1]:
    # 本代码由可视化策略环境自动生成 2021年1月13日17:52
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.instruments.v2(
        start_date='2020-01-01',
        end_date='2020-10-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m1 = M.board_factor_read.v1(
        input_1=m2.data,
        features=['alpha_36805', 'alpha_33704', 'alpha_37722', 'alpha_35438', 'alpha_38663', 'alpha_38503']
    )
    
    In [4]:
    m1.data_1.read().head()
    
    Out[4]:
    date instrument alpha_33704 alpha_35438 alpha_36805 alpha_37722 alpha_38503 alpha_38663
    72381 2020-01-10 000001.SZA -1.954086 -0.127155 0.025241 -1.954086 0.534930 0.452106
    72382 2020-01-10 000002.SZA -1.436305 -0.293417 -0.634831 -1.436305 1.313609 0.963698
    72383 2020-01-10 000004.SZA 2.213521 0.067814 0.203059 2.213521 -0.263585 -0.175409
    72384 2020-01-10 000005.SZA -0.288155 -0.504946 0.013236 -0.288155 2.524142 0.569571
    72385 2020-01-10 000006.SZA -1.960753 -0.529360 0.036576 -1.960753 0.277715 -0.444957

    (lainnoir) #2

    运行下来,提示没有权限


    (h2476) #3

    看板因子数据读取模块里面的因子ID输入五个以上就会报错,这个可以解决一下吗