{"description":"实验创建于2022/4/8","graph":{"edges":[{"to_node_id":"-1290:features","from_node_id":"-1278:data"},{"to_node_id":"-2427:features","from_node_id":"-1278:data"},{"to_node_id":"-1290:input_data","from_node_id":"-1283:data"},{"to_node_id":"-1079:input_data","from_node_id":"-1283:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","from_node_id":"-1290:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","from_node_id":"-1079:data"},{"to_node_id":"-186:input_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:model","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:model"},{"to_node_id":"-3135:options_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:predictions"},{"to_node_id":"-2427:input_data","from_node_id":"-2411:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:data","from_node_id":"-2427:data"},{"to_node_id":"-760:input","from_node_id":"-512:data"},{"to_node_id":"-2411:instruments","from_node_id":"-760:instrument_list"},{"to_node_id":"-3135:instruments","from_node_id":"-760:instrument_list"},{"to_node_id":"-1283:instruments","from_node_id":"-123:data"},{"to_node_id":"-512:instruments","from_node_id":"-177:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:training_ds","from_node_id":"-186:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43:features","from_node_id":"-189:data"},{"to_node_id":"-186:features","from_node_id":"-189:data"}],"nodes":[{"node_id":"-1278","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"return_1 = close/shift(close, 1)\nreturn_3 = close/shift(close, 3)\nreturn_5 = close/shift(close, 5)\namount/mean(amount,3)\nmean(amount,3)/mean(amount,5)\nrank(amount)/rank(mean(amount,5))\nrank(amount)/rank(mean(amount,3))\nrank(close/shift(close, 1))\nrank(close/shift(close, 3))\nrank(close/shift(close, 5)) \nrank(close/shift(close, 1))/rank(close/shift(close, 5)) \nrank(close/shift(close, 3))/rank(close/shift(close, 5))","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-1278"}],"output_ports":[{"name":"data","node_id":"-1278"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-1283","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_CONBOND","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}],"input_ports":[{"name":"instruments","node_id":"-1283"},{"name":"features","node_id":"-1283"}],"output_ports":[{"name":"data","node_id":"-1283"}],"cacheable":false,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-1290","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":"-1290"},{"name":"features","node_id":"-1290"}],"output_ports":[{"name":"data","node_id":"-1290"}],"cacheable":true,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-1079","module_id":"BigQuantSpace.auto_labeler_on_datasource.auto_labeler_on_datasource-v1","parameters":[{"name":"label_expr","value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/develop/datasource/deprecated/history_data.html\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":"drop_na_label","value":"True","type":"Literal","bound_global_parameter":null},{"name":"cast_label_int","value":"True","type":"Literal","bound_global_parameter":null},{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-1079"}],"output_ports":[{"name":"data","node_id":"-1079"}],"cacheable":true,"seq_num":14,"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":15,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43","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":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"features","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"test_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"base_model","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"}],"output_ports":[{"name":"model","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"feature_gains","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"},{"name":"m_lazy_run","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-43"}],"cacheable":true,"seq_num":16,"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":17,"comment":"","comment_collapsed":true},{"node_id":"-2411","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_CN_CONBOND","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}],"input_ports":[{"name":"instruments","node_id":"-2411"},{"name":"features","node_id":"-2411"}],"output_ports":[{"name":"data","node_id":"-2411"}],"cacheable":true,"seq_num":28,"comment":"","comment_collapsed":true},{"node_id":"-2427","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":"-2427"},{"name":"features","node_id":"-2427"}],"output_ports":[{"name":"data","node_id":"-2427"}],"cacheable":true,"seq_num":30,"comment":"","comment_collapsed":true},{"node_id":"-3135","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 # 加载股票指标数据,数据继承自m6模块\n context.ranker_prediction = context.options['data'].read_df()\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.00016, sell_cost=0.00116, min_cost=5))\n # 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)\n # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只\n stock_count = 5\n # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]\n #context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])\n context.stock_weights = [1/stock_count for i in range(stock_count)]\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 0.5\n context.options['hold_days'] = 10\n #大盘数据获取\n bm_df = DataSource('bar1d_index_CN_STOCK_A').read(instruments=['000001.HIX'])\n bm_df[\"bm_ret\"] = bm_df[\"close\"]/bm_df[\"close\"].shift(4)-1\n #bm_df[\"bm_ret\"] = bm_df[\"bm_ret\"].shift(1) #取昨日的收益情况\n context.bm_df = bm_df[['date','bm_ret']]\n ","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"# 交易引擎:每个单位时间开盘前调用一次。\ndef bigquant_run(context, data):\n pass","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 bigquant_run(context, data):\n \n today=data.current_dt.strftime('%Y-%m-%d')\n positions = {e: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n positions_cost={e: p.cost_basis for e,p in context.portfolio.positions.items()} \n now_bm = context.bm_df[context.bm_df.date==today]\n current_stoploss_stock = []\n current_stopwin_stock = []\n if len(positions) > 0:\n for i in positions.keys():\n stock_cost=positions_cost[i] \n stock_market_price=data.current(context.symbol(i),'price') \n # 亏5%就止损\n #if (stock_market_price - stock_cost) / stock_cost <= -0.1: \n #context.order_target_percent(context.symbol(i),0) \n #current_stoploss_stock.append(i)\n #print('日期:',date,i,'出现止损状况')\n #df = pd.DataFrame(current_stoploss_stock)\n #f=df.to_csv(\"loss.csv\")\n #stop_loss = pd.read_csv(\"loss.csv\")\n #stop_loss_stock = stop_loss.values.tolist()\n #print(stop_loss_stock\n if (stock_market_price - stock_cost ) / stock_cost >= 0.18: \n context.order_target_percent(context.symbol(i),0) \n current_stopwin_stock.append(i)\n #print('日期:',date,'股票:',i,'出现止盈状况')\n \n #context.bm_risk = 0\n if(now_bm.bm_ret.iloc[0]< -0.03):\n if len(positions)>0:\n for instrument in positions.keys():\n stock_cost=positions_cost[instrument] \n stock_market_price=data.current(context.symbol(instrument),'price') \n #volume_since_buy = data.history(context.symbol(instrument), 'volume', 6, '1d')\n # 赚4%且为可交易状态就止盈\n if stock_market_price/stock_cost-1>= 0.02 and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument),0)\n print(\"触发风控止赢!\")\n print(\"触发大盘风控!\")\n return \n #if(context.bm_risk==1):\n #print(\"触发大盘风控!\")\n #return\n \n # 按日期过滤得到今日的预测数据\n ranker_prediction = context.ranker_prediction[\n context.ranker_prediction.date == data.current_dt.strftime('%Y-%m-%d')]\n\n # 1. 资金分配\n # 平均持仓时间是hold_days,每日都将买入股票,每日预期使用 1/hold_days 的资金\n # 实际操作中,会存在一定的买入误差,所以在前hold_days天,等量使用资金;之后,尽量使用剩余资金(这里设置最多用等量的1.5倍)\n is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天)\n cash_avg = context.portfolio.portfolio_value / context.options['hold_days']\n cash_for_buy = min(context.portfolio.cash, (1 if is_staging else 1.5) * cash_avg)\n cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)\n positions = {e: p.amount * p.last_sale_price\n for e, p in context.portfolio.positions.items()}\n\n # 2. 生成卖出订单:hold_days天之后才开始卖出;对持仓的股票,按机器学习算法预测的排序末位淘汰\n if not is_staging and cash_for_sell > 0:\n equities = {e: e for e, p in context.portfolio.positions.items()}\n instruments = list(reversed(list(ranker_prediction.instrument[ranker_prediction.instrument.apply(\n lambda x: x in equities)])))\n\n for instrument in instruments:\n context.order_target(context.symbol(instrument), 0)\n cash_for_sell -= positions[instrument]\n if cash_for_sell <= 0:\n break\n\n # 3. 生成买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票\n buy_cash_weights = context.stock_weights\n buy_instruments = list(ranker_prediction.instrument[:len(buy_cash_weights)])\n max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument\n for i, instrument in enumerate(buy_instruments):\n cash = cash_for_buy * 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","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":"1000000","type":"Literal","bound_global_parameter":null},{"name":"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":"before_start_days","value":"0","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":1,"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":"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":"replay_bdb","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":"-3135"},{"name":"options_data","node_id":"-3135"},{"name":"history_ds","node_id":"-3135"},{"name":"benchmark_ds","node_id":"-3135"}],"output_ports":[{"name":"raw_perf","node_id":"-3135"}],"cacheable":false,"seq_num":19,"comment":"","comment_collapsed":true},{"node_id":"-512","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"market_performance_CN_CONBOND","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}],"input_ports":[{"name":"instruments","node_id":"-512"},{"name":"features","node_id":"-512"}],"output_ports":[{"name":"data","node_id":"-512"}],"cacheable":false,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-760","module_id":"BigQuantSpace.trade_data_generation.trade_data_generation-v1","parameters":[{"name":"category","value":"CN_STOCK","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input","node_id":"-760"}],"output_ports":[{"name":"history_data","node_id":"-760"},{"name":"instrument_list","node_id":"-760"},{"name":"calendar","node_id":"-760"}],"cacheable":false,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-123","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2017-01-03","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2018-01-09","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_CONBOND","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":"-123"}],"output_ports":[{"name":"data","node_id":"-123"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-177","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2018-01-10","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2022-12-12","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_CONBOND","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":"-177"}],"output_ports":[{"name":"data","node_id":"-177"}],"cacheable":true,"seq_num":22,"comment":"","comment_collapsed":true},{"node_id":"-186","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-186"},{"name":"features","node_id":"-186"}],"output_ports":[{"name":"data","node_id":"-186"}],"cacheable":true,"seq_num":23,"comment":"","comment_collapsed":true},{"node_id":"-189","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"return_1 \nreturn_3 \nreturn_5 \namount/mean(amount,3)\nmean(amount,3)/mean(amount,5)\nrank(amount)/rank(mean(amount,5))\nrank(amount)/rank(mean(amount,3))\nrank(close/shift(close, 1))\nrank(close/shift(close, 3))\nrank(close/shift(close, 5)) \nrank(close/shift(close, 1))/rank(close/shift(close, 5)) \nrank(close/shift(close, 3))/rank(close/shift(close, 5))","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-189"}],"output_ports":[{"name":"data","node_id":"-189"}],"cacheable":true,"seq_num":18,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-1278' Position='1318,-545,200,200'/><node_position Node='-1283' Position='982,-486,200,200'/><node_position Node='-1290' Position='1194,-247,200,200'/><node_position Node='-1079' Position='816,-321,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='1097,-104,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-43' Position='1265,107,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-60' Position='1471,245,200,200'/><node_position Node='-2411' Position='1729,-192,200,200'/><node_position Node='-2427' Position='1722,6,200,200'/><node_position Node='-3135' Position='1742,400,200,200'/><node_position Node='-512' Position='1734,-522,200,200'/><node_position Node='-760' Position='1764,-401,200,200'/><node_position Node='-123' Position='980,-585,200,200'/><node_position Node='-177' Position='1736,-620,200,200'/><node_position Node='-186' Position='1107,0,200,200'/><node_position Node='-189' Position='1432,-121,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2022-12-14 14:45:36.564640] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-12-14 14:45:36.575031] INFO: moduleinvoker: 命中缓存
[2022-12-14 14:45:36.577693] INFO: moduleinvoker: input_features.v1 运行完成[0.013074s].
[2022-12-14 14:45:36.585565] INFO: moduleinvoker: instruments.v2 开始运行..
[2022-12-14 14:45:36.593487] INFO: moduleinvoker: 命中缓存
[2022-12-14 14:45:36.596118] INFO: moduleinvoker: instruments.v2 运行完成[0.010537s].
[2022-12-14 14:45:36.604207] INFO: moduleinvoker: use_datasource.v1 开始运行..
[2022-12-14 14:45:36.794376] INFO: moduleinvoker: use_datasource.v1 运行完成[0.190179s].
[2022-12-14 14:45:36.802522] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2022-12-14 14:45:36.865030] INFO: derived_feature_extractor: 提取完成 return_1 = close/shift(close, 1), 0.004s
[2022-12-14 14:45:36.870459] INFO: derived_feature_extractor: 提取完成 return_3 = close/shift(close, 3), 0.004s
[2022-12-14 14:45:36.875970] INFO: derived_feature_extractor: 提取完成 return_5 = close/shift(close, 5), 0.004s
[2022-12-14 14:45:36.887509] INFO: derived_feature_extractor: 提取完成 amount/mean(amount,3), 0.010s
[2022-12-14 14:45:36.927778] INFO: derived_feature_extractor: 提取完成 mean(amount,3)/mean(amount,5), 0.039s
[2022-12-14 14:45:36.947558] INFO: derived_feature_extractor: 提取完成 rank(amount)/rank(mean(amount,5)), 0.018s
[2022-12-14 14:45:36.968399] INFO: derived_feature_extractor: 提取完成 rank(amount)/rank(mean(amount,3)), 0.019s
[2022-12-14 14:45:36.978446] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 1)), 0.008s
[2022-12-14 14:45:37.028291] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 3)), 0.048s
[2022-12-14 14:45:37.042938] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 5)), 0.012s
[2022-12-14 14:45:37.067983] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 1))/rank(close/shift(close, 5)), 0.023s
[2022-12-14 14:45:37.121816] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 3))/rank(close/shift(close, 5)), 0.051s
[2022-12-14 14:45:37.187412] INFO: derived_feature_extractor: /data, 5038
[2022-12-14 14:45:37.256288] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[0.453748s].
[2022-12-14 14:45:37.265142] INFO: moduleinvoker: auto_labeler_on_datasource.v1 开始运行..
[2022-12-14 14:45:37.332564] INFO: 自动标注(任意数据源): 开始标注 ..
[2022-12-14 14:45:37.420858] INFO: moduleinvoker: auto_labeler_on_datasource.v1 运行完成[0.155706s].
[2022-12-14 14:45:37.431349] INFO: moduleinvoker: join.v3 开始运行..
[2022-12-14 14:45:37.589008] INFO: join: /data, 行数=4627/5038, 耗时=0.077806s
[2022-12-14 14:45:37.616866] INFO: join: 最终行数: 4627
[2022-12-14 14:45:37.623832] INFO: moduleinvoker: join.v3 运行完成[0.192493s].
[2022-12-14 14:45:37.629534] INFO: moduleinvoker: instruments.v2 开始运行..
[2022-12-14 14:45:37.636711] INFO: moduleinvoker: 命中缓存
[2022-12-14 14:45:37.638970] INFO: moduleinvoker: instruments.v2 运行完成[0.00944s].
[2022-12-14 14:45:37.645013] INFO: moduleinvoker: use_datasource.v1 开始运行..
[2022-12-14 14:45:40.813138] INFO: moduleinvoker: use_datasource.v1 运行完成[3.168113s].
[2022-12-14 14:45:40.826504] INFO: moduleinvoker: trade_data_generation.v1 开始运行..
[2022-12-14 14:45:45.975357] INFO: moduleinvoker: trade_data_generation.v1 运行完成[5.148845s].
[2022-12-14 14:45:45.981459] INFO: moduleinvoker: use_datasource.v1 开始运行..
[2022-12-14 14:45:46.944241] INFO: moduleinvoker: use_datasource.v1 运行完成[0.962784s].
[2022-12-14 14:45:46.954868] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2022-12-14 14:45:48.293105] INFO: derived_feature_extractor: 提取完成 return_1 = close/shift(close, 1), 0.057s
[2022-12-14 14:45:48.351892] INFO: derived_feature_extractor: 提取完成 return_3 = close/shift(close, 3), 0.056s
[2022-12-14 14:45:48.397491] INFO: derived_feature_extractor: 提取完成 return_5 = close/shift(close, 5), 0.044s
[2022-12-14 14:45:48.744882] INFO: derived_feature_extractor: 提取完成 amount/mean(amount,3), 0.345s
[2022-12-14 14:45:49.441398] INFO: derived_feature_extractor: 提取完成 mean(amount,3)/mean(amount,5), 0.695s
[2022-12-14 14:45:50.057560] INFO: derived_feature_extractor: 提取完成 rank(amount)/rank(mean(amount,5)), 0.614s
[2022-12-14 14:45:50.730301] INFO: derived_feature_extractor: 提取完成 rank(amount)/rank(mean(amount,3)), 0.670s
[2022-12-14 14:45:50.940165] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 1)), 0.207s
[2022-12-14 14:45:51.142089] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 3)), 0.199s
[2022-12-14 14:45:51.347537] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 5)), 0.203s
[2022-12-14 14:45:51.755335] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 1))/rank(close/shift(close, 5)), 0.406s
[2022-12-14 14:45:52.165398] INFO: derived_feature_extractor: 提取完成 rank(close/shift(close, 3))/rank(close/shift(close, 5)), 0.408s
[2022-12-14 14:45:53.500364] INFO: derived_feature_extractor: /data, 305159
[2022-12-14 14:45:53.921190] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[6.966323s].
[2022-12-14 14:45:53.927109] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-12-14 14:45:53.933959] INFO: moduleinvoker: 命中缓存
[2022-12-14 14:45:53.935887] INFO: moduleinvoker: input_features.v1 运行完成[0.008789s].
[2022-12-14 14:45:53.944790] INFO: moduleinvoker: dropnan.v2 开始运行..
[2022-12-14 14:45:54.058900] INFO: dropnan: /data, 4439/4627
[2022-12-14 14:45:54.097447] INFO: dropnan: 行数: 4439/4627
[2022-12-14 14:45:54.102618] INFO: moduleinvoker: dropnan.v2 运行完成[0.15782s].
[2022-12-14 14:45:54.111524] INFO: moduleinvoker: stock_ranker_train.v6 开始运行..
[2022-12-14 14:45:54.246330] INFO: StockRanker: 特征预处理 ..
[2022-12-14 14:45:54.275970] INFO: StockRanker: prepare data: training ..
[2022-12-14 14:45:54.437319] INFO: StockRanker训练: f4caa970 准备训练: 4439 行数
[2022-12-14 14:45:54.439653] INFO: StockRanker训练: AI模型训练,将在4439*12=5.33万数据上对模型训练进行20轮迭代训练。预计将需要1~2分钟。请耐心等待。
[2022-12-14 14:45:54.676251] INFO: StockRanker训练: 正在训练 ..
[2022-12-14 14:45:54.724920] INFO: StockRanker训练: 任务状态: Pending
[2022-12-14 14:46:04.776575] INFO: StockRanker训练: 任务状态: Running
[2022-12-14 14:47:05.161575] INFO: StockRanker训练: 00:01:01.3491826, finished iteration 1
[2022-12-14 14:47:05.163740] INFO: StockRanker训练: 00:01:01.3551678, finished iteration 2
[2022-12-14 14:47:05.165470] INFO: StockRanker训练: 00:01:01.3581604, finished iteration 3
[2022-12-14 14:47:05.167368] INFO: StockRanker训练: 00:01:01.3608722, finished iteration 4
[2022-12-14 14:47:05.169565] INFO: StockRanker训练: 00:01:01.3637664, finished iteration 5
[2022-12-14 14:47:05.171347] INFO: StockRanker训练: 00:01:01.3663698, finished iteration 6
[2022-12-14 14:47:05.173109] INFO: StockRanker训练: 00:01:01.3697560, finished iteration 7
[2022-12-14 14:47:05.174722] INFO: StockRanker训练: 00:01:01.3725862, finished iteration 8
[2022-12-14 14:47:05.176165] INFO: StockRanker训练: 00:01:01.3753337, finished iteration 9
[2022-12-14 14:47:05.177622] INFO: StockRanker训练: 00:01:01.3781443, finished iteration 10
[2022-12-14 14:47:05.221534] INFO: StockRanker训练: 00:01:01.3809067, finished iteration 11
[2022-12-14 14:47:05.223658] INFO: StockRanker训练: 00:01:01.3836530, finished iteration 12
[2022-12-14 14:47:05.225522] INFO: StockRanker训练: 00:01:01.3867657, finished iteration 13
[2022-12-14 14:47:05.227708] INFO: StockRanker训练: 00:01:01.3894462, finished iteration 14
[2022-12-14 14:47:05.229419] INFO: StockRanker训练: 00:01:01.3927826, finished iteration 15
[2022-12-14 14:47:05.231307] INFO: StockRanker训练: 00:01:01.3955108, finished iteration 16
[2022-12-14 14:47:05.233836] INFO: StockRanker训练: 00:01:01.3983577, finished iteration 17
[2022-12-14 14:47:05.237010] INFO: StockRanker训练: 00:01:01.4014638, finished iteration 18
[2022-12-14 14:47:05.240169] INFO: StockRanker训练: 00:01:01.4045829, finished iteration 19
[2022-12-14 14:47:05.243190] INFO: StockRanker训练: 00:01:01.4070679, finished iteration 20
[2022-12-14 14:47:05.245843] INFO: StockRanker训练: 任务状态: Succeeded
[2022-12-14 14:47:05.623480] INFO: moduleinvoker: stock_ranker_train.v6 运行完成[71.51196s].
[2022-12-14 14:47:05.635504] INFO: moduleinvoker: stock_ranker_predict.v5 开始运行..
[2022-12-14 14:47:11.526208] INFO: StockRanker预测: /data ..
[2022-12-14 14:47:16.443507] INFO: moduleinvoker: stock_ranker_predict.v5 运行完成[10.807983s].
[2022-12-14 14:47:16.542992] INFO: moduleinvoker: hfbacktest.v1 开始运行..
[2022-12-14 14:47:16.549163] INFO: hfbacktest: biglearning V1.4.19
[2022-12-14 14:47:16.551165] INFO: hfbacktest: bigtrader v1.9.11 2022-12-09
[2022-12-14 14:47:16.634240] INFO: moduleinvoker: cached.v2 开始运行..
[2022-12-14 14:47:16.648385] INFO: moduleinvoker: 命中缓存
[2022-12-14 14:47:16.650765] INFO: moduleinvoker: cached.v2 运行完成[0.016547s].
[2022-12-14 14:47:16.842500] INFO: moduleinvoker: cached.v2 开始运行..
[2022-12-14 14:47:16.851891] INFO: moduleinvoker: 命中缓存
[2022-12-14 14:47:16.855529] INFO: moduleinvoker: cached.v2 运行完成[0.013043s].
[2022-12-14 14:47:39.936279] ERROR: moduleinvoker: module name: hfbacktest, module version: v1, trackeback: ZeroDivisionError: float division by zero
[2022-12-14 14:47:39.946309] ERROR: moduleinvoker: module name: hftrade, module version: v2, trackeback: ZeroDivisionError: float division by zero
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-42160908c3e94e0cbf892f1194e3c5a7"}/bigcharts-data-end
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发大盘风控!
触发大盘风控!
触发大盘风控!
触发大盘风控!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发大盘风控!
触发大盘风控!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发大盘风控!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发风控止赢!
触发风控止赢!
触发风控止赢!
触发大盘风控!
触发大盘风控!
触发风控止赢!
触发风控止赢!
触发大盘风控!
2022-12-14 14:47:39.935205 strategy strategy exception:Traceback (most recent call last):
File "bigtrader/strategy/engine.py", line 713, in bigtrader2.bigtrader.strategy.engine.StrategyEngine._call_strategy_func
File "bigtrader/strategy/strategy_base.py", line 2275, in bigtrader2.bigtrader.strategy.strategy_base.StrategyBase.call_handle_data
File "<ipython-input-7-309825713890>", line 58, in m19_handle_data_bigquant_run
if (stock_market_price - stock_cost ) / stock_cost >= 0.18:
ZeroDivisionError: float division by zero
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-7-309825713890> in <module>
285 )
286
--> 287 m19 = M.hftrade.v2(
288 instruments=m2.instrument_list,
289 options_data=m17.predictions,
<ipython-input-7-309825713890> in m19_handle_data_bigquant_run(context, data)
56 #stop_loss_stock = stop_loss.values.tolist()
57 #print(stop_loss_stock
---> 58 if (stock_market_price - stock_cost ) / stock_cost >= 0.18:
59 context.order_target_percent(context.symbol(i),0)
60 current_stopwin_stock.append(i)
ZeroDivisionError: float division by zero