复制链接
克隆策略

    {"description":"实验创建于2022/9/30","graph":{"edges":[{"to_node_id":"-66:input_1","from_node_id":"-1893:data"},{"to_node_id":"-1913:features","from_node_id":"-1901:data"},{"to_node_id":"-465:feature_datas","from_node_id":"-1913:data"},{"to_node_id":"-1913:input_data","from_node_id":"-57:data"},{"to_node_id":"-57:instruments","from_node_id":"-66:data_2"},{"to_node_id":"-465:instruments","from_node_id":"-66:data_2"}],"nodes":[{"node_id":"-1893","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2017-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-11-30","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_FUTURE","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":"close\nopen\nhigh\nlow\namount\nvolume\nopen_intl","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":"-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_id":"-57","module_id":"BigQuantSpace.use_datasource.use_datasource-v2","parameters":[{"name":"datasource_id","value":"bar1d_CN_FUTURE","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":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-57"},{"name":"features","node_id":"-57"}],"output_ports":[{"name":"data","node_id":"-57"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-66","module_id":"BigQuantSpace.futures_forward_extractor.futures_forward_extractor-v11","parameters":[{"name":"before_days","value":"0","type":"Literal","bound_global_parameter":null},{"name":"product_filter","value":"[\"BB\", \"LR\", \"JR\", \"FB\", \"RI\",\n \"WR\", \"RS\", \"PM\", \"WT\", \"TC\",\n \"RO\", \"ER\", \"WS\", \"B\", \"FU\",\n \"LU\", \"SC\", \"L\", \"ME\", \"WH\"]","type":"Literal","bound_global_parameter":null},{"name":"if_CFX","value":"True","type":"Literal","bound_global_parameter":null},{"name":"set_enable_trade","value":"False","type":"Literal","bound_global_parameter":null},{"name":"output_type","value":"主力连续","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-66"}],"output_ports":[{"name":"data_1","node_id":"-66"},{"name":"data_2","node_id":"-66"},{"name":"data_3","node_id":"-66"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-465","module_id":"BigQuantSpace.genetic_algorithm.genetic_algorithm-v1","parameters":[{"name":"market","value":"CN_FUTURE","type":"Literal","bound_global_parameter":null},{"name":"freq","value":"daily","type":"Literal","bound_global_parameter":null},{"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":"close","type":"Literal","bound_global_parameter":null},{"name":"rebalance_period","value":"5","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":"100","type":"Literal","bound_global_parameter":null},{"name":"init_ind_num","value":"20","type":"Literal","bound_global_parameter":null},{"name":"ngen","value":"5","type":"Literal","bound_global_parameter":null},{"name":"fitness_func","value":"future_longshort_sharpe","type":"Literal","bound_global_parameter":null},{"name":"train_fitness","value":"1.5","type":"Literal","bound_global_parameter":null},{"name":"test_fitness","value":"1.2","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":"-465"},{"name":"feature_datas","node_id":"-465"},{"name":"base_features","node_id":"-465"}],"output_ports":[{"name":"factors","node_id":"-465"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-1893' Position='259,47,200,200'/><node_position Node='-1901' Position='657,133,200,200'/><node_position Node='-1913' Position='440,367,200,200'/><node_position Node='-57' Position='441,280,200,200'/><node_position Node='-66' Position='259,129,200,200'/><node_position Node='-465' Position='438,463,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [ ]:
    # 本代码由可视化策略环境自动生成 2022年12月29日 11:28
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.instruments.v2(
        start_date='2017-01-01',
        end_date='2022-11-30',
        market='CN_FUTURE',
        instrument_list='',
        max_count=0
    )
    
    m4 = M.futures_forward_extractor.v11(
        input_1=m2.data,
        before_days=0,
        product_filter=["BB", "LR", "JR", "FB", "RI",
     "WR", "RS", "PM", "WT", "TC",
     "RO", "ER", "WS", "B", "FU",
     "LU", "SC", "L", "ME", "WH"],
        if_CFX=True,
        set_enable_trade=False,
        output_type='主力连续'
    )
    
    m6 = M.use_datasource.v2(
        instruments=m4.data_2,
        datasource_id='bar1d_CN_FUTURE',
        start_date='',
        end_date='',
        before_start_days=0
    )
    
    m3 = M.input_features.v1(
        features="""close
    open
    high
    low
    amount
    volume
    open_intl"""
    )
    
    m5 = M.derived_feature_extractor.v3(
        input_data=m6.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m7 = M.genetic_algorithm.v1(
        instruments=m4.data_2,
        feature_datas=m5.data,
        market='CN_FUTURE',
        freq='daily',
        all_start_date='',
        all_end_date='',
        short_date_range_ratio=0.7,
        return_field='close',
        rebalance_period=5,
        train_test_ratio=0.75,
        train_validate_ratio=0.75,
        mtime=100,
        init_ind_num=20,
        ngen=5,
        fitness_func='future_longshort_sharpe',
        train_fitness=1.5,
        test_fitness=1.2,
        ir_type='ir',
        cxpb=0.5,
        mutpb=0.3,
        mutspb=0.3,
        mutnrpb=0.3,
        constant='1,11',
        pool_processes_limit=10
    )
    
    In [ ]:
    m7.factors.read()
    
    In [ ]: