复制链接
克隆策略

    {"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_return","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":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":"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":"2016-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-07-22","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":"amount_0\nturn_0 \nmf_net_amount_0\nswing_volatility_60_0\nmf_net_amount_xl_0\nprice_limit_status_20","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='-125.36787223815918,164,200,200'/><node_position Node='-293' Position='-132,-132,200,200'/><node_position Node='-301' Position='156,-106,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 [2]:
    # 本代码由可视化策略环境自动生成 2022年7月24日 18:28
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.instruments.v2(
        start_date='2016-01-01',
        end_date='2022-07-22',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m3 = M.input_features.v1(
        features="""amount_0
    turn_0 
    mf_net_amount_0
    swing_volatility_60_0
    mf_net_amount_xl_0
    price_limit_status_20"""
    )
    
    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_return',
        train_fitness=0.16,
        test_fitness=0.1,
        ir_type='ir',
        cxpb=0.5,
        mutpb=0.3,
        mutspb=0.3,
        mutnrpb=0.3,
        constant='1,11',
        pool_processes_limit=5,
        m_cached=False
    )
    
    -- 开始第「1」次循环第「1」代挖掘 --
    
    去重前的个体数10
    去重后的个体数10
    
    ---------------------------------------------------------------------------
    TerminatedWorkerError                     Traceback (most recent call last)
    <ipython-input-2-840b41fe4f1e> in <module>
         38 )
         39 
    ---> 40 m1 = M.genetic_algorithm.v1(
         41     instruments=m2.data,
         42     feature_datas=m5.data,
    
    TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker.
    
    The exit codes of the workers are {SIGKILL(-9)}
    In [ ]:
    m1.factors.read()