复制链接
克隆策略

    {"description":"实验创建于2022/2/16","graph":{"edges":[{"to_node_id":"-127:instruments","from_node_id":"-114:data"},{"to_node_id":"-127:features","from_node_id":"-122:data"},{"to_node_id":"-134:features","from_node_id":"-122:data"},{"to_node_id":"-134:input_data","from_node_id":"-127:data"},{"to_node_id":"-143:input_data","from_node_id":"-134:data"}],"nodes":[{"node_id":"-114","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2022-02-07","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-02-15","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":"-114"}],"output_ports":[{"name":"data","node_id":"-114"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-122","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"#当天涨幅\nzhangf=(close_0-open_0)/open_0\nzhangf_max5=ts_max(zhangf,5)\n#获取最近5天,涨幅大于7%,当天的开盘价(只用考虑最近5天只有1个涨幅大于7个点的情况)\n#请问这个因子如何编写\n\n#获取最近5天,涨幅大于7%,前一天的盘价(只用考虑最近5天只有1个涨幅大于7个点的情况)\n#请问这个因子如何编写\n\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-122"}],"output_ports":[{"name":"data","node_id":"-122"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-127","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":"-127"},{"name":"features","node_id":"-127"}],"output_ports":[{"name":"data","node_id":"-127"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-134","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":"-134"},{"name":"features","node_id":"-134"}],"output_ports":[{"name":"data","node_id":"-134"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-143","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"zhangf_max5>0.07","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-143"}],"output_ports":[{"name":"data","node_id":"-143"},{"name":"left_data","node_id":"-143"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-114' Position='45.125,65,200,200'/><node_position Node='-122' Position='375.402587890625,64,200,200'/><node_position Node='-127' Position='230.125,196,200,200'/><node_position Node='-134' Position='225.125,336,200,200'/><node_position Node='-143' Position='227.125,430.27764892578125,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [2]:
    # 本代码由可视化策略环境自动生成 2022年2月16日 10:39
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.instruments.v2(
        start_date='2022-02-07',
        end_date='2022-02-15',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.input_features.v1(
        features="""#当天涨幅
    zhangf=(close_0-open_0)/open_0
    zhangf_max5=ts_max(zhangf,5)
    #获取最近5天,涨幅大于7%,当天的开盘价(只用考虑最近5天只有1个涨幅大于7个点的情况)
    #请问这个因子如何编写
    
    #获取最近5天,涨幅大于7%,前一天的盘价(只用考虑最近5天只有1个涨幅大于7个点的情况)
    #请问这个因子如何编写
    
    """
    )
    
    m3 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m2.data,
        start_date='',
        end_date='',
        before_start_days=90
    )
    
    m4 = M.derived_feature_extractor.v3(
        input_data=m3.data,
        features=m2.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m5 = M.filter.v3(
        input_data=m4.data,
        expr='zhangf_max5>0.07',
        output_left_data=False
    )