复制链接
克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-268:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-172:input_1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-1035:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-250:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-287:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"to_node_id":"-1540:trained_model","from_node_id":"-1098:data"},{"to_node_id":"-209:data1","from_node_id":"-1540:data"},{"to_node_id":"-1380:input_1","from_node_id":"-1540:data"},{"to_node_id":"-1540:input_data","from_node_id":"-251:data"},{"to_node_id":"-4221:instruments","from_node_id":"-4213:data"},{"to_node_id":"-234:instruments","from_node_id":"-4213:data"},{"to_node_id":"-4236:data1","from_node_id":"-4221:data"},{"to_node_id":"-234:features","from_node_id":"-4231:data"},{"to_node_id":"-241:features","from_node_id":"-4231:data"},{"to_node_id":"-268:features","from_node_id":"-4231:data"},{"to_node_id":"-275:features","from_node_id":"-4231:data"},{"to_node_id":"-126:input_data","from_node_id":"-4236:data"},{"to_node_id":"-139:input_data","from_node_id":"-234:data"},{"to_node_id":"-4236:data2","from_node_id":"-241:data"},{"to_node_id":"-159:input_data","from_node_id":"-126:data"},{"to_node_id":"-241:input_data","from_node_id":"-139:data"},{"to_node_id":"-4469:input_data","from_node_id":"-159:data"},{"to_node_id":"-4469:features","from_node_id":"-164:data"},{"to_node_id":"-251:features","from_node_id":"-164:data"},{"to_node_id":"-149:input_data","from_node_id":"-268:data"},{"to_node_id":"-275:input_data","from_node_id":"-149:data"},{"to_node_id":"-130:input_data","from_node_id":"-275:data"},{"to_node_id":"-251:input_data","from_node_id":"-130:data"},{"to_node_id":"-250:options_data","from_node_id":"-216:sorted_data"},{"to_node_id":"-1035:options_data","from_node_id":"-216:sorted_data"},{"to_node_id":"-216:input_ds","from_node_id":"-209:data"},{"to_node_id":"-209:data2","from_node_id":"-172:data_1"},{"to_node_id":"-172:input_2","from_node_id":"-170:data"},{"to_node_id":"-1098:training_data","from_node_id":"-4469:data"},{"to_node_id":"-1098:input_model","from_node_id":"-3880:data"},{"to_node_id":"-3880:outputs","from_node_id":"-3784:data"},{"to_node_id":"-3784:inputs","from_node_id":"-3773:data"},{"to_node_id":"-3773:inputs","from_node_id":"-3872:data"},{"to_node_id":"-3872:inputs","from_node_id":"-3840:data"},{"to_node_id":"-3840:inputs","from_node_id":"-2712:data"},{"to_node_id":"-2712:inputs","from_node_id":"-2680:data"},{"to_node_id":"-3880:inputs","from_node_id":"-160:data"},{"to_node_id":"-2680:inputs","from_node_id":"-160:data"},{"to_node_id":"-287:options_data","from_node_id":"-1380:data_1"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-01-01","type":"Literal","bound_global_parameter":"交易日期"},{"name":"end_date","value":"2022-09-14","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":"-1098","module_id":"BigQuantSpace.dl_model_train.dl_model_train-v1","parameters":[{"name":"optimizer","value":"RMSprop","type":"Literal","bound_global_parameter":null},{"name":"user_optimizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"loss","value":"mean_squared_error","type":"Literal","bound_global_parameter":null},{"name":"user_loss","value":"","type":"Literal","bound_global_parameter":null},{"name":"metrics","value":"mae","type":"Literal","bound_global_parameter":null},{"name":"batch_size","value":"10240","type":"Literal","bound_global_parameter":null},{"name":"epochs","value":"20","type":"Literal","bound_global_parameter":null},{"name":"earlystop","value":"","type":"Literal","bound_global_parameter":null},{"name":"custom_objects","value":"# 用户的自定义层需要写到字典中,比如\n# {\n# \"MyLayer\": MyLayer\n# }\nbigquant_run = {\n \n}\n","type":"Literal","bound_global_parameter":null},{"name":"n_gpus","value":0,"type":"Literal","bound_global_parameter":null},{"name":"verbose","value":"2:每个epoch输出一行记录","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_model","node_id":"-1098"},{"name":"training_data","node_id":"-1098"},{"name":"validation_data","node_id":"-1098"}],"output_ports":[{"name":"data","node_id":"-1098"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-1540","module_id":"BigQuantSpace.dl_model_predict.dl_model_predict-v1","parameters":[{"name":"batch_size","value":"10240","type":"Literal","bound_global_parameter":null},{"name":"n_gpus","value":0,"type":"Literal","bound_global_parameter":null},{"name":"verbose","value":"2:每个epoch输出一行记录","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"trained_model","node_id":"-1540"},{"name":"input_data","node_id":"-1540"}],"output_ports":[{"name":"data","node_id":"-1540"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-251","module_id":"BigQuantSpace.dl_convert_to_bin.dl_convert_to_bin-v2","parameters":[{"name":"window_size","value":"2","type":"Literal","bound_global_parameter":null},{"name":"feature_clip","value":"-2","type":"Literal","bound_global_parameter":null},{"name":"flatten","value":"True","type":"Literal","bound_global_parameter":null},{"name":"window_along_col","value":"instrument","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-251"},{"name":"features","node_id":"-251"}],"output_ports":[{"name":"data","node_id":"-251"}],"cacheable":true,"seq_num":27,"comment":"","comment_collapsed":true},{"node_id":"-287","module_id":"BigQuantSpace.trade.trade-v4","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 # 加载预测数据\n context.ranker_prediction = context.options['data'].read_df()\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)\n # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只\n stock_count = 1\n # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]\n context.stock_weights = [ 1 ]\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 1\n context.options['hold_days'] = 1\n ","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # 获取当前持仓\n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n \n today = data.current_dt.strftime('%Y-%m-%d')\n # 按日期过滤得到今日的预测数据\n ranker_prediction = context.ranker_prediction[\n context.ranker_prediction.date == today]\n# try:\n #大盘风控模块,读取风控数据 \n# benckmark_risk=ranker_prediction['bm_0'].values[1]\n# if benckmark_risk > 0:\n # for instrument in positions.keys():\n# context.order_target(context.symbol(instrument), 0)\n# print(today,'大盘风控止损触发,全仓卖出')\n# return\n# except:\n# print('哈哈')\n \n #当risk为1时,市场有风险,全部平仓,不再执行其它操作 \n # 按日期过滤得到今日的预测数据\n ranker_prediction = context.ranker_prediction[\n context.ranker_prediction.date == data.current_dt.strftime('%Y-%m-%d')]\n #cash_for_buy = min(context.portfolio.portfolio_value/2,context.portfolio.cash)\n #cash_for_buy = context.portfolio.portfolio_value\n #print(ranker_prediction)\n #cash_for_buy = context.portfolio.portfolio_value\n cash_for_buy = context.portfolio.cash\n buy_instruments = list(ranker_prediction.instrument)\n sell_instruments = [instrument.symbol for instrument in context.portfolio.positions.keys()]\n to_buy = set(buy_instruments[:1]) - set(sell_instruments) \n to_sell = set(sell_instruments) - set(buy_instruments[:1])\n \n \n for instrument in to_sell:\n context.order_target(context.symbol(instrument), 0)\n for instrument in to_buy:\n context.order_value(context.symbol(instrument), cash_for_buy)\n","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":"0","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_buy","value":"open","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_sell","value":"close","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"30000","type":"Literal","bound_global_parameter":null},{"name":"auto_cancel_non_tradable_orders","value":"True","type":"Literal","bound_global_parameter":null},{"name":"data_frequency","value":"daily","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":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.SHA","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-287"},{"name":"options_data","node_id":"-287"},{"name":"history_ds","node_id":"-287"},{"name":"benchmark_ds","node_id":"-287"},{"name":"trading_calendar","node_id":"-287"}],"output_ports":[{"name":"raw_perf","node_id":"-287"}],"cacheable":false,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-4213","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2015-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-02-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":"-4213"}],"output_ports":[{"name":"data","node_id":"-4213"}],"cacheable":true,"seq_num":34,"comment":"","comment_collapsed":true},{"node_id":"-4221","module_id":"BigQuantSpace.advanced_auto_labeler.advanced_auto_labeler-v2","parameters":[{"name":"label_expr","value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 {{web_host_url}}docs/data_history_data.html\n# 添加benchmark_前缀,可使用对应的benchmark数据\n# 2. 可用操作符和函数见 `表达式引擎 <{{web_host_url}}docs/big_expr.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\nshift(close, -2) / shift(open, -1)\n1000*label\n# 极值处理:用1%和99%分位的值做clip\n#clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))\n\n# 将分数映射到分类,这里使用20个分类\n#all_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":"-4221"}],"output_ports":[{"name":"data","node_id":"-4221"}],"cacheable":true,"seq_num":39,"comment":"","comment_collapsed":true},{"node_id":"-4231","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"avg_mf_net_amount_5\navg_turn_0\navg_turn_13\navg_turn_5\nreturn_5\nreturn_10\nreturn_20\navg_amount_0/avg_amount_5\navg_amount_5/avg_amount_20\nrank_avg_amount_0/rank_avg_amount_5\nrank_avg_amount_5/rank_avg_amount_10\nrank_return_0\nrank_return_5\nrank_return_10\nrank_return_0/rank_return_5\nrank_return_5/rank_return_10\npe_ttm_0\nreturn_5/return_20#43: 5天的收益率/20天的收益率\nrank_amount_5#45:最近5日的成交额排名\navg_turn_10#46:平均10天的换手率\nreturn_20\nvolume_1\nclose_0>ts_max(close_0,42)#53:当日收盘价破 56天最高价(创新高)\nta_sma_10_0/ta_sma_30_0#56: 10天的sma线/30天的sma线\nswing_volatility_10_0/swing_volatility_60_0 #59: 10天的波动率/60天的波动率\nrank_return_3 #61: 3天收益率的 排名\nmf_net_amount_0>mf_net_amount_1 #62: 判断 当日的资金流入净额>昨日资金流入净额\nmf_net_amount_xl_0>mean(mf_net_amount_xl_0, 30)# 64:当天的超大单流入净量>平均30天内的超大单流入净量(30天超大单MA线)\ncond4= (close_0-close_1)/close_1 >0.03# 65:当天涨幅>5%\n#(close_0-close_30)/close_30>1.25# 66:30天内的涨幅大于125%\n#(close_0-close_5)/close_5>1.16# 67:5天内的涨幅>116%\nlist_days_0>200# 68:上市天数>365天\nta_bbands_middleband_28_0 #69:布林带28天均线\ncond28=sum(price_limit_status_0==3,36)>2 #70:统计80天内 涨停板的次数大于5\n#短周期因子\nA=sum(where(close_0==delay(close_0,1),0,close_0-where(close_0>delay(close_0,1),min(low_0,delay(close_0,1)),max(high_0,delay(close_0,1)))),6)\nB=sum(((close_0-low_0)-(high_0-close_0))/(high_0-low_0)*volume_0,6)\nC=sum(max(0,high_0-delay(close_0,1)),20)/sum(max(0,delay(close_0,1)-low_0),20)*100\n\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-4231"}],"output_ports":[{"name":"data","node_id":"-4231"}],"cacheable":true,"seq_num":40,"comment":"","comment_collapsed":true},{"node_id":"-4236","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":"-4236"},{"name":"data2","node_id":"-4236"}],"output_ports":[{"name":"data","node_id":"-4236"}],"cacheable":true,"seq_num":41,"comment":"","comment_collapsed":true},{"node_id":"-234","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":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-234"},{"name":"features","node_id":"-234"}],"output_ports":[{"name":"data","node_id":"-234"}],"cacheable":true,"seq_num":42,"comment":"","comment_collapsed":true},{"node_id":"-241","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":"-241"},{"name":"features","node_id":"-241"}],"output_ports":[{"name":"data","node_id":"-241"}],"cacheable":true,"seq_num":43,"comment":"","comment_collapsed":true},{"node_id":"-126","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-126"},{"name":"features","node_id":"-126"}],"output_ports":[{"name":"data","node_id":"-126"}],"cacheable":true,"seq_num":52,"comment":"","comment_collapsed":true},{"node_id":"-139","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%3Afalse%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%3Atrue%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%3Atrue%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%3Atrue%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":"-139"}],"output_ports":[{"name":"data","node_id":"-139"},{"name":"left_data","node_id":"-139"}],"cacheable":true,"seq_num":53,"comment":"","comment_collapsed":true},{"node_id":"-159","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"date<'2021-01-01'","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":"-159"}],"output_ports":[{"name":"data","node_id":"-159"},{"name":"left_data","node_id":"-159"}],"cacheable":true,"seq_num":54,"comment":"","comment_collapsed":true},{"node_id":"-164","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"avg_mf_net_amount_5\navg_turn_0\navg_turn_13\navg_turn_5\nreturn_5\nreturn_10\nreturn_20\navg_amount_0/avg_amount_5\navg_amount_5/avg_amount_20\nrank_avg_amount_0/rank_avg_amount_5\nrank_avg_amount_5/rank_avg_amount_10\nrank_return_0\nrank_return_5\nrank_return_10\nrank_return_0/rank_return_5\nrank_return_5/rank_return_10\npe_ttm_0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-164"}],"output_ports":[{"name":"data","node_id":"-164"}],"cacheable":true,"seq_num":55,"comment":"","comment_collapsed":true},{"node_id":"-268","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":"-268"},{"name":"features","node_id":"-268"}],"output_ports":[{"name":"data","node_id":"-268"}],"cacheable":true,"seq_num":61,"comment":"","comment_collapsed":true},{"node_id":"-149","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%3Afalse%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%3Atrue%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%3Atrue%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%3Atrue%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":"-149"}],"output_ports":[{"name":"data","node_id":"-149"},{"name":"left_data","node_id":"-149"}],"cacheable":true,"seq_num":62,"comment":"","comment_collapsed":true},{"node_id":"-275","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":"-275"},{"name":"features","node_id":"-275"}],"output_ports":[{"name":"data","node_id":"-275"}],"cacheable":true,"seq_num":63,"comment":"","comment_collapsed":true},{"node_id":"-130","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-130"},{"name":"features","node_id":"-130"}],"output_ports":[{"name":"data","node_id":"-130"}],"cacheable":true,"seq_num":64,"comment":"","comment_collapsed":true},{"node_id":"-250","module_id":"BigQuantSpace.trade.trade-v4","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 # 加载预测数据\n context.ranker_prediction = context.options['data'].read_df()\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)\n # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只\n stock_count = 1\n # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]\n context.stock_weights = [ 1 ]\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 1\n context.options['hold_days'] = 1\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n \n\n #-------------大盘风控模块\n # 获取当前持仓\n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n \n today = data.current_dt.strftime('%Y-%m-%d')\n # 按日期过滤得到今日的预测数据\n ranker_prediction = context.ranker_prediction[\n context.ranker_prediction.date == today]\n try:\n #大盘风控模块,读取风控数据 \n benckmark_risk=ranker_prediction['bm_0'].values[0]\n if benckmark_risk > 0:\n for instrument in positions.keys():\n context.order_target(context.symbol(instrument), 0)\n print(today,'大盘风控止损触发,全仓卖出')\n #如果return 在这里 只会卖出第一支持仓的股票,执行一次后返回,有可能起不到全仓风控的作用\n return\n except:\n print('开仓!') \n \n #-------------大盘风控模块\n \n \n \n\n \n # 相隔几天(hold_days)进行一下换仓\n if context.trading_day_index % context.options['hold_days'] != 0:\n return \n \n \n # 目前持仓\n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n # 权重\n buy_cash_weights = context.stock_weights\n # 今日买入股票列表\n stock_to_buy = list(ranker_prediction.instrument[:len(buy_cash_weights)])\n # 持仓上限\n max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument\n\n # 通过positions对象,使用列表生成式的方法获取目前持仓的股票列表\n stock_hold_now = [equity.symbol for equity in context.portfolio.positions ]\n # 继续持有的股票:调仓时,如果买入的股票已经存在于目前的持仓里,那么应继续持有\n no_need_to_sell = [i for i in stock_hold_now if i in stock_to_buy]\n # 需要卖出的股票\n stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell]\n \n # 卖出\n for stock in stock_to_sell:\n # 如果该股票停牌,则没法成交。因此需要用can_trade方法检查下该股票的状态\n # 如果返回真值,则可以正常下单,否则会出错\n # 因为stock是字符串格式,我们用symbol方法将其转化成平台可以接受的形式:Equity格式\n if data.can_trade(context.symbol(stock)):\n # order_target_percent是平台的一个下单接口,表明下单使得该股票的权重为0,\n # 即卖出全部股票,可参考回测文档\n context.order_target_percent(context.symbol(stock), 0)\n \n # 如果当天没有买入的股票,就返回\n if len(stock_to_buy) == 0:\n return\n \n # 买入\n for i, instrument in enumerate(stock_to_buy):\n cash = context.portfolio.portfolio_value * buy_cash_weights[i]\n if cash > max_cash_per_instrument - positions.get(instrument, 0):\n # 确保股票持仓量不会超过每次股票最大的占用资金量\n cash = max_cash_per_instrument - positions.get(instrument, 0)\n if cash > 0:\n context.order_value(context.symbol(instrument), cash)","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":"0","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_buy","value":"open","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_sell","value":"close","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"30000","type":"Literal","bound_global_parameter":null},{"name":"auto_cancel_non_tradable_orders","value":"True","type":"Literal","bound_global_parameter":null},{"name":"data_frequency","value":"daily","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":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.HIX","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-250"},{"name":"options_data","node_id":"-250"},{"name":"history_ds","node_id":"-250"},{"name":"benchmark_ds","node_id":"-250"},{"name":"trading_calendar","node_id":"-250"}],"output_ports":[{"name":"raw_perf","node_id":"-250"}],"cacheable":false,"seq_num":68,"comment":"","comment_collapsed":true},{"node_id":"-1035","module_id":"BigQuantSpace.trade.trade-v4","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 # 加载预测数据\n context.ranker_prediction = context.options['data'].read_df()\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)\n # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只\n stock_count = 1\n # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]\n context.stock_weights = [ 1 ]\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 1\n context.options['hold_days'] = 1\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n \n\n #-------------大盘风控模块\n # 获取当前持仓\n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n \n today = data.current_dt.strftime('%Y-%m-%d')\n # 按日期过滤得到今日的预测数据\n ranker_prediction = context.ranker_prediction[\n context.ranker_prediction.date == today]\n try:\n #大盘风控模块,读取风控数据 \n benckmark_risk=ranker_prediction['bm_1'].values[0]\n if benckmark_risk > 0:\n for instrument in positions.keys():\n context.order_target(context.symbol(instrument), 0)\n print(today,'大盘风控止损触发,全仓卖出')\n #如果return 在这里 只会卖出第一支持仓的股票,执行一次后返回,有可能起不到全仓风控的作用\n return\n except:\n print('开仓!') \n \n #-------------大盘风控模块\n \n \n \n \n \n # 相隔几天(hold_days)进行一下换仓\n if context.trading_day_index % context.options['hold_days'] != 0:\n return \n \n # 目前持仓\n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n # 权重\n buy_cash_weights = context.stock_weights\n # 今日买入股票列表\n stock_to_buy = list(ranker_prediction.instrument[:len(buy_cash_weights)])\n # 持仓上限\n max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument\n\n # 通过positions对象,使用列表生成式的方法获取目前持仓的股票列表\n stock_hold_now = [equity.symbol for equity in context.portfolio.positions ]\n # 继续持有的股票:调仓时,如果买入的股票已经存在于目前的持仓里,那么应继续持有\n no_need_to_sell = [i for i in stock_hold_now if i in stock_to_buy]\n # 需要卖出的股票\n stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell]\n \n # 卖出\n for stock in stock_to_sell:\n # 如果该股票停牌,则没法成交。因此需要用can_trade方法检查下该股票的状态\n # 如果返回真值,则可以正常下单,否则会出错\n # 因为stock是字符串格式,我们用symbol方法将其转化成平台可以接受的形式:Equity格式\n if data.can_trade(context.symbol(stock)):\n # order_target_percent是平台的一个下单接口,表明下单使得该股票的权重为0,\n # 即卖出全部股票,可参考回测文档\n context.order_target_percent(context.symbol(stock), 0)\n \n # 如果当天没有买入的股票,就返回\n if len(stock_to_buy) == 0:\n return\n \n # 买入\n for i, instrument in enumerate(stock_to_buy):\n cash = context.portfolio.portfolio_value * buy_cash_weights[i]\n if cash > max_cash_per_instrument - positions.get(instrument, 0):\n # 确保股票持仓量不会超过每次股票最大的占用资金量\n cash = max_cash_per_instrument - positions.get(instrument, 0)\n if cash > 0:\n context.order_value(context.symbol(instrument), cash)\n \n","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":"0","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_buy","value":"open","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_sell","value":"close","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"30000","type":"Literal","bound_global_parameter":null},{"name":"auto_cancel_non_tradable_orders","value":"True","type":"Literal","bound_global_parameter":null},{"name":"data_frequency","value":"daily","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":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.HIX","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-1035"},{"name":"options_data","node_id":"-1035"},{"name":"history_ds","node_id":"-1035"},{"name":"benchmark_ds","node_id":"-1035"},{"name":"trading_calendar","node_id":"-1035"}],"output_ports":[{"name":"raw_perf","node_id":"-1035"}],"cacheable":false,"seq_num":69,"comment":"","comment_collapsed":true},{"node_id":"-216","module_id":"BigQuantSpace.sort.sort-v4","parameters":[{"name":"sort_by","value":"date","type":"Literal","bound_global_parameter":null},{"name":"group_by","value":"--","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":"-216"},{"name":"sort_by_ds","node_id":"-216"}],"output_ports":[{"name":"sorted_data","node_id":"-216"}],"cacheable":true,"seq_num":70,"comment":"","comment_collapsed":true},{"node_id":"-209","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date","type":"Literal","bound_global_parameter":null},{"name":"how","value":"left","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-209"},{"name":"data2","node_id":"-209"}],"output_ports":[{"name":"data","node_id":"-209"}],"cacheable":true,"seq_num":71,"comment":"","comment_collapsed":true},{"node_id":"-172","module_id":"BigQuantSpace.index_feature_extract.index_feature_extract-v3","parameters":[{"name":"before_days","value":"100","type":"Literal","bound_global_parameter":null},{"name":"index","value":"000300.HIX","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-172"},{"name":"input_2","node_id":"-172"}],"output_ports":[{"name":"data_1","node_id":"-172"},{"name":"data_2","node_id":"-172"}],"cacheable":true,"seq_num":72,"comment":"指数的代码在这里","comment_collapsed":true},{"node_id":"-170","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\n#--- 1.用指数的成交量(3.5日ma线死叉) 作为 全仓卖出风控的依据\nbm_0=where(mean(volume, 5)-mean(volume, 20)<0,1,0)\n#bm_0=where(ta_macd_dif(close,2,4,4)-ta_macd_dea(close,2,4,4)<0,1,0)\n\n#--- 2.用指数的 MAAMT指标 作为 MAAMT指标择时策略 全仓卖出风控的依据\n#成交量(金额)类\n#求成交额的移动平均线。\n#MAAMT=MA(AMOUNT,N)\n#信号产生方式 如果成交额上穿 MAAMT,则产生买入信号;\n#如果成交额下穿 MAAMT,则产生卖出信号。\n\nbm_1=where(mean(amount, 5)-mean(amount, 20)<0,1,0)\n\n#--- 3.用指数的 MAAMT指标 作为 MAAMT指标择时策略 全仓卖出风控的依据","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-170"}],"output_ports":[{"name":"data","node_id":"-170"}],"cacheable":true,"seq_num":73,"comment":"修改指数的风控指标","comment_collapsed":true},{"node_id":"-4469","module_id":"BigQuantSpace.dl_convert_to_bin.dl_convert_to_bin-v2","parameters":[{"name":"window_size","value":"2","type":"Literal","bound_global_parameter":null},{"name":"feature_clip","value":"-2","type":"Literal","bound_global_parameter":null},{"name":"flatten","value":"True","type":"Literal","bound_global_parameter":null},{"name":"window_along_col","value":"instrument","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-4469"},{"name":"features","node_id":"-4469"}],"output_ports":[{"name":"data","node_id":"-4469"}],"cacheable":true,"seq_num":75,"comment":"","comment_collapsed":true},{"node_id":"-3880","module_id":"BigQuantSpace.dl_model_init.dl_model_init-v1","parameters":[],"input_ports":[{"name":"inputs","node_id":"-3880"},{"name":"outputs","node_id":"-3880"}],"output_ports":[{"name":"data","node_id":"-3880"}],"cacheable":false,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-3784","module_id":"BigQuantSpace.dl_layer_dense.dl_layer_dense-v1","parameters":[{"name":"units","value":"1","type":"Literal","bound_global_parameter":null},{"name":"activation","value":"sigmoid","type":"Literal","bound_global_parameter":null},{"name":"user_activation","value":"","type":"Literal","bound_global_parameter":null},{"name":"use_bias","value":"True","type":"Literal","bound_global_parameter":null},{"name":"kernel_initializer","value":"Zeros","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_initializer","value":"glorot_uniform","type":"Literal","bound_global_parameter":null},{"name":"user_bias_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_kernel_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_bias_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_activity_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_bias_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-3784"}],"output_ports":[{"name":"data","node_id":"-3784"}],"cacheable":false,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-3773","module_id":"BigQuantSpace.dl_layer_globalmaxpooling1d.dl_layer_globalmaxpooling1d-v1","parameters":[{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-3773"}],"output_ports":[{"name":"data","node_id":"-3773"}],"cacheable":false,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-3872","module_id":"BigQuantSpace.dl_layer_maxpooling1d.dl_layer_maxpooling1d-v1","parameters":[{"name":"pool_size","value":"2","type":"Literal","bound_global_parameter":null},{"name":"strides","value":"","type":"Literal","bound_global_parameter":null},{"name":"padding","value":"valid","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-3872"}],"output_ports":[{"name":"data","node_id":"-3872"}],"cacheable":false,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-3840","module_id":"BigQuantSpace.dl_layer_conv1d.dl_layer_conv1d-v1","parameters":[{"name":"filters","value":"128","type":"Literal","bound_global_parameter":null},{"name":"kernel_size","value":"5","type":"Literal","bound_global_parameter":null},{"name":"strides","value":"1","type":"Literal","bound_global_parameter":null},{"name":"padding","value":"valid","type":"Literal","bound_global_parameter":null},{"name":"dilation_rate","value":1,"type":"Literal","bound_global_parameter":null},{"name":"activation","value":"relu","type":"Literal","bound_global_parameter":null},{"name":"user_activation","value":"","type":"Literal","bound_global_parameter":null},{"name":"use_bias","value":"True","type":"Literal","bound_global_parameter":null},{"name":"kernel_initializer","value":"glorot_uniform","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_initializer","value":"Zeros","type":"Literal","bound_global_parameter":null},{"name":"user_bias_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_kernel_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_bias_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_activity_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_bias_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-3840"}],"output_ports":[{"name":"data","node_id":"-3840"}],"cacheable":false,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-2712","module_id":"BigQuantSpace.dl_layer_maxpooling1d.dl_layer_maxpooling1d-v1","parameters":[{"name":"pool_size","value":"2","type":"Literal","bound_global_parameter":null},{"name":"strides","value":"","type":"Literal","bound_global_parameter":null},{"name":"padding","value":"valid","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-2712"}],"output_ports":[{"name":"data","node_id":"-2712"}],"cacheable":false,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-2680","module_id":"BigQuantSpace.dl_layer_conv1d.dl_layer_conv1d-v1","parameters":[{"name":"filters","value":"128","type":"Literal","bound_global_parameter":null},{"name":"kernel_size","value":"5","type":"Literal","bound_global_parameter":null},{"name":"strides","value":"1","type":"Literal","bound_global_parameter":null},{"name":"padding","value":"valid","type":"Literal","bound_global_parameter":null},{"name":"dilation_rate","value":1,"type":"Literal","bound_global_parameter":null},{"name":"activation","value":"relu","type":"Literal","bound_global_parameter":null},{"name":"user_activation","value":"","type":"Literal","bound_global_parameter":null},{"name":"use_bias","value":"True","type":"Literal","bound_global_parameter":null},{"name":"kernel_initializer","value":"glorot_uniform","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_initializer","value":"Zeros","type":"Literal","bound_global_parameter":null},{"name":"user_bias_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_kernel_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_bias_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_activity_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_bias_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-2680"}],"output_ports":[{"name":"data","node_id":"-2680"}],"cacheable":false,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-160","module_id":"BigQuantSpace.dl_layer_input.dl_layer_input-v1","parameters":[{"name":"shape","value":"17,2","type":"Literal","bound_global_parameter":null},{"name":"batch_shape","value":"","type":"Literal","bound_global_parameter":null},{"name":"dtype","value":"float32","type":"Literal","bound_global_parameter":null},{"name":"sparse","value":"False","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-160"}],"output_ports":[{"name":"data","node_id":"-160"}],"cacheable":false,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-1380","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n pred_label = input_1.read_pickle()\n df = input_2.read_df()\n df = pd.DataFrame({'pred_label':pred_label[:,0], 'instrument':df.instrument, 'date':df.date})\n df.sort_values(['date','pred_label'],inplace=True, ascending=[True,False])\n return Outputs(data_1=DataSource.write_df(df), data_2=None, data_3=None)\n\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-1380"},{"name":"input_2","node_id":"-1380"},{"name":"input_3","node_id":"-1380"}],"output_ports":[{"name":"data_1","node_id":"-1380"},{"name":"data_2","node_id":"-1380"},{"name":"data_3","node_id":"-1380"}],"cacheable":true,"seq_num":2,"comment":"模型预测结果输出","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='2485.595703125,262.2762756347656,200,200'/><node_position Node='-1098' Position='1198,1032,200,200'/><node_position Node='-1540' Position='1458,1114,200,200'/><node_position Node='-251' Position='1862.4288330078125,898.8824462890625,200,200'/><node_position Node='-287' Position='1851,1295,200,200'/><node_position Node='-4213' Position='1293,278,200,200'/><node_position Node='-4221' Position='1142,422,200,200'/><node_position Node='-4231' Position='1784,150,200,200'/><node_position Node='-4236' Position='1300,640,200,200'/><node_position Node='-234' Position='1449,416,200,200'/><node_position Node='-241' Position='1432,566,200,200'/><node_position Node='-126' Position='1308,722,200,200'/><node_position Node='-139' Position='1449,489,200,200'/><node_position Node='-159' Position='1341.5113525390625,795.9175415039062,200,200'/><node_position Node='-164' Position='1746.0721435546875,650.5855712890625,200,200'/><node_position Node='-268' Position='2133.9814453125,400.6618347167969,200,200'/><node_position Node='-149' Position='2131.614501953125,478.8453674316406,200,200'/><node_position Node='-275' Position='2131.4306640625,565.2123413085938,200,200'/><node_position Node='-130' Position='2128.7978515625,634.661865234375,200,200'/><node_position Node='-250' Position='2418,1032,200,200'/><node_position Node='-1035' Position='2752,957,200,200'/><node_position Node='-216' Position='2591,829,200,200'/><node_position Node='-209' Position='2675,750,200,200'/><node_position Node='-172' Position='2765,672,200,200'/><node_position Node='-170' Position='2883,571,200,200'/><node_position Node='-4469' Position='1490.9444580078125,894.0185546875,200,200'/><node_position Node='-3880' Position='806,778,200,200'/><node_position Node='-3784' Position='806,702,200,200'/><node_position Node='-3773' Position='804,627,200,200'/><node_position Node='-3872' Position='803,555,200,200'/><node_position Node='-3840' Position='803,470,200,200'/><node_position Node='-2712' Position='798,395,200,200'/><node_position Node='-2680' Position='799,317,200,200'/><node_position Node='-160' Position='798,222,200,200'/><node_position Node='-1380' Position='1666,1197,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [ ]:
    # 本代码由可视化策略环境自动生成 2022年9月16日 08:53
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # 用户的自定义层需要写到字典中,比如
    # {
    #   "MyLayer": MyLayer
    # }
    m5_custom_objects_bigquant_run = {
        
    }
    
    # 回测引擎:初始化函数,只执行一次
    def m68_initialize_bigquant_run(context):
        # 加载预测数据
        context.ranker_prediction = context.options['data'].read_df()
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)
        # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
        stock_count = 1
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        context.stock_weights = [ 1 ]
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument = 1
        context.options['hold_days'] = 1
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m68_handle_data_bigquant_run(context, data):
       
    
        #-------------大盘风控模块
        # 获取当前持仓
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
        
        today = data.current_dt.strftime('%Y-%m-%d')
        # 按日期过滤得到今日的预测数据
        ranker_prediction = context.ranker_prediction[
            context.ranker_prediction.date == today]
        try:
        #大盘风控模块,读取风控数据    
            benckmark_risk=ranker_prediction['bm_0'].values[0]
            if benckmark_risk > 0:
                for instrument in positions.keys():
                    context.order_target(context.symbol(instrument), 0)
                    print(today,'大盘风控止损触发,全仓卖出')
                    #如果return 在这里   只会卖出第一支持仓的股票,执行一次后返回,有可能起不到全仓风控的作用
                    return
        except:
            print('开仓!')    
        
         #-------------大盘风控模块
        
        
        
    
        
        # 相隔几天(hold_days)进行一下换仓
        if context.trading_day_index % context.options['hold_days'] != 0:
            return 
        
      
        # 目前持仓
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
        # 权重
        buy_cash_weights = context.stock_weights
        # 今日买入股票列表
        stock_to_buy = list(ranker_prediction.instrument[:len(buy_cash_weights)])
        # 持仓上限
        max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
    
        # 通过positions对象,使用列表生成式的方法获取目前持仓的股票列表
        stock_hold_now = [equity.symbol for equity in context.portfolio.positions ]
        # 继续持有的股票:调仓时,如果买入的股票已经存在于目前的持仓里,那么应继续持有
        no_need_to_sell = [i for i in stock_hold_now if i in stock_to_buy]
        # 需要卖出的股票
        stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell]
      
        # 卖出
        for stock in stock_to_sell:
            # 如果该股票停牌,则没法成交。因此需要用can_trade方法检查下该股票的状态
            # 如果返回真值,则可以正常下单,否则会出错
            # 因为stock是字符串格式,我们用symbol方法将其转化成平台可以接受的形式:Equity格式
            if data.can_trade(context.symbol(stock)):
                # order_target_percent是平台的一个下单接口,表明下单使得该股票的权重为0,
                #   即卖出全部股票,可参考回测文档
                context.order_target_percent(context.symbol(stock), 0)
        
        # 如果当天没有买入的股票,就返回
        if len(stock_to_buy) == 0:
            return
        
        # 买入
        for i, instrument in enumerate(stock_to_buy):
            cash = context.portfolio.portfolio_value * buy_cash_weights[i]
            if cash > max_cash_per_instrument - positions.get(instrument, 0):
                # 确保股票持仓量不会超过每次股票最大的占用资金量
                cash = max_cash_per_instrument - positions.get(instrument, 0)
            if cash > 0:
                context.order_value(context.symbol(instrument), cash)
    # 回测引擎:准备数据,只执行一次
    def m68_prepare_bigquant_run(context):
        pass
    
    # 回测引擎:初始化函数,只执行一次
    def m69_initialize_bigquant_run(context):
        # 加载预测数据
        context.ranker_prediction = context.options['data'].read_df()
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)
        # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
        stock_count = 1
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        context.stock_weights = [ 1 ]
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument = 1
        context.options['hold_days'] = 1
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m69_handle_data_bigquant_run(context, data):
       
    
        #-------------大盘风控模块
        # 获取当前持仓
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
        
        today = data.current_dt.strftime('%Y-%m-%d')
        # 按日期过滤得到今日的预测数据
        ranker_prediction = context.ranker_prediction[
            context.ranker_prediction.date == today]
        try:
        #大盘风控模块,读取风控数据    
            benckmark_risk=ranker_prediction['bm_1'].values[0]
            if benckmark_risk > 0:
                for instrument in positions.keys():
                    context.order_target(context.symbol(instrument), 0)
                    print(today,'大盘风控止损触发,全仓卖出')
                    #如果return 在这里   只会卖出第一支持仓的股票,执行一次后返回,有可能起不到全仓风控的作用
                return
        except:
            print('开仓!')    
        
         #-------------大盘风控模块
        
        
        
       
        
        # 相隔几天(hold_days)进行一下换仓
        if context.trading_day_index % context.options['hold_days'] != 0:
            return 
        
           # 目前持仓
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
        # 权重
        buy_cash_weights = context.stock_weights
        # 今日买入股票列表
        stock_to_buy = list(ranker_prediction.instrument[:len(buy_cash_weights)])
        # 持仓上限
        max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
    
        # 通过positions对象,使用列表生成式的方法获取目前持仓的股票列表
        stock_hold_now = [equity.symbol for equity in context.portfolio.positions ]
        # 继续持有的股票:调仓时,如果买入的股票已经存在于目前的持仓里,那么应继续持有
        no_need_to_sell = [i for i in stock_hold_now if i in stock_to_buy]
        # 需要卖出的股票
        stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell]
      
        # 卖出
        for stock in stock_to_sell:
            # 如果该股票停牌,则没法成交。因此需要用can_trade方法检查下该股票的状态
            # 如果返回真值,则可以正常下单,否则会出错
            # 因为stock是字符串格式,我们用symbol方法将其转化成平台可以接受的形式:Equity格式
            if data.can_trade(context.symbol(stock)):
                # order_target_percent是平台的一个下单接口,表明下单使得该股票的权重为0,
                #   即卖出全部股票,可参考回测文档
                context.order_target_percent(context.symbol(stock), 0)
        
        # 如果当天没有买入的股票,就返回
        if len(stock_to_buy) == 0:
            return
        
        # 买入
        for i, instrument in enumerate(stock_to_buy):
            cash = context.portfolio.portfolio_value * buy_cash_weights[i]
            if cash > max_cash_per_instrument - positions.get(instrument, 0):
                # 确保股票持仓量不会超过每次股票最大的占用资金量
                cash = max_cash_per_instrument - positions.get(instrument, 0)
            if cash > 0:
                context.order_value(context.symbol(instrument), cash)
          
    
    # 回测引擎:准备数据,只执行一次
    def m69_prepare_bigquant_run(context):
        pass
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m2_run_bigquant_run(input_1, input_2, input_3):
        # 示例代码如下。在这里编写您的代码
        pred_label = input_1.read_pickle()
        df = input_2.read_df()
        df = pd.DataFrame({'pred_label':pred_label[:,0], 'instrument':df.instrument, 'date':df.date})
        df.sort_values(['date','pred_label'],inplace=True, ascending=[True,False])
        return Outputs(data_1=DataSource.write_df(df), data_2=None, data_3=None)
    
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m2_post_run_bigquant_run(outputs):
        return outputs
    
    # 回测引擎:初始化函数,只执行一次
    def m6_initialize_bigquant_run(context):
        # 加载预测数据
        context.ranker_prediction = context.options['data'].read_df()
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)
        # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
        stock_count = 1
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        context.stock_weights = [ 1 ]
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument = 1
        context.options['hold_days'] = 1
        
    # 回测引擎:每日数据处理函数,每天执行一次
    def m6_handle_data_bigquant_run(context, data):
        # 获取当前持仓
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.portfolio.positions.items()}
        
        today = data.current_dt.strftime('%Y-%m-%d')
        # 按日期过滤得到今日的预测数据
        ranker_prediction = context.ranker_prediction[
            context.ranker_prediction.date == today]
    #    try:
         #大盘风控模块,读取风控数据    
    #        benckmark_risk=ranker_prediction['bm_0'].values[1]
    #        if benckmark_risk > 0:
     #          for instrument in positions.keys():
    #               context.order_target(context.symbol(instrument), 0)
    #               print(today,'大盘风控止损触发,全仓卖出')
    #           return
    #    except:
    #        print('哈哈')
            
        #当risk为1时,市场有风险,全部平仓,不再执行其它操作    
        # 按日期过滤得到今日的预测数据
        ranker_prediction = context.ranker_prediction[
            context.ranker_prediction.date == data.current_dt.strftime('%Y-%m-%d')]
        #cash_for_buy = min(context.portfolio.portfolio_value/2,context.portfolio.cash)
        #cash_for_buy = context.portfolio.portfolio_value
        #print(ranker_prediction)
        #cash_for_buy = context.portfolio.portfolio_value
        cash_for_buy = context.portfolio.cash
        buy_instruments = list(ranker_prediction.instrument)
        sell_instruments = [instrument.symbol for instrument in context.portfolio.positions.keys()]
        to_buy = set(buy_instruments[:1]) - set(sell_instruments) 
        to_sell = set(sell_instruments) -  set(buy_instruments[:1])
       
        
        for instrument in to_sell:
            context.order_target(context.symbol(instrument), 0)
        for instrument in to_buy:
            context.order_value(context.symbol(instrument), cash_for_buy)
    
    # 回测引擎:准备数据,只执行一次
    def m6_prepare_bigquant_run(context):
        pass
    
    
    m9 = M.instruments.v2(
        start_date=T.live_run_param('trading_date', '2021-01-01'),
        end_date=T.live_run_param('trading_date', '2022-09-14'),
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m34 = M.instruments.v2(
        start_date='2015-01-01',
        end_date='2022-02-01',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m39 = M.advanced_auto_labeler.v2(
        instruments=m34.data,
        label_expr="""# #号开始的表示注释
    # 0. 每行一个,顺序执行,从第二个开始,可以使用label字段
    # 1. 可用数据字段见 {{web_host_url}}docs/data_history_data.html
    #   添加benchmark_前缀,可使用对应的benchmark数据
    # 2. 可用操作符和函数见 `表达式引擎 <{{web_host_url}}docs/big_expr.html>`_
    
    # 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)
    shift(close, -2) / shift(open, -1)
    1000*label
    # 极值处理:用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
    )
    
    m40 = M.input_features.v1(
        features="""avg_mf_net_amount_5
    avg_turn_0
    avg_turn_13
    avg_turn_5
    return_5
    return_10
    return_20
    avg_amount_0/avg_amount_5
    avg_amount_5/avg_amount_20
    rank_avg_amount_0/rank_avg_amount_5
    rank_avg_amount_5/rank_avg_amount_10
    rank_return_0
    rank_return_5
    rank_return_10
    rank_return_0/rank_return_5
    rank_return_5/rank_return_10
    pe_ttm_0
    return_5/return_20#43: 5天的收益率/20天的收益率
    rank_amount_5#45:最近5日的成交额排名
    avg_turn_10#46:平均10天的换手率
    return_20
    volume_1
    close_0>ts_max(close_0,42)#53:当日收盘价破 56天最高价(创新高)
    ta_sma_10_0/ta_sma_30_0#56:   10天的sma线/30天的sma线
    swing_volatility_10_0/swing_volatility_60_0 #59:   10天的波动率/60天的波动率
    rank_return_3  #61:   3天收益率的 排名
    mf_net_amount_0>mf_net_amount_1  #62:  判断 当日的资金流入净额>昨日资金流入净额
    mf_net_amount_xl_0>mean(mf_net_amount_xl_0, 30)# 64:当天的超大单流入净量>平均30天内的超大单流入净量(30天超大单MA线)
    cond4= (close_0-close_1)/close_1 >0.03#  65:当天涨幅>5%
    #(close_0-close_30)/close_30>1.25#  66:30天内的涨幅大于125%
    #(close_0-close_5)/close_5>1.16#  67:5天内的涨幅>116%
    list_days_0>200#  68:上市天数>365天
    ta_bbands_middleband_28_0 #69:布林带28天均线
    cond28=sum(price_limit_status_0==3,36)>2  #70:统计80天内 涨停板的次数大于5
    #短周期因子
    A=sum(where(close_0==delay(close_0,1),0,close_0-where(close_0>delay(close_0,1),min(low_0,delay(close_0,1)),max(high_0,delay(close_0,1)))),6)
    B=sum(((close_0-low_0)-(high_0-close_0))/(high_0-low_0)*volume_0,6)
    C=sum(max(0,high_0-delay(close_0,1)),20)/sum(max(0,delay(close_0,1)-low_0),20)*100
    
    """
    )
    
    m42 = M.general_feature_extractor.v7(
        instruments=m34.data,
        features=m40.data,
        start_date='',
        end_date=''
    )
    
    m53 = M.chinaa_stock_filter.v1(
        input_data=m42.data,
        index_constituent_cond=['全部'],
        board_cond=['上证主板', '深证主板', '创业板'],
        industry_cond=['全部'],
        st_cond=['正常'],
        delist_cond=['非退市'],
        output_left_data=False
    )
    
    m43 = M.derived_feature_extractor.v3(
        input_data=m53.data,
        features=m40.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m41 = M.join.v3(
        data1=m39.data,
        data2=m43.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m52 = M.dropnan.v2(
        input_data=m41.data
    )
    
    m54 = M.filter.v3(
        input_data=m52.data,
        expr='date<\'2021-01-01\'',
        output_left_data=False
    )
    
    m61 = M.general_feature_extractor.v7(
        instruments=m9.data,
        features=m40.data,
        start_date='',
        end_date='',
        before_start_days=60
    )
    
    m62 = M.chinaa_stock_filter.v1(
        input_data=m61.data,
        index_constituent_cond=['全部'],
        board_cond=['上证主板', '深证主板', '创业板'],
        industry_cond=['全部'],
        st_cond=['正常'],
        delist_cond=['非退市'],
        output_left_data=False
    )
    
    m63 = M.derived_feature_extractor.v3(
        input_data=m62.data,
        features=m40.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m64 = M.dropnan.v2(
        input_data=m63.data
    )
    
    m55 = M.input_features.v1(
        features="""avg_mf_net_amount_5
    avg_turn_0
    avg_turn_13
    avg_turn_5
    return_5
    return_10
    return_20
    avg_amount_0/avg_amount_5
    avg_amount_5/avg_amount_20
    rank_avg_amount_0/rank_avg_amount_5
    rank_avg_amount_5/rank_avg_amount_10
    rank_return_0
    rank_return_5
    rank_return_10
    rank_return_0/rank_return_5
    rank_return_5/rank_return_10
    pe_ttm_0"""
    )
    
    m75 = M.dl_convert_to_bin.v2(
        input_data=m54.data,
        features=m55.data,
        window_size=2,
        feature_clip=-2,
        flatten=True,
        window_along_col='instrument'
    )
    
    m27 = M.dl_convert_to_bin.v2(
        input_data=m64.data,
        features=m55.data,
        window_size=2,
        feature_clip=-2,
        flatten=True,
        window_along_col='instrument'
    )
    
    m73 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    #--- 1.用指数的成交量(3.5日ma线死叉)  作为  全仓卖出风控的依据
    bm_0=where(mean(volume, 5)-mean(volume, 20)<0,1,0)
    #bm_0=where(ta_macd_dif(close,2,4,4)-ta_macd_dea(close,2,4,4)<0,1,0)
    
    #--- 2.用指数的  MAAMT指标 作为 MAAMT指标择时策略  全仓卖出风控的依据
    #成交量(金额)类
    #求成交额的移动平均线。
    #MAAMT=MA(AMOUNT,N)
    #信号产生方式 如果成交额上穿 MAAMT,则产生买入信号;
    #如果成交额下穿 MAAMT,则产生卖出信号。
    
    bm_1=where(mean(amount, 5)-mean(amount, 20)<0,1,0)
    
    #--- 3.用指数的  MAAMT指标 作为 MAAMT指标择时策略  全仓卖出风控的依据"""
    )
    
    m72 = M.index_feature_extract.v3(
        input_1=m9.data,
        input_2=m73.data,
        before_days=100,
        index='000300.HIX'
    )
    
    m13 = M.dl_layer_input.v1(
        shape='17,2',
        batch_shape='',
        dtype='float32',
        sparse=False,
        name=''
    )
    
    m12 = M.dl_layer_conv1d.v1(
        inputs=m13.data,
        filters=128,
        kernel_size='5',
        strides='1',
        padding='valid',
        dilation_rate=1,
        activation='relu',
        use_bias=True,
        kernel_initializer='glorot_uniform',
        bias_initializer='Zeros',
        kernel_regularizer='None',
        kernel_regularizer_l1=0,
        kernel_regularizer_l2=0,
        bias_regularizer='None',
        bias_regularizer_l1=0,
        bias_regularizer_l2=0,
        activity_regularizer='None',
        activity_regularizer_l1=0,
        activity_regularizer_l2=0,
        kernel_constraint='None',
        bias_constraint='None',
        name=''
    )
    
    m10 = M.dl_layer_maxpooling1d.v1(
        inputs=m12.data,
        pool_size=2,
        padding='valid',
        name=''
    )
    
    m8 = M.dl_layer_conv1d.v1(
        inputs=m10.data,
        filters=128,
        kernel_size='5',
        strides='1',
        padding='valid',
        dilation_rate=1,
        activation='relu',
        use_bias=True,
        kernel_initializer='glorot_uniform',
        bias_initializer='Zeros',
        kernel_regularizer='None',
        kernel_regularizer_l1=0,
        kernel_regularizer_l2=0,
        bias_regularizer='None',
        bias_regularizer_l1=0,
        bias_regularizer_l2=0,
        activity_regularizer='None',
        activity_regularizer_l1=0,
        activity_regularizer_l2=0,
        kernel_constraint='None',
        bias_constraint='None',
        name=''
    )
    
    m7 = M.dl_layer_maxpooling1d.v1(
        inputs=m8.data,
        pool_size=2,
        padding='valid',
        name=''
    )
    
    m4 = M.dl_layer_globalmaxpooling1d.v1(
        inputs=m7.data,
        name=''
    )
    
    m3 = M.dl_layer_dense.v1(
        inputs=m4.data,
        units=1,
        activation='sigmoid',
        use_bias=True,
        kernel_initializer='Zeros',
        bias_initializer='glorot_uniform',
        kernel_regularizer='None',
        kernel_regularizer_l1=0,
        kernel_regularizer_l2=0,
        bias_regularizer='None',
        bias_regularizer_l1=0,
        bias_regularizer_l2=0,
        activity_regularizer='None',
        activity_regularizer_l1=0,
        activity_regularizer_l2=0,
        kernel_constraint='None',
        bias_constraint='None',
        name=''
    )
    
    m1 = M.dl_model_init.v1(
        inputs=m13.data,
        outputs=m3.data
    )
    
    m5 = M.dl_model_train.v1(
        input_model=m1.data,
        training_data=m75.data,
        optimizer='RMSprop',
        loss='mean_squared_error',
        metrics='mae',
        batch_size=10240,
        epochs=20,
        custom_objects=m5_custom_objects_bigquant_run,
        n_gpus=0,
        verbose='2:每个epoch输出一行记录'
    )
    
    m11 = M.dl_model_predict.v1(
        trained_model=m5.data,
        input_data=m27.data,
        batch_size=10240,
        n_gpus=0,
        verbose='2:每个epoch输出一行记录'
    )
    
    m71 = M.join.v3(
        data1=m11.data,
        data2=m72.data_1,
        on='date',
        how='left',
        sort=False
    )
    
    m70 = M.sort.v4(
        input_ds=m71.data,
        sort_by='date',
        group_by='--',
        keep_columns='--',
        ascending=True
    )
    
    m68 = M.trade.v4(
        instruments=m9.data,
        options_data=m70.sorted_data,
        start_date='',
        end_date='',
        initialize=m68_initialize_bigquant_run,
        handle_data=m68_handle_data_bigquant_run,
        prepare=m68_prepare_bigquant_run,
        volume_limit=0,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=30000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='真实价格',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark='000300.HIX'
    )
    
    m69 = M.trade.v4(
        instruments=m9.data,
        options_data=m70.sorted_data,
        start_date='',
        end_date='',
        initialize=m69_initialize_bigquant_run,
        handle_data=m69_handle_data_bigquant_run,
        prepare=m69_prepare_bigquant_run,
        volume_limit=0,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=30000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='真实价格',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark='000300.HIX'
    )
    
    m2 = M.cached.v3(
        input_1=m11.data,
        run=m2_run_bigquant_run,
        post_run=m2_post_run_bigquant_run,
        input_ports='',
        params='{}',
        output_ports=''
    )
    
    m6 = M.trade.v4(
        instruments=m9.data,
        options_data=m2.data_1,
        start_date='',
        end_date='',
        initialize=m6_initialize_bigquant_run,
        handle_data=m6_handle_data_bigquant_run,
        prepare=m6_prepare_bigquant_run,
        volume_limit=0,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=30000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='真实价格',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark='000300.SHA'
    )
    
    In [ ]:
    pd.DataFrame([DataSource(m5.data.id).read()]).to_pickle('/home/bigquant/work/userlib/modeltianxie0915.csv')