复制链接
克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-215:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:data"},{"to_node_id":"-231:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-215:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-222:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-2015:features_ds","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-3030:input_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"},{"to_node_id":"-156:options_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:predictions"},{"to_node_id":"-231:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-156:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-222:input_data","from_node_id":"-215:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","from_node_id":"-222:data"},{"to_node_id":"-238:input_data","from_node_id":"-231:data"},{"to_node_id":"-122:input_data","from_node_id":"-238:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:model","from_node_id":"-834:model"},{"to_node_id":"-834:training_ds","from_node_id":"-848:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:data","from_node_id":"-852:data"},{"to_node_id":"-852:input_data","from_node_id":"-122:data"},{"to_node_id":"-3030:features","from_node_id":"-2015:data"},{"to_node_id":"-3979:input_1","from_node_id":"-2015:data"},{"to_node_id":"-848:input_data","from_node_id":"-3030:data"},{"to_node_id":"-4524:input_1","from_node_id":"-1157:data"},{"to_node_id":"-834:features","from_node_id":"-3979:data_1"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2020-06-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2020-12-01","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":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15","module_id":"BigQuantSpace.advanced_auto_labeler.advanced_auto_labeler-v2","parameters":[{"name":"label_expr","value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/develop/datasource/deprecated/history_data.html\n# 添加benchmark_前缀,可使用对应的benchmark数据\n# 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/develop/bigexpr/usage.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\nshift(close, -5) / shift(open, -1)\n\n# 极值处理:用1%和99%分位的值做clip\nclip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))\n\n# 将分数映射到分类,这里使用20个分类\nall_wbins(label, 20)\n\n# 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)\nwhere(shift(high, -1) == shift(low, -1), NaN, label)\n","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":"benchmark","value":"000300.SHA","type":"Literal","bound_global_parameter":null},{"name":"drop_na_label","value":"True","type":"Literal","bound_global_parameter":null},{"name":"cast_label_int","value":"True","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\ncond1=sum(ta_macd_dif(close_0,2,4,4),5)>sum(ta_macd_dea(close_0,2,4,4),5)\ncond2=close_0>mean(close_0, 25)\ncond3=sum(ta_macd_dea(close_0,2,4,4),5)>0.2","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"how","value":"inner","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"},{"name":"data2","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","module_id":"BigQuantSpace.stock_ranker_predict.stock_ranker_predict-v5","parameters":[{"name":"m_lazy_run","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"model","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"},{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"}],"output_ports":[{"name":"predictions","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"},{"name":"m_lazy_run","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"}],"cacheable":true,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2020-01-01","type":"Literal","bound_global_parameter":"交易日期"},{"name":"end_date","value":"2020-02-01","type":"Literal","bound_global_parameter":"交易日期"},{"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":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"cacheable":true,"seq_num":9,"comment":"预测数据,用于回测和模拟","comment_collapsed":false},{"node_id":"-215","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":"60","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-215"},{"name":"features","node_id":"-215"}],"output_ports":[{"name":"data","node_id":"-215"}],"cacheable":true,"seq_num":15,"comment":"","comment_collapsed":true},{"node_id":"-222","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":"-222"},{"name":"features","node_id":"-222"}],"output_ports":[{"name":"data","node_id":"-222"}],"cacheable":true,"seq_num":16,"comment":"","comment_collapsed":true},{"node_id":"-231","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":"60","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-231"},{"name":"features","node_id":"-231"}],"output_ports":[{"name":"data","node_id":"-231"}],"cacheable":true,"seq_num":17,"comment":"","comment_collapsed":true},{"node_id":"-238","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":"-238"},{"name":"features","node_id":"-238"}],"output_ports":[{"name":"data","node_id":"-238"}],"cacheable":true,"seq_num":18,"comment":"","comment_collapsed":true},{"node_id":"-834","module_id":"BigQuantSpace.stock_ranker_train.stock_ranker_train-v6","parameters":[{"name":"learning_algorithm","value":"排序","type":"Literal","bound_global_parameter":null},{"name":"number_of_leaves","value":30,"type":"Literal","bound_global_parameter":null},{"name":"minimum_docs_per_leaf","value":1000,"type":"Literal","bound_global_parameter":null},{"name":"number_of_trees","value":20,"type":"Literal","bound_global_parameter":null},{"name":"learning_rate","value":0.1,"type":"Literal","bound_global_parameter":null},{"name":"max_bins","value":1023,"type":"Literal","bound_global_parameter":null},{"name":"feature_fraction","value":1,"type":"Literal","bound_global_parameter":null},{"name":"data_row_fraction","value":1,"type":"Literal","bound_global_parameter":null},{"name":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"ndcg_discount_base","value":1,"type":"Literal","bound_global_parameter":null},{"name":"m_lazy_run","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"training_ds","node_id":"-834"},{"name":"features","node_id":"-834"},{"name":"test_ds","node_id":"-834"},{"name":"base_model","node_id":"-834"}],"output_ports":[{"name":"model","node_id":"-834"},{"name":"feature_gains","node_id":"-834"},{"name":"m_lazy_run","node_id":"-834"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-848","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-848"},{"name":"features","node_id":"-848"}],"output_ports":[{"name":"data","node_id":"-848"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-852","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-852"},{"name":"features","node_id":"-852"}],"output_ports":[{"name":"data","node_id":"-852"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-122","module_id":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","parameters":[{"name":"index_constituent_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%8150%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%8150%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B2%AA%E6%B7%B1300%22%2C%22displayValue%22%3A%22%E6%B2%AA%E6%B7%B1300%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81500%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81500%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81800%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81800%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%81180%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%81180%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81100%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81100%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B7%B1%E8%AF%81100%22%2C%22displayValue%22%3A%22%E6%B7%B1%E8%AF%81100%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"board_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B7%B1%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22displayValue%22%3A%22%E6%B7%B1%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%88%9B%E4%B8%9A%E6%9D%BF%22%2C%22displayValue%22%3A%22%E5%88%9B%E4%B8%9A%E6%9D%BF%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%A7%91%E5%88%9B%E6%9D%BF%22%2C%22displayValue%22%3A%22%E7%A7%91%E5%88%9B%E6%9D%BF%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"industry_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%BA%A4%E9%80%9A%E8%BF%90%E8%BE%93%22%2C%22displayValue%22%3A%22%E4%BA%A4%E9%80%9A%E8%BF%90%E8%BE%93%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%BC%91%E9%97%B2%E6%9C%8D%E5%8A%A1%22%2C%22displayValue%22%3A%22%E4%BC%91%E9%97%B2%E6%9C%8D%E5%8A%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%BC%A0%E5%AA%92%2F%E4%BF%A1%E6%81%AF%E6%9C%8D%E5%8A%A1%22%2C%22displayValue%22%3A%22%E4%BC%A0%E5%AA%92%2F%E4%BF%A1%E6%81%AF%E6%9C%8D%E5%8A%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%85%AC%E7%94%A8%E4%BA%8B%E4%B8%9A%22%2C%22displayValue%22%3A%22%E5%85%AC%E7%94%A8%E4%BA%8B%E4%B8%9A%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%86%9C%E6%9E%97%E7%89%A7%E6%B8%94%22%2C%22displayValue%22%3A%22%E5%86%9C%E6%9E%97%E7%89%A7%E6%B8%94%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%8C%96%E5%B7%A5%22%2C%22displayValue%22%3A%22%E5%8C%96%E5%B7%A5%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%8C%BB%E8%8D%AF%E7%94%9F%E7%89%A9%22%2C%22displayValue%22%3A%22%E5%8C%BB%E8%8D%AF%E7%94%9F%E7%89%A9%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%95%86%E4%B8%9A%E8%B4%B8%E6%98%93%22%2C%22displayValue%22%3A%22%E5%95%86%E4%B8%9A%E8%B4%B8%E6%98%93%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%BD%E9%98%B2%E5%86%9B%E5%B7%A5%22%2C%22displayValue%22%3A%22%E5%9B%BD%E9%98%B2%E5%86%9B%E5%B7%A5%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%AE%B6%E7%94%A8%E7%94%B5%E5%99%A8%22%2C%22displayValue%22%3A%22%E5%AE%B6%E7%94%A8%E7%94%B5%E5%99%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%BB%BA%E7%AD%91%E6%9D%90%E6%96%99%2F%E5%BB%BA%E7%AD%91%E5%BB%BA%E6%9D%90%22%2C%22displayValue%22%3A%22%E5%BB%BA%E7%AD%91%E6%9D%90%E6%96%99%2F%E5%BB%BA%E7%AD%91%E5%BB%BA%E6%9D%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%BB%BA%E7%AD%91%E8%A3%85%E9%A5%B0%22%2C%22displayValue%22%3A%22%E5%BB%BA%E7%AD%91%E8%A3%85%E9%A5%B0%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%88%BF%E5%9C%B0%E4%BA%A7%22%2C%22displayValue%22%3A%22%E6%88%BF%E5%9C%B0%E4%BA%A7%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9C%89%E8%89%B2%E9%87%91%E5%B1%9E%22%2C%22displayValue%22%3A%22%E6%9C%89%E8%89%B2%E9%87%91%E5%B1%9E%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9C%BA%E6%A2%B0%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E6%9C%BA%E6%A2%B0%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B1%BD%E8%BD%A6%2F%E4%BA%A4%E8%BF%90%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E6%B1%BD%E8%BD%A6%2F%E4%BA%A4%E8%BF%90%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%94%B5%E5%AD%90%22%2C%22displayValue%22%3A%22%E7%94%B5%E5%AD%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%94%B5%E6%B0%94%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E7%94%B5%E6%B0%94%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%BA%BA%E7%BB%87%E6%9C%8D%E8%A3%85%22%2C%22displayValue%22%3A%22%E7%BA%BA%E7%BB%87%E6%9C%8D%E8%A3%85%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%BB%BC%E5%90%88%22%2C%22displayValue%22%3A%22%E7%BB%BC%E5%90%88%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%AE%A1%E7%AE%97%E6%9C%BA%22%2C%22displayValue%22%3A%22%E8%AE%A1%E7%AE%97%E6%9C%BA%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%BD%BB%E5%B7%A5%E5%88%B6%E9%80%A0%22%2C%22displayValue%22%3A%22%E8%BD%BB%E5%B7%A5%E5%88%B6%E9%80%A0%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%80%9A%E4%BF%A1%22%2C%22displayValue%22%3A%22%E9%80%9A%E4%BF%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%87%87%E6%8E%98%22%2C%22displayValue%22%3A%22%E9%87%87%E6%8E%98%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%92%A2%E9%93%81%22%2C%22displayValue%22%3A%22%E9%92%A2%E9%93%81%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%93%B6%E8%A1%8C%22%2C%22displayValue%22%3A%22%E9%93%B6%E8%A1%8C%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%9D%9E%E9%93%B6%E9%87%91%E8%9E%8D%22%2C%22displayValue%22%3A%22%E9%9D%9E%E9%93%B6%E9%87%91%E8%9E%8D%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%A3%9F%E5%93%81%E9%A5%AE%E6%96%99%22%2C%22displayValue%22%3A%22%E9%A3%9F%E5%93%81%E9%A5%AE%E6%96%99%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"st_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%AD%A3%E5%B8%B8%22%2C%22displayValue%22%3A%22%E6%AD%A3%E5%B8%B8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22ST%22%2C%22displayValue%22%3A%22ST%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22*ST%22%2C%22displayValue%22%3A%22*ST%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9A%82%E5%81%9C%E4%B8%8A%E5%B8%82%22%2C%22displayValue%22%3A%22%E6%9A%82%E5%81%9C%E4%B8%8A%E5%B8%82%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"delist_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%80%80%E5%B8%82%22%2C%22displayValue%22%3A%22%E9%80%80%E5%B8%82%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%9D%9E%E9%80%80%E5%B8%82%22%2C%22displayValue%22%3A%22%E9%9D%9E%E9%80%80%E5%B8%82%22%2C%22selected%22%3Atrue%7D%5D%7D","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":"-122"}],"output_ports":[{"name":"data","node_id":"-122"},{"name":"left_data","node_id":"-122"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-156","module_id":"BigQuantSpace.hftrade.hftrade-v2","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"initialize","value":"# 交易引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n df = DataSource(\"bar1d_index_CN_STOCK_A\").read(instruments=\"000300.HIX\",start_date=\"2020-01-01\",end_date=\"2020-02-01\")\n df[\"ma\"] = df.close.rolling(5).mean()\n df[\"signal\"] = df.apply(lambda x:1 if x.close>x.ma else 0,axis=1)\n df[\"signal\"] = df[\"signal\"].shift(1) #取昨日的收盘信号\n df=df[[\"date\",\"signal\"]]\n #信号数据\n context.signal_df = df\n #每支股票占比\n context.order_pct = 0.1\n #获取预测股票集\n context.to_buy = context.options['data'].read()\n #注册\n context.subscribe(context.instruments)\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument =0.1\n context.options['hold_days'] = 5\n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"# 交易引擎:每个单位时间开盘前调用一次。\ndef bigquant_run(context, data):\n now = data.current_dt.strftime('%Y-%m-%d')\n context.today = data.current_dt.strftime('%Y-%m-%d')\n context.signal = context.signal_df[context.signal_df.date==now][\"signal\"].iloc[0]\n context.handle_flag = 0 #由于是分钟回测,每天只需要处理一次买卖\n context.sold_stock_list = []\n context.position_check = context.get_positions()\n print('日期{} 持仓 {} -----------'.format(now, context.position_check))\n","type":"Literal","bound_global_parameter":null},{"name":"handle_tick","value":"# 交易引擎:tick数据处理函数,每个tick执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"#卖出函数\ndef sell_stock(context,data,msg):\n #获取当前所有持仓\n stock_hold_now = context.get_account_positions()\n for instr in stock_hold_now:\n if instr not in context.sold_stock_list:\n #卖出可用仓位(可能有今仓)\n position = context.get_position(instr).avail_qty\n if(position>0):\n #最新价格\n price = data.current(instr, 'close')\n context.order(instr, -position, price, order_type=OrderType.MARKET)\n context.sold_stock_list.append(instr)\n print(\"{}卖出{} {}\".format(msg,instr,position))\n\n# 交易引擎:bar数据处理函数,每个单位执行一次\ndef bigquant_run(context, data):\n \n #signal为0开盘卖\n if context.signal == 1:\n msg = context.today+\" 开盘\"\n sell_stock(context,data,msg)\n \n current_stopwin_stock = []\n current_stoploss_stock = []\n if len(context.position_check) > 0:\n #------------------------START:止赢止损模块(含建仓期)---------------\n positions_cost={e:p.cost_price for e,p in context.get_positions().items()}\n avail_positions = {e: p.avail_qty for e, p in context.get_positions().items()}\n for instrument in positions_cost.keys():\n s = context.get_position(instrument).cost_price\n stock_cost=positions_cost[instrument]\n stock_market_price=data.current(context.symbol(instrument),'price')\n if stock_market_price/stock_cost-1>=0.2 and avail_positions[instrument] != 0:\n context.order_target(instrument, 0, order_type=OrderType.MARKET)\n print('止盈成功, 止盈标的{}'.format(instrument))\n current_stopwin_stock.append(instrument)\n elif stock_market_price/stock_cost-1 <= -0.05 and avail_positions[instrument] != 0:\n context.order_target(instrument, 0, order_type=OrderType.MARKET)\n print('止损成功, 止损标的{}'.format(instrument))\n current_stoploss_stock.append(instrument)\n if len(current_stopwin_stock)>0:\n# print(context.today,'止盈股票列表',current_stopwin_stock)\n context.sold_stock_list += current_stopwin_stock\n if len(current_stoploss_stock)>0:\n# print(context.today,'止损股票列表',current_stoploss_stock)\n context.sold_stock_list += current_stoploss_stock\n #--------------------------END: 止赢止损模块--------------------------\n \n #signal为1尾盘卖\n if context.signal == 1:\n cur_date = data.current_dt\n cur_hm = cur_date.strftime('%H:%M')\n if(cur_hm==\"14:55\"):\n msg = str(cur_date)+\" 尾盘\"\n sell_stock(context,data,msg)\n \n\n #每天只处理一次\n if context.handle_flag==1:\n return\n \n #买入预测集的前5只股票\n now_data = context.to_buy[context.to_buy['date']==context.today]\n today_to_buy = []\n if not now_data.empty:\n today_to_buy = now_data.instrument[:5].to_list()\n print(context.today,\"=======早盘计划买入股票 {}\".format(today_to_buy))\n \n # 获取账户资金\n total_portfolio = context.portfolio.portfolio_value\n\n for instr in today_to_buy:\n if instr not in context.sold_stock_list:\n #最新价格\n price = data.current(instr, 'close')\n\n #计算买入此股票的数量,不要超过总资金的某个比例\n context.order_value(instr, total_portfolio*context.order_pct, price, order_type=OrderType.MARKET)\n print(\"买入{}\".format(instr))\n \n context.handle_flag = 1\n","type":"Literal","bound_global_parameter":null},{"name":"handle_trade","value":"# 交易引擎:成交回报处理函数,每个成交发生时执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"handle_order","value":"# 交易引擎:委托回报处理函数,每个委托变化时执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"after_trading","value":"# 交易引擎:盘后处理函数,每日盘后执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"100000","type":"Literal","bound_global_parameter":null},{"name":"frequency","value":"minute","type":"Literal","bound_global_parameter":null},{"name":"price_type","value":"真实价格","type":"Literal","bound_global_parameter":null},{"name":"product_type","value":"股票","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":"0","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.HIX","type":"Literal","bound_global_parameter":null},{"name":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"disable_cache","value":"False","type":"Literal","bound_global_parameter":null},{"name":"show_debug_info","value":"False","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-156"},{"name":"options_data","node_id":"-156"},{"name":"history_ds","node_id":"-156"},{"name":"benchmark_ds","node_id":"-156"}],"output_ports":[{"name":"raw_perf","node_id":"-156"}],"cacheable":false,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-2015","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nbm_close = cal_bm_close()\nstockret = close_0 / shift(close_0,1) - 1 \nbmret = bm_close / shift(bm_close,1) - 1 \nrelative_ret=stockret-bmret\nrelative_ret_5=sum(relative_ret,5)\nrelative_ret_30=sum(relative_ret,30)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-2015"}],"output_ports":[{"name":"data","node_id":"-2015"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-3030","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":"def cal_bm_close(df):\n bm_df = DataSource('bar1d_index_CN_STOCK_A').read(instruments=['000300.HIX'])\n bm_df.rename(columns={'close':'benchmark_close'}, inplace=True)\n merge_df = pd.merge(df, bm_df[['date','benchmark_close']], on='date', how='left')\n return merge_df['benchmark_close']\n\nbigquant_run = {\n 'cal_bm_close': cal_bm_close,\n}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-3030"},{"name":"features","node_id":"-3030"}],"output_ports":[{"name":"data","node_id":"-3030"}],"cacheable":true,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-1157","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\navg_turn_15/turn_0\nmf_net_amount_xl_0\nalpha4=close_0*avg_turn_0+close_1*avg_turn_1+close_2*avg_turn_2","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-1157"}],"output_ports":[{"name":"data","node_id":"-1157"}],"cacheable":true,"seq_num":14,"comment":"","comment_collapsed":true},{"node_id":"-4524","module_id":"BigQuantSpace.features_short.features_short-v1","parameters":[],"input_ports":[{"name":"input_1","node_id":"-4524"}],"output_ports":[{"name":"data_1","node_id":"-4524"}],"cacheable":true,"seq_num":19,"comment":"","comment_collapsed":true},{"node_id":"-3979","module_id":"BigQuantSpace.features_short.features_short-v1","parameters":[],"input_ports":[{"name":"input_1","node_id":"-3979"}],"output_ports":[{"name":"data_1","node_id":"-3979"}],"cacheable":true,"seq_num":20,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='234,26,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-15' Position='74,183,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='667,-12,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='195,415,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-60' Position='902,911,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='1320,-33,200,200'/><node_position Node='-215' Position='353,170,200,200'/><node_position Node='-222' Position='373,324,200,200'/><node_position Node='-231' Position='1392.1590576171875,207.3408966064453,200,200'/><node_position Node='-238' Position='1388.9090576171875,369.15911865234375,200,200'/><node_position Node='-834' Position='383,811,200,200'/><node_position Node='-848' Position='150,657,200,200'/><node_position Node='-852' Position='1387.318115234375,699.9318237304688,200,200'/><node_position Node='-122' Position='1388.3182373046875,527.5,200,200'/><node_position Node='-156' Position='794,1027,200,200'/><node_position Node='-2015' Position='733,231,200,200'/><node_position Node='-3030' Position='192,542,200,200'/><node_position Node='-1157' Position='1014,-147,200,200'/><node_position Node='-4524' Position='997,3,200,200'/><node_position Node='-3979' Position='787,409,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [6]:
    # 本代码由可视化策略环境自动生成 2021年12月20日 13:59
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    def cal_bm_close(df):
        bm_df = DataSource('bar1d_index_CN_STOCK_A').read(instruments=['000300.HIX'])
        bm_df.rename(columns={'close':'benchmark_close'}, inplace=True)
        merge_df = pd.merge(df, bm_df[['date','benchmark_close']], on='date', how='left')
        return merge_df['benchmark_close']
    
    m12_user_functions_bigquant_run = {
        'cal_bm_close': cal_bm_close,
    }
    # 交易引擎:初始化函数,只执行一次
    def m13_initialize_bigquant_run(context):
        df = DataSource("bar1d_index_CN_STOCK_A").read(instruments="000300.HIX",start_date="2020-01-01",end_date="2020-02-01")
        df["ma"] = df.close.rolling(5).mean()
        df["signal"] = df.apply(lambda x:1 if x.close>x.ma else 0,axis=1)
        df["signal"] = df["signal"].shift(1) #取昨日的收盘信号
        df=df[["date","signal"]]
        #信号数据
        context.signal_df = df
        #每支股票占比
        context.order_pct = 0.1
        #获取预测股票集
        context.to_buy = context.options['data'].read()
        #注册
        context.subscribe(context.instruments)
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument =0.1
        context.options['hold_days'] = 5
    
    # 交易引擎:每个单位时间开盘前调用一次。
    def m13_before_trading_start_bigquant_run(context, data):
        now = data.current_dt.strftime('%Y-%m-%d')
        context.today = data.current_dt.strftime('%Y-%m-%d')
        context.signal = context.signal_df[context.signal_df.date==now]["signal"].iloc[0]
        context.handle_flag = 0 #由于是分钟回测,每天只需要处理一次买卖
        context.sold_stock_list = []
        context.position_check = context.get_positions()
        print('日期{} 持仓 {} -----------'.format(now, context.position_check))
    
    # 交易引擎:tick数据处理函数,每个tick执行一次
    def m13_handle_tick_bigquant_run(context, data):
        pass
    
    #卖出函数
    def sell_stock(context,data,msg):
        #获取当前所有持仓
        stock_hold_now = context.get_account_positions()
        for instr in stock_hold_now:
            if instr not in context.sold_stock_list:
                #卖出可用仓位(可能有今仓)
                position = context.get_position(instr).avail_qty
                if(position>0):
                    #最新价格
                    price = data.current(instr, 'close')
                    context.order(instr, -position, price, order_type=OrderType.MARKET)
                    context.sold_stock_list.append(instr)
                    print("{}卖出{} {}".format(msg,instr,position))
    
    # 交易引擎:bar数据处理函数,每个单位执行一次
    def m13_handle_data_bigquant_run(context, data):
        
        #signal为0开盘卖
        if context.signal == 1:
            msg = context.today+" 开盘"
            sell_stock(context,data,msg)
            
        current_stopwin_stock = []
        current_stoploss_stock = []
        if len(context.position_check) > 0:
            #------------------------START:止赢止损模块(含建仓期)---------------
            positions_cost={e:p.cost_price for e,p in context.get_positions().items()}
            avail_positions = {e: p.avail_qty for e, p in context.get_positions().items()}
            for instrument in positions_cost.keys():
                s = context.get_position(instrument).cost_price
                stock_cost=positions_cost[instrument]
                stock_market_price=data.current(context.symbol(instrument),'price')
                if stock_market_price/stock_cost-1>=0.2 and avail_positions[instrument] != 0:
                    context.order_target(instrument, 0, order_type=OrderType.MARKET)
                    print('止盈成功, 止盈标的{}'.format(instrument))
                    current_stopwin_stock.append(instrument)
                elif stock_market_price/stock_cost-1 <= -0.05 and avail_positions[instrument] != 0:
                    context.order_target(instrument, 0, order_type=OrderType.MARKET)
                    print('止损成功, 止损标的{}'.format(instrument))
                    current_stoploss_stock.append(instrument)
            if len(current_stopwin_stock)>0:
    #             print(context.today,'止盈股票列表',current_stopwin_stock)
                context.sold_stock_list += current_stopwin_stock
            if len(current_stoploss_stock)>0:
    #             print(context.today,'止损股票列表',current_stoploss_stock)
                context.sold_stock_list += current_stoploss_stock
            #--------------------------END: 止赢止损模块--------------------------
        
        #signal为1尾盘卖
        if context.signal == 1:
            cur_date = data.current_dt
            cur_hm =  cur_date.strftime('%H:%M')
            if(cur_hm=="14:55"):
                msg = str(cur_date)+" 尾盘"
                sell_stock(context,data,msg)
            
    
        #每天只处理一次
        if context.handle_flag==1:
            return
        
        #买入预测集的前5只股票
        now_data = context.to_buy[context.to_buy['date']==context.today]
        today_to_buy = []
        if not now_data.empty:
            today_to_buy = now_data.instrument[:5].to_list()
        print(context.today,"=======早盘计划买入股票 {}".format(today_to_buy))
        
        # 获取账户资金
        total_portfolio = context.portfolio.portfolio_value
    
        for instr in today_to_buy:
            if instr not in context.sold_stock_list:
                #最新价格
                price = data.current(instr, 'close')
    
                #计算买入此股票的数量,不要超过总资金的某个比例
                context.order_value(instr, total_portfolio*context.order_pct, price, order_type=OrderType.MARKET)
                print("买入{}".format(instr))
                
        context.handle_flag = 1
    
    # 交易引擎:成交回报处理函数,每个成交发生时执行一次
    def m13_handle_trade_bigquant_run(context, data):
        pass
    
    # 交易引擎:委托回报处理函数,每个委托变化时执行一次
    def m13_handle_order_bigquant_run(context, data):
        pass
    
    # 交易引擎:盘后处理函数,每日盘后执行一次
    def m13_after_trading_bigquant_run(context, data):
        pass
    
    
    m1 = M.instruments.v2(
        start_date='2020-06-01',
        end_date='2020-12-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.advanced_auto_labeler.v2(
        instruments=m1.data,
        label_expr="""# #号开始的表示注释
    # 0. 每行一个,顺序执行,从第二个开始,可以使用label字段
    # 1. 可用数据字段见 https://bigquant.com/docs/develop/datasource/deprecated/history_data.html
    #   添加benchmark_前缀,可使用对应的benchmark数据
    # 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/develop/bigexpr/usage.html>`_
    
    # 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)
    shift(close, -5) / shift(open, -1)
    
    # 极值处理:用1%和99%分位的值做clip
    clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))
    
    # 将分数映射到分类,这里使用20个分类
    all_wbins(label, 20)
    
    # 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)
    where(shift(high, -1) == shift(low, -1), NaN, label)
    """,
        start_date='',
        end_date='',
        benchmark='000300.SHA',
        drop_na_label=True,
        cast_label_int=True
    )
    
    m3 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    cond1=sum(ta_macd_dif(close_0,2,4,4),5)>sum(ta_macd_dea(close_0,2,4,4),5)
    cond2=close_0>mean(close_0, 25)
    cond3=sum(ta_macd_dea(close_0,2,4,4),5)>0.2"""
    )
    
    m15 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=60
    )
    
    m16 = M.derived_feature_extractor.v3(
        input_data=m15.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m7 = M.join.v3(
        data1=m2.data,
        data2=m16.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m11 = M.input_features.v1(
        features_ds=m3.data,
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    bm_close = cal_bm_close()
    stockret = close_0 / shift(close_0,1) - 1 
    bmret = bm_close / shift(bm_close,1) - 1  
    relative_ret=stockret-bmret
    relative_ret_5=sum(relative_ret,5)
    relative_ret_30=sum(relative_ret,30)"""
    )
    
    m12 = M.derived_feature_extractor.v3(
        input_data=m7.data,
        features=m11.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions=m12_user_functions_bigquant_run
    )
    
    m5 = M.dropnan.v2(
        input_data=m12.data
    )
    
    m20 = M.features_short.v1(
        input_1=m11.data
    )
    
    m4 = M.stock_ranker_train.v6(
        training_ds=m5.data,
        features=m20.data_1,
        learning_algorithm='排序',
        number_of_leaves=30,
        minimum_docs_per_leaf=1000,
        number_of_trees=20,
        learning_rate=0.1,
        max_bins=1023,
        feature_fraction=1,
        data_row_fraction=1,
        plot_charts=True,
        ndcg_discount_base=1,
        m_lazy_run=False
    )
    
    m9 = M.instruments.v2(
        start_date=T.live_run_param('trading_date', '2020-01-01'),
        end_date=T.live_run_param('trading_date', '2020-02-01'),
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m17 = M.general_feature_extractor.v7(
        instruments=m9.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=60
    )
    
    m18 = M.derived_feature_extractor.v3(
        input_data=m17.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m6 = M.chinaa_stock_filter.v1(
        input_data=m18.data,
        index_constituent_cond=['全部'],
        board_cond=['全部'],
        industry_cond=['全部'],
        st_cond=['正常'],
        delist_cond=['非退市'],
        output_left_data=False
    )
    
    m10 = M.dropnan.v2(
        input_data=m6.data
    )
    
    m8 = M.stock_ranker_predict.v5(
        model=m4.model,
        data=m10.data,
        m_lazy_run=False
    )
    
    m13 = M.hftrade.v2(
        instruments=m9.data,
        options_data=m8.predictions,
        start_date='',
        end_date='',
        initialize=m13_initialize_bigquant_run,
        before_trading_start=m13_before_trading_start_bigquant_run,
        handle_tick=m13_handle_tick_bigquant_run,
        handle_data=m13_handle_data_bigquant_run,
        handle_trade=m13_handle_trade_bigquant_run,
        handle_order=m13_handle_order_bigquant_run,
        after_trading=m13_after_trading_bigquant_run,
        capital_base=100000,
        frequency='minute',
        price_type='真实价格',
        product_type='股票',
        before_start_days='0',
        benchmark='000300.HIX',
        plot_charts=True,
        disable_cache=False,
        show_debug_info=False,
        backtest_only=False
    )
    
    m14 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    avg_turn_15/turn_0
    mf_net_amount_xl_0
    alpha4=close_0*avg_turn_0+close_1*avg_turn_1+close_2*avg_turn_2"""
    )
    
    m19 = M.features_short.v1(
        input_1=m14.data
    )
    
    设置评估测试数据集,查看训练曲线
    [视频教程]StockRanker训练曲线
    bigcharts-data-start/{"__type":"tabs","__id":"bigchart-b99531f0349e4a418dd4241ebd60c299"}/bigcharts-data-end
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-6-69d937c7ed72> in <module>
        271 )
        272 
    --> 273 m18 = M.derived_feature_extractor.v3(
        274     input_data=m17.data,
        275     date_col='date',
    
    TypeError: __init__() takes at least 3 positional arguments (2 given)