复制链接
克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-222:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","from_node_id":"-7864:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","from_node_id":"-7872:data"},{"to_node_id":"-7872:instruments","from_node_id":"-7879:data"},{"to_node_id":"-7864:instruments","from_node_id":"-7879:data"},{"to_node_id":"-222:input_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"group_mean(concept, close)","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":"-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":"-7864","module_id":"BigQuantSpace.use_datasource.use_datasource-v2","parameters":[{"name":"datasource_id","value":"industry_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"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":"-7864"},{"name":"features","node_id":"-7864"}],"output_ports":[{"name":"data","node_id":"-7864"}],"cacheable":true,"seq_num":2,"comment":"df_industry = DataSource('industry_CN_STOCK_A').read(start_date=\"2020-06-01\", end_date=\"2020-06-30\")\ndf_raw = DataSource('bar1d_CN_STOCK_A').read(start_date=\"2020-06-01\", end_date=\"2020-06-30\")\ndf = pd.merge(df_raw,df_industry,how='left',on=['date','instrument'])\ndf[['date','concept','close']].groupby(['date','concept']).mean()","comment_collapsed":true},{"node_id":"-7872","module_id":"BigQuantSpace.use_datasource.use_datasource-v2","parameters":[{"name":"datasource_id","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"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":"-7872"},{"name":"features","node_id":"-7872"}],"output_ports":[{"name":"data","node_id":"-7872"}],"cacheable":true,"seq_num":4,"comment":"df_industry = DataSource('industry_CN_STOCK_A').read(start_date=\"2020-06-01\", end_date=\"2020-06-30\")\ndf_raw = DataSource('bar1d_CN_STOCK_A').read(start_date=\"2020-06-01\", end_date=\"2020-06-30\")\ndf = pd.merge(df_raw,df_industry,how='left',on=['date','instrument'])\ndf[['date','concept','close']].groupby(['date','concept']).mean()","comment_collapsed":true},{"node_id":"-7879","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":"-7879"}],"output_ports":[{"name":"data","node_id":"-7879"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date,instrument","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":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"},{"name":"data2","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='718.2742309570312,-50.35649085044861,200,200'/><node_position Node='-222' Position='512,282,200,200'/><node_position Node='-7864' Position='427,-51,200,200'/><node_position Node='-7872' Position='140,-54,200,200'/><node_position Node='-7879' Position='296,-203,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='277,71,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [30]:
    # 本代码由可视化策略环境自动生成 2022年9月17日 13:53
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m3 = M.input_features.v1(
        features='group_mean(concept, close)'
    )
    
    m1 = M.instruments.v2(
        start_date='2021-01-01',
        end_date='2022-01-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m4 = M.use_datasource.v2(
        instruments=m1.data,
        datasource_id='bar1d_CN_STOCK_A',
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m2 = M.use_datasource.v2(
        instruments=m1.data,
        datasource_id='industry_CN_STOCK_A',
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m5 = M.join.v3(
        data1=m4.data,
        data2=m2.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m16 = M.derived_feature_extractor.v3(
        input_data=m5.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )