复制链接
克隆策略
In [42]:
# df = m4.data.read()
# # df = df[df.con==1]
# df = df[df.instrument=='689009.SHA']
# df
Out[42]:
close_0 date instrument ta_ema(close_0, 5).shift(1) ta_ema(close_0, 10).shift(1) ta_ema(close_0, 5) ta_ema(close_0, 10) con total_count
89980 69.000000 2020-12-02 689009.SHA 55.472282 55.395569 NaN NaN 0 NaN
89981 64.099998 2020-12-03 689009.SHA NaN NaN NaN NaN 0 NaN
89982 67.059998 2020-12-04 689009.SHA NaN NaN NaN NaN 0 NaN
89983 71.300003 2020-12-07 689009.SHA NaN NaN NaN NaN 0 NaN
89984 70.500000 2020-12-08 689009.SHA NaN NaN 68.391998 NaN 0 NaN
89985 68.750000 2020-12-09 689009.SHA 68.391998 NaN 68.511330 NaN 0 NaN
89986 65.320000 2020-12-10 689009.SHA 68.511330 NaN 67.447556 NaN 0 NaN
89987 67.849998 2020-12-11 689009.SHA 67.447556 NaN 67.581703 NaN 0 NaN
89988 69.949997 2020-12-14 689009.SHA 67.581703 NaN 68.371132 NaN 0 NaN
89989 68.519997 2020-12-15 689009.SHA 68.371132 NaN 68.420753 68.235001 0 NaN
89990 70.550003 2020-12-16 689009.SHA 68.420753 68.235001 69.130501 68.655907 0 NaN
89991 73.690002 2020-12-17 689009.SHA 69.130501 68.655907 70.650337 69.571198 0 NaN
89992 71.980003 2020-12-18 689009.SHA 70.650337 69.571198 71.093559 70.009163 0 NaN
89993 75.500000 2020-12-22 689009.SHA 71.093559 70.009163 72.562370 71.007500 0 NaN
89994 80.099998 2020-12-23 689009.SHA 72.562370 71.007500 75.074913 72.660683 0 NaN
89995 73.099998 2020-12-24 689009.SHA 75.074913 72.660683 74.416611 72.740555 0 NaN
89996 75.099998 2020-12-25 689009.SHA 74.416611 72.740555 74.644409 73.169548 0 NaN
89997 80.099998 2020-12-28 689009.SHA 74.644409 73.169548 76.462936 74.429626 0 NaN
89998 77.459999 2020-12-29 689009.SHA 76.462936 74.429626 76.795288 74.980606 0 NaN
89999 80.910004 2020-12-30 689009.SHA 76.795288 74.980606 78.166862 76.058678 0 0.0
90000 85.820000 2020-12-31 689009.SHA 78.166862 76.058678 80.717911 77.833466 0 0.0
176746 88.199997 2021-01-04 689009.SHA 57.181065 58.011189 83.211937 79.718285 1 1.0
176747 87.400002 2021-01-05 689009.SHA 83.211937 79.718285 84.607956 81.114960 0 1.0
176748 80.989998 2021-01-06 689009.SHA 84.607956 81.114960 83.401970 81.092239 0 1.0
176749 80.290001 2021-01-07 689009.SHA 83.401970 81.092239 82.364647 80.946381 0 1.0
176750 77.699997 2021-01-08 689009.SHA 82.364647 80.946381 80.809761 80.356125 0 1.0
176751 78.250000 2021-01-11 689009.SHA 80.809761 80.356125 79.956512 79.973198 0 1.0
176752 83.400002 2021-01-12 689009.SHA 79.956512 79.973198 81.104340 80.596252 1 2.0
176753 83.730003 2021-01-13 689009.SHA 81.104340 80.596252 81.979561 81.166023 0 2.0
176754 86.000000 2021-01-14 689009.SHA 81.979561 81.166023 83.319710 82.044930 0 2.0
176755 82.809998 2021-01-15 689009.SHA 83.319710 82.044930 83.149803 82.184036 0 2.0
176756 80.820000 2021-01-18 689009.SHA 83.149803 82.184036 82.373199 81.936028 0 2.0
176757 78.809998 2021-01-19 689009.SHA 82.373199 81.936028 81.185471 81.367661 0 2.0
176758 85.019997 2021-01-20 689009.SHA 81.185471 81.367661 82.463646 82.031723 1 3.0
176759 88.980003 2021-01-21 689009.SHA 82.463646 82.031723 84.635765 83.295044 0 3.0
176760 99.099998 2021-01-22 689009.SHA 84.635765 83.295044 89.457176 86.168671 0 3.0
176761 101.800003 2021-01-25 689009.SHA 89.457176 86.168671 93.571449 89.010735 0 3.0
176762 108.300003 2021-01-26 689009.SHA 93.571449 89.010735 98.480972 92.517876 0 3.0
176763 108.879997 2021-01-27 689009.SHA 98.480972 92.517876 101.947311 95.492805 0 3.0
176764 97.699997 2021-01-28 689009.SHA 101.947311 95.492805 100.531540 95.894112 0 3.0
176765 100.279999 2021-01-29 689009.SHA 100.531540 95.894112 100.447693 96.691544 0 3.0
176766 96.800003 2021-02-01 689009.SHA 100.447693 96.691544 99.231796 96.711266 0 2.0

    {"description":"实验创建于3/9/2022","graph":{"edges":[{"to_node_id":"-537:features","from_node_id":"-524:data"},{"to_node_id":"-544:features","from_node_id":"-524:data"},{"to_node_id":"-537:instruments","from_node_id":"-528:data"},{"to_node_id":"-544:input_data","from_node_id":"-537:data"}],"nodes":[{"node_id":"-524","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\n\nta_ema(close, timeperiod=5)>ta_ema(close, timeperiod=169)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-524"}],"output_ports":[{"name":"data","node_id":"-524"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-528","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2023-04-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2023-04-17","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":"-528"}],"output_ports":[{"name":"data","node_id":"-528"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-537","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":"30","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-537"},{"name":"features","node_id":"-537"}],"output_ports":[{"name":"data","node_id":"-537"}],"cacheable":false,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-544","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":"-544"},{"name":"features","node_id":"-544"}],"output_ports":[{"name":"data","node_id":"-544"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-524' Position='325,127.99832153320312,200,200'/><node_position Node='-528' Position='5,121,200,200'/><node_position Node='-537' Position='138.02532958984375,249.88345336914062,200,200'/><node_position Node='-544' Position='133.93917846679688,384.8411865234375,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [55]:
    # 本代码由可视化策略环境自动生成 2023年4月17日 23:09
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    
    ta_ema(close, timeperiod=5)>ta_ema(close, timeperiod=169)"""
    )
    
    m2 = M.instruments.v2(
        start_date='2023-04-01',
        end_date='2023-04-17',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m3 = M.general_feature_extractor.v7(
        instruments=m2.data,
        features=m1.data,
        start_date='',
        end_date='',
        before_start_days=30,
        m_cached=False
    )
    
    m4 = M.derived_feature_extractor.v3(
        input_data=m3.data,
        features=m1.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )