复制链接
克隆策略

    {"description":"实验创建于2021/12/9","graph":{"edges":[{"to_node_id":"-119:input_ds","from_node_id":"-105:data"},{"to_node_id":"-127:input_data","from_node_id":"-119:sorted_data"},{"to_node_id":"-133:input_data","from_node_id":"-127:data"},{"to_node_id":"-137:input_data","from_node_id":"-133:data"}],"nodes":[{"node_id":"-105","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"2021-11-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-12-08","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-105"},{"name":"features","node_id":"-105"}],"output_ports":[{"name":"data","node_id":"-105"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-119","module_id":"BigQuantSpace.sort.sort-v5","parameters":[{"name":"sort_by","value":"high","type":"Literal","bound_global_parameter":null},{"name":"group_by","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"keep_columns","value":"--","type":"Literal","bound_global_parameter":null},{"name":"ascending","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-119"},{"name":"sort_by_ds","node_id":"-119"}],"output_ports":[{"name":"sorted_data","node_id":"-119"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-127","module_id":"BigQuantSpace.winsorize.winsorize-v6","parameters":[{"name":"columns_input","value":"open\nvolume","type":"Literal","bound_global_parameter":null},{"name":"median_deviate","value":"5","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-127"},{"name":"features","node_id":"-127"}],"output_ports":[{"name":"data","node_id":"-127"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-133","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-133"},{"name":"features","node_id":"-133"}],"output_ports":[{"name":"data","node_id":"-133"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-137","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"adjust_factor>1000","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":"-137"}],"output_ports":[{"name":"data","node_id":"-137"},{"name":"left_data","node_id":"-137"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-105' Position='517.401611328125,108.55532836914062,200,200'/><node_position Node='-119' Position='574.0031127929688,228.74737548828125,200,200'/><node_position Node='-127' Position='559.1767578125,301.02598571777344,200,200'/><node_position Node='-133' Position='592.5361328125,386.2777099609375,200,200'/><node_position Node='-137' Position='596.3621215820312,467.6129150390625,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [2]:
    # 本代码由可视化策略环境自动生成 2021年12月10日 18:33
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m2 = M.use_datasource.v1(
        datasource_id='bar1d_CN_STOCK_A',
        start_date='2021-11-01',
        end_date='2021-12-08'
    )
    
    m4 = M.sort.v5(
        input_ds=m2.data,
        sort_by='high',
        group_by='date,instrument',
        keep_columns='--',
        ascending=True
    )
    
    m1 = M.winsorize.v6(
        input_data=m4.sorted_data,
        columns_input="""open
    volume""",
        median_deviate=5
    )
    
    m3 = M.dropnan.v2(
        input_data=m1.data
    )
    
    m5 = M.filter.v3(
        input_data=m3.data,
        expr='adjust_factor>1000',
        output_left_data=False
    )
    
    In [3]:
    m1.data.read()
    
    Out[3]:
    turn adjust_factor instrument date open volume low deal_number close high amount
    0 0.433629 111.921967 000001.SZA 2021-11-01 2163.451660 84149020.0 2127.636475 101655.0 2170.166992 2208.220459 1.626762e+09
    1 1.120120 162.737427 000002.SZA 2021-11-01 2956.938965 108848243.0 2924.391602 114472.0 2960.193848 2994.368652 1.975555e+09
    2 1.382193 4.063862 000004.SZA 2021-11-01 68.191605 1607916.0 67.256920 3021.0 68.435432 68.841820 2.697266e+07
    3 0.642169 9.267603 000005.SZA 2021-11-01 20.203375 6793800.0 19.925346 1136.0 20.018023 20.203375 1.471386e+07
    4 0.258708 37.877560 000006.SZA 2021-11-01 158.328201 3492545.0 156.813095 2521.0 157.570648 158.706970 1.454379e+07
    ... ... ... ... ... ... ... ... ... ... ... ...
    128767 0.228885 1.598642 871396.BJA 2021-12-08 19.423500 60309.0 19.423500 0.0 19.791187 19.791187 7.406600e+05
    128768 0.426353 1.068737 871553.BJA 2021-12-08 5.589495 266868.0 5.589495 0.0 5.600182 5.664306 1.402256e+06
    128769 0.415484 1.000000 871642.BJA 2021-12-08 16.100000 137656.0 15.600000 0.0 15.970000 16.120001 2.184446e+06
    128770 3.128054 1.000000 871981.BJA 2021-12-08 46.029999 397580.0 45.599998 0.0 45.990002 46.849998 1.828369e+07
    128771 1.609585 1.013216 872925.BJA 2021-12-08 22.077976 238100.0 21.986788 0.0 22.047581 22.554188 5.200673e+06

    128772 rows × 11 columns