复制链接
克隆策略

    {"description":"实验创建于2021/10/23","graph":{"edges":[{"to_node_id":"-306:instruments","from_node_id":"-293:data"},{"to_node_id":"-270:instruments","from_node_id":"-293:data"},{"to_node_id":"-306:features","from_node_id":"-301:data"},{"to_node_id":"-313:features","from_node_id":"-301:data"},{"to_node_id":"-313:input_data","from_node_id":"-306:data"},{"to_node_id":"-270:feature_datas","from_node_id":"-313:data"}],"nodes":[{"node_id":"-270","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":"2","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":"long_sharpe","type":"Literal","bound_global_parameter":null},{"name":"train_fitness","value":"0.16","type":"Literal","bound_global_parameter":null},{"name":"test_fitness","value":"0.1","type":"Literal","bound_global_parameter":null},{"name":"ir_type","value":"ir","type":"Literal","bound_global_parameter":null},{"name":"cxpb","value":"1","type":"Literal","bound_global_parameter":null},{"name":"mutpb","value":"1","type":"Literal","bound_global_parameter":null},{"name":"mutspb","value":"1","type":"Literal","bound_global_parameter":null},{"name":"mutnrpb","value":"1","type":"Literal","bound_global_parameter":null},{"name":"constant","value":"1,11","type":"Literal","bound_global_parameter":null},{"name":"pool_processes_limit","value":"5","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-270"},{"name":"feature_datas","node_id":"-270"},{"name":"base_features","node_id":"-270"}],"output_ports":[{"name":"factors","node_id":"-270"}],"cacheable":false,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-293","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2018-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2018-06-20","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":"-293"}],"output_ports":[{"name":"data","node_id":"-293"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-301","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"close_0\nopen_0\nhigh_0\nlow_0 \namount_0\nturn_0 \nreturn_0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-301"}],"output_ports":[{"name":"data","node_id":"-301"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-306","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":"-306"},{"name":"features","node_id":"-306"}],"output_ports":[{"name":"data","node_id":"-306"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-313","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":"-313"},{"name":"features","node_id":"-313"}],"output_ports":[{"name":"data","node_id":"-313"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-270' Position='-128,164,200,200'/><node_position Node='-293' Position='-132,-132,200,200'/><node_position Node='-301' Position='158,-104,200,200'/><node_position Node='-306' Position='62,-3,200,200'/><node_position Node='-313' Position='47,77,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [1]:
    # 本代码由可视化策略环境自动生成 2022年3月25日 11:05
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.instruments.v2(
        start_date='2018-01-01',
        end_date='2018-06-20',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m3 = M.input_features.v1(
        features="""close_0
    open_0
    high_0
    low_0 
    amount_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=2,
        init_ind_num=10,
        ngen=3,
        fitness_func='long_sharpe',
        train_fitness=0.16,
        test_fitness=0.1,
        ir_type='ir',
        cxpb=1,
        mutpb=1,
        mutspb=1,
        mutnrpb=1,
        constant='1,11',
        pool_processes_limit=5,
        m_cached=False
    )
    
    -- 开始第「1」次循环第「1」代挖掘 --
    
    去重前的个体数10
    去重后的个体数10
    
    每代的平均适应度:[-0.006875693458044244]
    因子product(shift(low_0, 8), constant(3))在训练集适应度值为-0.017752981790064036
    因子covariance(normalize(turn_0), div(open_0, amount_0), constant(6))在训练集适应度值为0.009529101961225417
    因子sign(max(amount_0, close_0))在训练集适应度值为nan
    因子min(ts_rank(amount_0, 3), sign(close_0))在训练集适应度值为0.08694558158117943
    因子sign(decay_linear(return_0, 4))在训练集适应度值为nan
    因子normalize(decay_linear(low_0, 1))在训练集适应度值为-0.003493811576792751
    因子mul(normalize(close_0), ts_argmin(high_0, 9))在训练集适应度值为0.01408324714132998
    因子abs(high_0)在训练集适应度值为0.0006081115264991699
    因子sign(ts_max(low_0, 7))在训练集适应度值为nan
    因子decay_linear(log(turn_0), constant(8))在训练集适应度值为0.019892898337229282
    
    pass:0, record:10, population: 10
    
    下一代挖掘的个体数:10
    
    -- 开始第「1」次循环第「2」代挖掘 --
    
    去重前的个体数10
    去重后的个体数10
    
    每代的平均适应度:[-0.006875693458044244, 0.022428981074263134]
    因子sign(open_0)在训练集适应度值为nan
    因子mul(abs(abs(turn_0)), high_0)在训练集适应度值为0.06018314691775823
    因子mul(normalize(close_0), amount_0)在训练集适应度值为-0.007812449768944156
    因子covariance(open_0, div(open_0, high_0), constant(constant(9)))在训练集适应度值为0.024711328096800045
    因子min(open_0, close_0)在训练集适应度值为-0.0024160251195927806
    因子decay_linear(turn_0, constant(2))在训练集适应度值为0.031049625076551318
    因子sign(max(amount_0, abs(close_0)))在训练集适应度值为nan
    因子decay_linear(return_0, 3)在训练集适应度值为0.25907700814809687
    因子amount_0在训练集适应度值为0.047167376076344227
    因子decay_linear(ts_min(close_0, constant(2)), constant(8))在训练集适应度值为-0.010614202117425276
    
    因子decay_linear(return_0, 3)在测试集适应度值为0.18945887993743818
    
    pass:1, record:10, population: 1
    
    下一代挖掘的个体数:10
    
    -- 开始第「1」次循环第「3」代挖掘 --
    
    去重前的个体数10
    去重后的个体数10
    
    每代的平均适应度:[-0.006875693458044244, 0.022428981074263134, -0.004389878882821891]
    因子decay_linear(close_0, 5)在训练集适应度值为-0.010665659319708889
    因子decay_linear(abs(low_0), 3)在训练集适应度值为-0.008654739007919595
    因子mul(close_0, open_0)在训练集适应度值为-0.0013032269062791969
    因子mul(return_0, low_0)在训练集适应度值为0.0003410151085141769
    因子normalize(turn_0)在训练集适应度值为0.014094057689714131
    因子decay_linear(return_0, constant(5))在训练集适应度值为-0.09408571136273775
    因子return_0在训练集适应度值为0.16129315794655316
    因子max(low_0, open_0)在训练集适应度值为-0.006095033586424557
    因子decay_linear(close_0, 1)在训练集适应度值为-0.0017732451217406138
    因子decay_linear(return_0, 7)在训练集适应度值为-0.04578485505174979
    
    因子return_0在测试集适应度值为0.08957678893297398
    
    pass:1, record:10, population: 1
    
    下一代挖掘的个体数:10
    
    -- 开始第「2」次循环第「1」代挖掘 --
    
    去重前的个体数10
    去重后的个体数10
    
    每代的平均适应度:[-0.012469807994392887]
    因子product(ts_argmin(low_0, 6), constant(8))在训练集适应度值为-0.024062241479612084
    因子max(return_0, low_0)在训练集适应度值为-0.006470801713207227
    因子ts_min(ts_argmax(close_0, 6), constant(6))在训练集适应度值为0.023569149060509508
    因子ta_sma(amount_0, 6)在训练集适应度值为-0.04254277454511843
    因子product(high_0, 10)在训练集适应度值为-0.0050883182853989
    因子min(amount_0, high_0)在训练集适应度值为-0.0027967328994834336
    因子log(turn_0)在训练集适应度值为0.013180261632744886
    因子log(ts_argmax(low_0, 3))在训练集适应度值为-0.052243464775969924
    因子product(low_0, 2)在训练集适应度值为-0.006814586442341134
    因子log(close_0)在训练集适应度值为0.0030140296714110913
    
    pass:0, record:10, population: 10
    
    下一代挖掘的个体数:10
    
    -- 开始第「2」次循环第「2」代挖掘 --
    
    去重前的个体数10
    去重后的个体数8
    
    每代的平均适应度:[-0.012469807994392887, -0.004199894657839339]
    因子open_0在训练集适应度值为-0.006095033586424557
    因子log(turn_0)在训练集适应度值为0.013180261632744886
    因子min(low_0, close_0)在训练集适应度值为-0.006470801713207227
    因子product(ts_argmax(turn_0, 6), 10)在训练集适应度值为-0.003295029654757694
    因子max(add(high_0, high_0), close_0)在训练集适应度值为-0.0027967328994834336
    因子ts_min(ts_argmax(close_0, 6), constant(7))在训练集适应度值为0.03322764685622302
    因子min(open_0, low_0)在训练集适应度值为-0.006470801713207227
    因子ts_min(ts_argmax(amount_0, 6), constant(1))在训练集适应度值为-0.013688986977386073
    
    pass:0, record:8, population: 8
    
    下一代挖掘的个体数:10
    
    -- 开始第「2」次循环第「3」代挖掘 --
    
    去重前的个体数10
    去重后的个体数9
    
    每代的平均适应度:[-0.012469807994392887, -0.004199894657839339, -0.00016547893699090825]
    因子close_0在训练集适应度值为-0.004403887756007454
    因子normalize(open_0)在训练集适应度值为-0.006095033586424557
    因子log(return_0)在训练集适应度值为0.17165659813782627
    因子normalize(high_0)在训练集适应度值为-0.0027967328994834336
    因子min(amount_0, sub(high_0, amount_0))在训练集适应度值为-0.012034958667533478
    因子ts_max(std(turn_0, 10), 10)在训练集适应度值为-0.020993354725864555
    因子product(turn_0, 1)在训练集适应度值为0.014094057689714131
    因子product(ts_argmax(turn_0, 5), 8)在训练集适应度值为0.006501821707832546
    因子min(turn_0, high_0)在训练集适应度值为0.014094057689714131
    
    因子log(return_0)在测试集适应度值为0.09761939526497854
    
    pass:1, record:9, population: 1
    
    下一代挖掘的个体数:10
    
    In [13]:
    m1.factors.read()
    
    Out[13]:
    {}