复制链接
克隆策略

    {"description":"实验创建于2022/8/28","graph":{"edges":[{"to_node_id":"-886:instruments","from_node_id":"-837:data"},{"to_node_id":"-869:features","from_node_id":"-849:data"},{"to_node_id":"-886:features","from_node_id":"-849:data"},{"to_node_id":"-869:input_data","from_node_id":"-886:data"}],"nodes":[{"node_id":"-837","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-08-01","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"00000001.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":"-837"}],"output_ports":[{"name":"data","node_id":"-837"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-849","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nbuy_condition=where(mean(close_0,5)>mean(close_0,20),1,0)\nsell_condition=where(mean(close_0,5)<mean(close_0,20),1,0)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-849"}],"output_ports":[{"name":"data","node_id":"-849"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-869","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":"-869"},{"name":"features","node_id":"-869"}],"output_ports":[{"name":"data","node_id":"-869"}],"cacheable":false,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-886","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":"-886"},{"name":"features","node_id":"-886"}],"output_ports":[{"name":"data","node_id":"-886"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-837' Position='254.2265625,196,200,200'/><node_position Node='-849' Position='-17.77342987060547,84.00001525878906,200,200'/><node_position Node='-869' Position='257.0000305175781,405.5,200,200'/><node_position Node='-886' Position='255.93374633789062,303.8901672363281,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [34]:
    # 本代码由可视化策略环境自动生成 2022年8月28日 23:53
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.instruments.v2(
        start_date='2021-01-01',
        end_date='2022-08-01',
        market='CN_STOCK_A',
        instrument_list='00000001.SZA',
        max_count=0
    )
    
    m3 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    buy_condition=where(mean(close_0,5)>mean(close_0,20),1,0)
    sell_condition=where(mean(close_0,5)<mean(close_0,20),1,0)"""
    )
    
    m4 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m5 = M.derived_feature_extractor.v3(
        input_data=m4.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={},
        m_cached=False
    )
    
    ---------------------------------------------------------------------------
    Exception                                 Traceback (most recent call last)
    <ipython-input-34-f05391e1a6d1> in <module>
         19 )
         20 
    ---> 21 m4 = M.general_feature_extractor.v7(
         22     instruments=m1.data,
         23     features=m3.data,
    
    Exception: no features extracted.