复制链接
克隆策略

    {"description":"实验创建于2019/9/11","graph":{"edges":[{"to_node_id":"-2701:instruments","from_node_id":"-2688:data"},{"to_node_id":"-35:input_data","from_node_id":"-2701:data"},{"to_node_id":"-29:input_1","from_node_id":"-2876:data"},{"to_node_id":"-2701:features","from_node_id":"-2696:data"},{"to_node_id":"-29:input_2","from_node_id":"-2696:data"},{"to_node_id":"-35:features","from_node_id":"-2696:data"},{"to_node_id":"-2876:input_data","from_node_id":"-35:data"}],"nodes":[{"node_id":"-2688","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-07-01","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-2688"}],"output_ports":[{"name":"data","node_id":"-2688"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-2701","module_id":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":90,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-2701"},{"name":"features","node_id":"-2701"}],"output_ports":[{"name":"data","node_id":"-2701"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-2876","module_id":"BigQuantSpace.dropnan.dropnan-v1","parameters":[],"input_ports":[{"name":"input_data","node_id":"-2876"}],"output_ports":[{"name":"data","node_id":"-2876"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-2696","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nreturn_10\nreturn_20\nrank_return_0\nrank_return_5\nrank_return_10\npe_ttm_0\n\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-2696"}],"output_ports":[{"name":"data","node_id":"-2696"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-3450","module_id":"BigQuantSpace.standardlize.standardlize-v8","parameters":[{"name":"columns_input","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-3450"},{"name":"input_2","node_id":"-3450"}],"output_ports":[{"name":"data","node_id":"-3450"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-29","module_id":"BigQuantSpace.standardlize.standardlize-v9","parameters":[{"name":"standard_func","value":"MinMaxNorm","type":"Literal","bound_global_parameter":null},{"name":"columns_input","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-29"},{"name":"input_2","node_id":"-29"}],"output_ports":[{"name":"data","node_id":"-29"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-35","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"False","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-35"},{"name":"features","node_id":"-35"}],"output_ports":[{"name":"data","node_id":"-35"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-2688' Position='561.5347290039062,149.04844665527344,200,200'/><node_position Node='-2701' Position='587.3651123046875,256.8529968261719,200,200'/><node_position Node='-2876' Position='612,548,200,200'/><node_position Node='-2696' Position='979.8513793945312,243.00482177734375,200,200'/><node_position Node='-3450' Position='214.30203247070312,268.0016174316406,200,200'/><node_position Node='-29' Position='720.951904296875,672.714599609375,200,200'/><node_position Node='-35' Position='652.1284790039062,431.5603332519531,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [24]:
    # 本代码由可视化策略环境自动生成 2021年12月16日 23:46
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.instruments.v2(
        start_date='2021-01-01',
        end_date='2021-07-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m4 = M.input_features.v1(
        features="""# #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    return_10
    return_20
    rank_return_0
    rank_return_5
    rank_return_10
    pe_ttm_0
    
    """
    )
    
    m2 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m4.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m7 = M.derived_feature_extractor.v3(
        input_data=m2.data,
        features=m4.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m3 = M.dropnan.v1(
        input_data=m7.data
    )
    
    m6 = M.standardlize.v9(
        input_1=m3.data,
        input_2=m4.data,
        standard_func='MinMaxNorm',
        columns_input=''
    )
    
    m5 = M.standardlize.v8(
        columns_input=''
    )
    
    In [8]:
    # 对数据进行标准化处理
    # 处理前
    m3.data.read_df().head()
    
    Out[8]:
    date instrument pe_ttm_0
    0 2018-10-08 000001.SZA 7.474103
    1 2018-10-09 000001.SZA 7.552778
    2 2018-10-10 000001.SZA 7.474103
    3 2018-10-11 000001.SZA 7.052121
    4 2018-10-12 000001.SZA 7.366819
    In [14]:
    # 处理后
    m6.data.read_df().head()
    
    Out[14]:
    date instrument pe_ttm_0 rank_return_0 rank_return_10 rank_return_5 return_10 return_20
    0 2020-10-09 000001.SZA -0.055835 -1.520153 -0.059614 -0.600532 -0.132612 0.370613
    1 2020-10-12 000001.SZA -0.054909 1.169761 0.379682 0.533540 0.011848 0.670135
    2 2020-10-13 000001.SZA -0.054591 0.917211 0.112475 0.440845 -0.126744 0.695181
    3 2020-10-14 000001.SZA -0.054815 0.603715 0.477331 -0.032373 0.025259 0.612450
    4 2020-10-15 000001.SZA -0.054734 1.566715 1.068145 1.310307 0.513557 0.775774