克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-1353:input_data_1","from_node_id":"-1266:data"},{"to_node_id":"-1345:instruments","from_node_id":"-1332:data"},{"to_node_id":"-1345:features","from_node_id":"-1340:data"},{"to_node_id":"-1353:input_data_2","from_node_id":"-1345:data"}],"nodes":[{"node_id":"-1266","module_id":"BigQuantSpace.datahub_load_datasource.datahub_load_datasource-v1","parameters":[{"name":"table","value":"dividend_send_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2020-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2020-12-31","type":"Literal","bound_global_parameter":null},{"name":"instruments","value":"000001.SZA\n000002.SZA\n000005.SZA","type":"Literal","bound_global_parameter":null},{"name":"fields","value":"dividend_yield","type":"Literal","bound_global_parameter":null}],"input_ports":[],"output_ports":[{"name":"data","node_id":"-1266"}],"cacheable":false,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-1332","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2020-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2020-12-31","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000001.SZA\n000002.SZA\n000005.SZA","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-1332"}],"output_ports":[{"name":"data","node_id":"-1332"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-1340","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":"-1340"}],"output_ports":[{"name":"data","node_id":"-1340"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-1345","module_id":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","parameters":[{"name":"start_date","value":"2020-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2020-12-31","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":90,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-1345"},{"name":"features","node_id":"-1345"}],"output_ports":[{"name":"data","node_id":"-1345"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-1353","module_id":"BigQuantSpace.concat.concat-v3","parameters":[],"input_ports":[{"name":"input_data_1","node_id":"-1353"},{"name":"input_data_2","node_id":"-1353"},{"name":"input_data_3","node_id":"-1353"}],"output_ports":[{"name":"data","node_id":"-1353"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-1266' Position='936,561,200,200'/><node_position Node='-1332' Position='1126,427,200,200'/><node_position Node='-1340' Position='1451,425,200,200'/><node_position Node='-1345' Position='1311,557,200,200'/><node_position Node='-1353' Position='1126,679.9702758789062,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [3]:
    # 本代码由可视化策略环境自动生成 2021年7月26日 10:53
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.datahub_load_datasource.v1(
        table='dividend_send_CN_STOCK_A',
        start_date='2020-01-01',
        end_date='2020-12-31',
        instruments="""000001.SZA
    000002.SZA
    000005.SZA""",
        fields='dividend_yield'
    )
    
    m2 = M.instruments.v2(
        start_date='2020-01-01',
        end_date='2020-12-31',
        market='CN_STOCK_A',
        instrument_list="""000001.SZA
    000002.SZA
    000005.SZA""",
        max_count=0
    )
    
    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
    """
    )
    
    m4 = M.general_feature_extractor.v7(
        instruments=m2.data,
        features=m3.data,
        start_date='2020-01-01',
        end_date='2020-12-31',
        before_start_days=90
    )
    
    m5 = M.concat.v3(
        input_data_1=m1.data,
        input_data_2=m4.data
    )
    

    读取数据(DataSource) 数据统计 (前 2 行) </font></font>

    date instrument dividend_yield
    count(Nan) 0 0 0
    type datetime64[ns] object object

    读取数据(DataSource) 数据预览 (前 5 行) </font></font>

    date instrument dividend_yield
    0 2020-05-28 000001.SZA 0.0162686567164179
    1 2020-08-14 000002.SZA 0.0376105475397706
    In [11]:
    DataSource('dividend_send_CN_STOCK_A').read().describe().dividend_yield
    
    Out[11]:
    count     31301
    unique    16630
    top           -
    freq       2793
    first       NaN
    last        NaN
    Name: dividend_yield, dtype: object
    In [12]:
    m1.data.read()
    
    Out[12]:
    date instrument dividend_yield
    0 2020-05-28 000001.SZA 0.0162686567164179
    1 2020-08-14 000002.SZA 0.0376105475397706