复制链接
克隆策略

    {"description":"实验创建于2022/9/30","graph":{"edges":[{"to_node_id":"-1870:instruments","from_node_id":"-1893:data"},{"to_node_id":"-1906:instruments","from_node_id":"-1893:data"},{"to_node_id":"-1906:features","from_node_id":"-1901:data"},{"to_node_id":"-1913:features","from_node_id":"-1901:data"},{"to_node_id":"-1913:input_data","from_node_id":"-1906:data"},{"to_node_id":"-1870:feature_datas","from_node_id":"-1913:data"}],"nodes":[{"node_id":"-1870","module_id":"BigQuantSpace.genetic_algorithm.genetic_algorithm-v1","parameters":[{"name":"all_start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"all_end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"short_date_range_ratio","value":0.7,"type":"Literal","bound_global_parameter":null},{"name":"return_field","value":"wap_3_vwap_buy","type":"Literal","bound_global_parameter":null},{"name":"rebalance_period","value":1,"type":"Literal","bound_global_parameter":null},{"name":"train_test_ratio","value":0.75,"type":"Literal","bound_global_parameter":null},{"name":"train_validate_ratio","value":0.75,"type":"Literal","bound_global_parameter":null},{"name":"mtime","value":1,"type":"Literal","bound_global_parameter":null},{"name":"init_ind_num","value":"10","type":"Literal","bound_global_parameter":null},{"name":"ngen","value":3,"type":"Literal","bound_global_parameter":null},{"name":"fitness_func","value":"longshort_sharpe","type":"Literal","bound_global_parameter":null},{"name":"train_fitness","value":2,"type":"Literal","bound_global_parameter":null},{"name":"test_fitness","value":1.6,"type":"Literal","bound_global_parameter":null},{"name":"ir_type","value":"ir","type":"Literal","bound_global_parameter":null},{"name":"cxpb","value":0.5,"type":"Literal","bound_global_parameter":null},{"name":"mutpb","value":0.3,"type":"Literal","bound_global_parameter":null},{"name":"mutspb","value":0.3,"type":"Literal","bound_global_parameter":null},{"name":"mutnrpb","value":0.3,"type":"Literal","bound_global_parameter":null},{"name":"constant","value":"1,11","type":"Literal","bound_global_parameter":null},{"name":"pool_processes_limit","value":"10","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-1870"},{"name":"feature_datas","node_id":"-1870"},{"name":"base_features","node_id":"-1870"}],"output_ports":[{"name":"factors","node_id":"-1870"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-1893","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2020-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-09-30","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":"-1893"}],"output_ports":[{"name":"data","node_id":"-1893"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-1901","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"open_0\nclose_0\nhigh_0\nlow_0\nturn_0\nreturn_0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-1901"}],"output_ports":[{"name":"data","node_id":"-1901"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-1906","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":"-1906"},{"name":"features","node_id":"-1906"}],"output_ports":[{"name":"data","node_id":"-1906"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-1913","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":"-1913"},{"name":"features","node_id":"-1913"}],"output_ports":[{"name":"data","node_id":"-1913"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-1870' Position='378,484.076416015625,200,200'/><node_position Node='-1893' Position='238,178,200,200'/><node_position Node='-1901' Position='620,177,200,200'/><node_position Node='-1906' Position='438,283,200,200'/><node_position Node='-1913' Position='439,373,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [1]:
    # 本代码由可视化策略环境自动生成 2022年12月1日 11:56
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.instruments.v2(
        start_date='2020-01-01',
        end_date='2022-09-30',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m3 = M.input_features.v1(
        features="""open_0
    close_0
    high_0
    low_0
    turn_0
    return_0"""
    )
    
    m4 = M.general_feature_extractor.v7(
        instruments=m2.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={}
    )
    
    m1 = M.genetic_algorithm.v1(
        instruments=m2.data,
        feature_datas=m5.data,
        all_start_date='',
        all_end_date='',
        short_date_range_ratio=0.7,
        return_field='wap_3_vwap_buy',
        rebalance_period=1,
        train_test_ratio=0.75,
        train_validate_ratio=0.75,
        mtime=1,
        init_ind_num=10,
        ngen=3,
        fitness_func='longshort_sharpe',
        train_fitness=2,
        test_fitness=1.6,
        ir_type='ir',
        cxpb=0.5,
        mutpb=0.3,
        mutspb=0.3,
        mutnrpb=0.3,
        constant='1,11',
        pool_processes_limit=10
    )
    
    -- 开始第「1」次循环第「1」代挖掘 --
    
    去重前的个体数10
    去重后的个体数10
    
    每代的平均适应度:[3.4096430239905153]
    因子sum(correlation(turn_0, high_0, 9), 3)在训练集适应度值为6.310481979551782
    因子shift(ts_min(low_0, 9), constant(3))在训练集适应度值为0.140416160024857
    因子rank(rank(return_0))在训练集适应度值为18.548475050098798
    因子add(open_0, open_0)在训练集适应度值为1.9513986668092793
    因子rank(return_0)在训练集适应度值为18.548475050098798
    因子product(turn_0, 10)在训练集适应度值为3.4264508104830806
    因子ta_sma(open_0, 2)在训练集适应度值为1.6741345626553934
    因子sub(ts_max(low_0, 10), div(high_0, turn_0))在训练集适应度值为0.8527036854812011
    因子log(open_0)在训练集适应度值为2.996697032985282
    因子ts_argmin(ts_argmax(close_0, 6), constant(2))在训练集适应度值为-11.637948686201309
    
    因子sum(correlation(turn_0, high_0, 9), 3)在测试集适应度值为13.247008748096649
    因子rank(rank(return_0))在测试集适应度值为20.10745431252832
    因子rank(return_0)在测试集适应度值为20.10745431252832
    因子product(turn_0, 10)在测试集适应度值为3.9495198315135758
    因子log(open_0)在测试集适应度值为3.385025032794358
    
    pass:5, record:10, population: 5
    
    下一代挖掘的个体数:10
    
    -- 开始第「1」次循环第「2」代挖掘 --
    
    去重前的个体数10
    去重后的个体数9
    
    每代的平均适应度:[3.4096430239905153, 1.0642603811719904]
    因子sum(covariance(turn_0, return_0, 9), 3)在训练集适应度值为10.685030795911299
    因子close_0在训练集适应度值为2.00781685076183
    因子min(ts_min(open_0, 6), low_0)在训练集适应度值为0.6493639801409912
    因子mul(turn_0, low_0)在训练集适应度值为5.538666963658825
    因子ts_min(close_0, 9)在训练集适应度值为0.4835494028468293
    因子rank(return_0)在训练集适应度值为-1.9227668174485841
    因子sum(turn_0, 3)在训练集适应度值为5.517185945257751
    因子sub(open_0, ts_argmin(low_0, 4))在训练集适应度值为1.673188404975073
    因子ts_rank(open_0, 7)在训练集适应度值为6.200496440115069
    
    因子sum(covariance(turn_0, return_0, 9), 3)在测试集适应度值为13.368608096005152
    因子close_0在测试集适应度值为0.8744108341181166
    因子mul(turn_0, low_0)在测试集适应度值为13.193938128833839
    因子sum(turn_0, 3)在测试集适应度值为9.087290635820452
    因子ts_rank(open_0, 7)在测试集适应度值为4.978111398912166
    
    pass:5, record:9, population: 5
    
    下一代挖掘的个体数:10
    
    -- 开始第「1」次循环第「3」代挖掘 --
    
    去重前的个体数10
    去重后的个体数7
    
    每代的平均适应度:[3.4096430239905153, 1.0642603811719904, 2.5630107849997565]
    因子sum(covariance(turn_0, return_0, 9), 9)在训练集适应度值为-2.124111546080266
    因子sum(close_0, 3)在训练集适应度值为1.7202293637946655
    因子mul(ts_min(std(open_0, 3), constant(1)), low_0)在训练集适应度值为6.468297500541676
    因子sum(return_0, 3)在训练集适应度值为15.50835508512944
    因子sum(turn_0, 3)在训练集适应度值为4.92184744208693
    因子mul(return_0, low_0)在训练集适应度值为2.8263082258389223
    因子mul(normalize(ta_sma(close_0, 1)), low_0)在训练集适应度值为0.7377957713617624
    
    因子mul(ts_min(std(open_0, 3), constant(1)), low_0)在测试集适应度值为5.834494660281935
    因子sum(return_0, 3)在测试集适应度值为14.524900991273437
    因子sum(turn_0, 3)在测试集适应度值为7.260887159873579
    因子mul(return_0, low_0)在测试集适应度值为2.1719676569843673
    
    pass:4, record:7, population: 4
    
    下一代挖掘的个体数:10
    
    In [ ]: