复制链接
克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-222:input_data","from_node_id":"-215:data"},{"to_node_id":"-71:data2","from_node_id":"-222:data"},{"to_node_id":"-215:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-222:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-215:instruments","from_node_id":"-8270:data"},{"to_node_id":"-371:features","from_node_id":"-358:data"},{"to_node_id":"-1869:features","from_node_id":"-358:data"},{"to_node_id":"-371:instruments","from_node_id":"-362:data"},{"to_node_id":"-1869:input_data","from_node_id":"-371:data"},{"to_node_id":"-71:data1","from_node_id":"-1869:data"},{"to_node_id":"-78:input_data","from_node_id":"-71:data"}],"nodes":[{"node_id":"-215","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":"-215"},{"name":"features","node_id":"-215"}],"output_ports":[{"name":"data","node_id":"-215"}],"cacheable":true,"seq_num":15,"comment":"","comment_collapsed":true},{"node_id":"-222","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":"-222"},{"name":"features","node_id":"-222"}],"output_ports":[{"name":"data","node_id":"-222"}],"cacheable":true,"seq_num":16,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\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":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-8270","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-01-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":"-8270"}],"output_ports":[{"name":"data","node_id":"-8270"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-358","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nbar1d_index_CN_STOCK_A__close\nreturn_5 = bar1d_index_CN_STOCK_A__close/shift(bar1d_index_CN_STOCK_A__close, 5) - 1\nsig = where(return_5>0.04, 0, 1)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-358"}],"output_ports":[{"name":"data","node_id":"-358"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-362","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-01-01","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000001.HIX","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-362"}],"output_ports":[{"name":"data","node_id":"-362"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-371","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":"-371"},{"name":"features","node_id":"-371"}],"output_ports":[{"name":"data","node_id":"-371"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-1869","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":"-1869"},{"name":"features","node_id":"-1869"}],"output_ports":[{"name":"data","node_id":"-1869"}],"cacheable":true,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-71","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date","type":"Literal","bound_global_parameter":null},{"name":"how","value":"inner","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-71"},{"name":"data2","node_id":"-71"}],"output_ports":[{"name":"data","node_id":"-71"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-78","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"sig>0","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-78"}],"output_ports":[{"name":"data","node_id":"-78"},{"name":"left_data","node_id":"-78"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-215' Position='702.2432250976562,-45.83011245727539,200,200'/><node_position Node='-222' Position='710.938232421875,35.05788803100586,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='889.563720703125,-195.34749603271484,200,200'/><node_position Node='-8270' Position='538.9690551757812,-191.30500030517578,200,200'/><node_position Node='-358' Position='136.06948852539062,-201.26255416870117,200,200'/><node_position Node='-362' Position='-159.1158218383789,-201.37451934814453,200,200'/><node_position Node='-371' Position='-6.1467132568359375,-77.4131269454956,200,200'/><node_position Node='-1869' Position='-5.853279113769531,32.28956985473633,200,200'/><node_position Node='-71' Position='363.0386657714844,157.18531799316406,200,200'/><node_position Node='-78' Position='378.99993896484375,260.9112243652344,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [23]:
    # 本代码由可视化策略环境自动生成 2022年9月17日 09:55
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m3 = 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
    """
    )
    
    m1 = M.instruments.v2(
        start_date='2021-01-01',
        end_date='2022-01-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m15 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m16 = M.derived_feature_extractor.v3(
        input_data=m15.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m5 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    bar1d_index_CN_STOCK_A__close
    return_5 = bar1d_index_CN_STOCK_A__close/shift(bar1d_index_CN_STOCK_A__close, 5) - 1
    sig = where(return_5>0.04, 0, 1)"""
    )
    
    m6 = M.instruments.v2(
        start_date='2021-01-01',
        end_date='2022-01-01',
        market='CN_STOCK_A',
        instrument_list='000001.HIX',
        max_count=0
    )
    
    m7 = M.general_feature_extractor.v7(
        instruments=m6.data,
        features=m5.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m8 = M.derived_feature_extractor.v3(
        input_data=m7.data,
        features=m5.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m2 = M.join.v3(
        data1=m8.data,
        data2=m16.data,
        on='date',
        how='inner',
        sort=False
    )
    
    m10 = M.filter.v3(
        input_data=m2.data,
        expr='sig>0',
        output_left_data=False
    )