克隆策略

    {"description":"实验创建于11/25/2021","graph":{"edges":[{"to_node_id":"-851:instruments","from_node_id":"-838:data"},{"to_node_id":"-851:features","from_node_id":"-846:data"},{"to_node_id":"-858:features","from_node_id":"-846:data"},{"to_node_id":"-858:input_data","from_node_id":"-851:data"}],"nodes":[{"node_id":"-838","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-11-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":"-838"}],"output_ports":[{"name":"data","node_id":"-838"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-846","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nreturn_5\nreturn_10\nreturn_20\navg_amount_0/avg_amount_5\navg_amount_5/avg_amount_20\nrank_avg_amount_0/rank_avg_amount_5\nrank_avg_amount_5/rank_avg_amount_10\nrank_return_0\nrank_return_5\nrank_return_10\nrank_return_0/rank_return_5\nrank_return_5/rank_return_10\npe_ttm_0\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-846"}],"output_ports":[{"name":"data","node_id":"-846"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-851","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":"-851"},{"name":"features","node_id":"-851"}],"output_ports":[{"name":"data","node_id":"-851"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-858","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":"-858"},{"name":"features","node_id":"-858"}],"output_ports":[{"name":"data","node_id":"-858"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-838' Position='313.9374694824219,106.13540649414062,200,200'/><node_position Node='-846' Position='641.9375,107.13540649414062,200,200'/><node_position Node='-851' Position='455.9375,207.13540649414062,200,200'/><node_position Node='-858' Position='468.9375,308.1354064941406,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [2]:
    # 本代码由可视化策略环境自动生成 2021年11月25日 18:32
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.instruments.v2(
        start_date='2021-01-01',
        end_date='2021-11-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    return_5
    return_10
    return_20
    avg_amount_0/avg_amount_5
    avg_amount_5/avg_amount_20
    rank_avg_amount_0/rank_avg_amount_5
    rank_avg_amount_5/rank_avg_amount_10
    rank_return_0
    rank_return_5
    rank_return_10
    rank_return_0/rank_return_5
    rank_return_5/rank_return_10
    pe_ttm_0
    """
    )
    
    m3 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m2.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m4 = M.derived_feature_extractor.v3(
        input_data=m3.data,
        features=m2.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    In [3]:
    m4.data.read_df().tail()
    
    Out[3]:
    avg_amount_0 avg_amount_20 avg_amount_5 date instrument pe_ttm_0 rank_avg_amount_0 rank_avg_amount_10 rank_avg_amount_5 rank_return_0 ... rank_return_5 return_10 return_20 return_5 avg_amount_0/avg_amount_5 avg_amount_5/avg_amount_20 rank_avg_amount_0/rank_avg_amount_5 rank_avg_amount_5/rank_avg_amount_10 rank_return_0/rank_return_5 rank_return_5/rank_return_10
    1102226 180647987.0 1.124954e+08 9.394327e+07 2021-10-26 689009.SHA 125.317665 0.725316 0.625558 0.588563 0.109014 ... 0.005567 0.788235 0.827160 0.841180 1.922948 0.835085 1.232352 0.940861 19.583315 1.040043
    1102227 131380190.0 1.116970e+08 1.060245e+08 2021-10-27 689009.SHA 118.023048 0.654332 0.622604 0.609382 0.048137 ... 0.004227 0.708989 0.774613 0.799544 1.239149 0.949215 1.073763 0.978764 11.388118 3.791546
    1102228 101393192.0 1.133740e+08 1.080831e+08 2021-10-28 689009.SHA 119.706421 0.595928 0.615008 0.611987 0.889307 ... 0.018436 0.739457 0.808898 0.831169 0.938104 0.953333 0.973760 0.995088 48.236870 6.367598
    1102229 87240251.0 1.145558e+08 1.149818e+08 2021-10-29 689009.SHA 119.706421 0.571903 0.608502 0.619840 0.217747 ... 0.019534 0.761995 0.825700 0.841220 0.758731 1.003719 0.922661 1.018633 11.147176 4.177454
    1102230 67691552.0 1.139686e+08 1.193678e+08 2021-11-01 689009.SHA 117.667671 0.485733 0.589766 0.621562 0.106882 ... 0.009767 0.797541 0.790327 0.831263 0.567084 1.047375 0.781472 1.053912 10.943264 1.185758

    5 rows × 21 columns

    In [ ]: