key error:name


(suhanxue) #1
克隆策略

    {"Description":"实验创建于2017/8/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"DestinationInputPortId":"-404:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:data"},{"DestinationInputPortId":"-318:features_ds","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"DestinationInputPortId":"-193:input_1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"},{"DestinationInputPortId":"-329:data1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:predictions"},{"DestinationInputPortId":"-418:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-1918:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-224:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-174:input_1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-8068:training_ds","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:data","SourceOutputPortId":"-86:data"},{"DestinationInputPortId":"-323:input_ds","SourceOutputPortId":"-86:data"},{"DestinationInputPortId":"-411:input_data","SourceOutputPortId":"-404:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","SourceOutputPortId":"-411:data"},{"DestinationInputPortId":"-425:input_data","SourceOutputPortId":"-418:data"},{"DestinationInputPortId":"-86:input_data","SourceOutputPortId":"-425:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:model","SourceOutputPortId":"-8068:model"},{"DestinationInputPortId":"-224:features","SourceOutputPortId":"-148:data"},{"DestinationInputPortId":"-174:input_2","SourceOutputPortId":"-184:data"},{"DestinationInputPortId":"-202:data2","SourceOutputPortId":"-189:data"},{"DestinationInputPortId":"-189:data2","SourceOutputPortId":"-196:data"},{"DestinationInputPortId":"-6898:input_1","SourceOutputPortId":"-202:data"},{"DestinationInputPortId":"-189:data1","SourceOutputPortId":"-224:data"},{"DestinationInputPortId":"-418:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-425:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-8068:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-404:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-411:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-329:data2","SourceOutputPortId":"-323:data"},{"DestinationInputPortId":"-202:data1","SourceOutputPortId":"-329:data"},{"DestinationInputPortId":"-1918:options_data","SourceOutputPortId":"-490:sorted_data"},{"DestinationInputPortId":"-196:input_ds","SourceOutputPortId":"-174:data_1"},{"DestinationInputPortId":"-490:input_ds","SourceOutputPortId":"-6892:data"},{"DestinationInputPortId":"-6892:input_1","SourceOutputPortId":"-6898:data_1"},{"DestinationInputPortId":"-200:input_1","SourceOutputPortId":"-193:data_1"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:input_data","SourceOutputPortId":"-200:data"}],"ModuleNodes":[{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2010-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2017-12-31","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15","ModuleId":"BigQuantSpace.advanced_auto_labeler.advanced_auto_labeler-v2","ModuleParameters":[{"Name":"label_expr","Value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/data_history_data.html\n# 添加benchmark_前缀,可使用对应的benchmark数据\n# 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/big_expr.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\nshift(close, -2) / 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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"000300.SHA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na_label","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"cast_label_int","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\n# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\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\nwhere((open_0>close_1)&(mean(close_0,5)>mean(close_0,10)),1,0)\npe_ttm_0\n\n\n# 夏普比率降序\nrank_pb_lf_0\nrank_market_cap_0\nrank_market_cap_float_0\n#wq_54\n#gtja_95\n\n(close_0-mean(close_0,12))/mean(close_0,12)*100\nrank(std(amount_0,15))\nrank_avg_amount_0/rank_avg_amount_8\nts_argmin(low_0,20)\nrank_return_30\n(low_1-close_0)/close_0\nta_bbands_lowerband_14_0\nmean(mf_net_pct_s_0,4)\namount_0/avg_amount_3\nreturn_0/return_5\nreturn_1/return_5\nrank_avg_amount_7/rank_avg_amount_10\nta_sma_10_0/close_0\nsqrt(high_0*low_0)-amount_0/volume_0*adjust_factor_0\navg_turn_15/(turn_0+1e-5)\nreturn_10\nmf_net_pct_s_0\n(close_0-open_0)/close_1\n\n\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"inner","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","ModuleId":"BigQuantSpace.stock_ranker_predict.stock_ranker_predict-v5","ModuleParameters":[{"Name":"m_lazy_run","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"model","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"}],"OutputPortsInternal":[{"Name":"predictions","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","OutputType":null},{"Name":"m_lazy_run","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":8,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"end_date","Value":"2019-12-31","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"IsPartOfPartialRun":null,"Comment":"预测数据,用于回测和模拟","CommentCollapsed":false},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":13,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-86","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-86"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-86","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":14,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-404","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-404"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-404"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-404","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":15,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-411","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-411"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-411"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-411","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":16,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-418","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-418"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-418"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-418","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":17,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-425","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-425"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-425"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-425","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":18,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1918","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":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 = 3\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 # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 0.6\n context.options['hold_days'] = 1\n\n from zipline.finance.slippage import SlippageModel\n class FixedPriceSlippage(SlippageModel):\n def process_order(self, data, order, bar_volume=0, trigger_check_price=0):\n if order.limit is None:\n price_field = self._price_field_buy if order.amount > 0 else self._price_field_sell\n price = data.current(order.asset, price_field)\n else:\n price = data.current(order.asset, self._price_field_buy)\n # 返回希望成交的价格和数量\n return (price, order.amount)\n # 设置price_field,默认是开盘买入,收盘卖出\n context.fix_slippage = FixedPriceSlippage(price_field_buy='open', price_field_sell='close')\n context.set_slippage(us_equities=context.fix_slippage)\n \n\n \n\n ","ValueType":"Literal","LinkedGlobalParameter":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 \n #大盘风控模块,读取风控数据 \n benckmark_risk=ranker_prediction['bm_0'].values[0]\n\n #当risk为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 \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 \n \n # 2. 根据需要加入移动止赢止损模块、固定天数卖出模块、ST或退市股卖出模块\n stock_sold = [] # 记录卖出的股票,防止多次卖出出现空单\n \n #------------------------START:止赢止损模块(含建仓期)---------------\n current_stopwin_stock=[]\n current_stoploss_stock = [] \n positions_cost={e.symbol:p.cost_basis for e,p in context.portfolio.positions.items()}\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 # 赚9%且为可交易状态就止盈\n if stock_market_price/stock_cost-1>=0.30 and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument),0)\n cash_for_sell -= positions[instrument]\n current_stopwin_stock.append(instrument)\n if len(current_stopwin_stock)>0:\n print(today,'止盈股票列表',current_stopwin_stock)\n stock_sold += current_stopwin_stock\n #--------------------------END: 止赢止损模块--------------------------\n \n #------------------------------------------止损模块START--------------------------------------------\n equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}\n \n # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断\n stoploss_stock = [] \n if len(equities) > 0:\n for i in equities.keys():\n stock_market_price = data.current(context.symbol(i), 'price') # 最新市场价格\n last_sale_date = equities[i].last_sale_date # 上次交易日期\n delta_days = data.current_dt - last_sale_date \n hold_days = delta_days.days # 持仓天数\n # 建仓以来的最高价\n highest_price_since_buy = data.history(context.symbol(i), 'high', hold_days, '1d').max()\n # 确定止损位置\n stoploss_line = highest_price_since_buy - highest_price_since_buy * 0.03\n #record('止损位置', stoploss_line)\n # 如果价格下穿止损位置\n if stock_market_price < stoploss_line:\n context.order_target_percent(context.symbol(i), 0) \n stoploss_stock.append(i)\n if len(stoploss_stock)>0:\n print('日期:', today, '股票:', stoploss_stock, '出现跟踪止损状况')\n #-------------------------------------------止损模块END--------------------------------------------- \n \n #--------------------------START:持有固定天数卖出(不含建仓期)-----------\n current_stopdays_stock = []\n positions_lastdate = {e.symbol:p.last_sale_date for e,p in context.portfolio.positions.items()}\n # 不是建仓期(在前hold_days属于建仓期)\n if not is_staging:\n for instrument in positions.keys():\n #如果上面的止盈止损已经卖出过了,就不要重复卖出以防止产生空单\n if instrument in stock_sold:\n continue\n # 今天和上次交易的时间相隔hold_days就全部卖出 datetime.timedelta(context.options['hold_days'])也可以换成自己需要的天数,比如datetime.timedelta(5)\n if data.current_dt - positions_lastdate[instrument]>=datetime.timedelta(1) and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument), 0)\n current_stopdays_stock.append(instrument)\n cash_for_sell -= positions[instrument]\n if len(current_stopdays_stock)>0: \n print(today,'固定天数卖出列表',current_stopdays_stock)\n stock_sold += current_stopdays_stock\n #------------------------- END:持有固定天数卖出-----------------------\n\n\n # 4. 生成轮仓买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票\n # 计算今日跌停的股票\n dt_list = list(ranker_prediction[ranker_prediction.price_limit_status_0==1].instrument)\n # 计算所有禁止买入的股票池\n banned_list = stock_sold+dt_list\n buy_cash_weights = context.stock_weights\n buy_instruments=[k for k in list(ranker_prediction.instrument) if k not in banned_list][: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\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"def bigquant_run(context, data):\n # 获取涨跌停状态数据\n df_price_limit_status = context.ranker_prediction.set_index('date')\n today=data.current_dt.strftime('%Y-%m-%d')\n # 得到当前未完成订单\n for orders in get_open_orders().values():\n # 循环,撤销订单\n for _order in orders:\n ins=str(_order.sid.symbol)\n try:\n #判断一下如果当日涨停,则取消卖单\n if df_price_limit_status[df_price_limit_status.instrument==ins].price_limit_status_0.ix[today]>2 and _order.amount<0:\n cancel_order(_order)\n print(today,'尾盘涨停取消卖单',ins) \n except:\n continue","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"volume_limit","Value":0.025,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_buy","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_sell","Value":"close","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":"300000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"daily","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"price_type","Value":"后复权","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"product_type","Value":"股票","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"plot_charts","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"backtest_only","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-1918"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-1918","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-8068","ModuleId":"BigQuantSpace.stock_ranker_train.stock_ranker_train-v6","ModuleParameters":[{"Name":"learning_algorithm","Value":"排序","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"number_of_leaves","Value":30,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"minimum_docs_per_leaf","Value":1000,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"number_of_trees","Value":20,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"learning_rate","Value":0.1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_bins","Value":1023,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"feature_fraction","Value":1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_row_fraction","Value":1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"ndcg_discount_base","Value":1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"m_lazy_run","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"training_ds","NodeId":"-8068"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-8068"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"test_ds","NodeId":"-8068"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"base_model","NodeId":"-8068"}],"OutputPortsInternal":[{"Name":"model","NodeId":"-8068","OutputType":null},{"Name":"feature_gains","NodeId":"-8068","OutputType":null},{"Name":"m_lazy_run","NodeId":"-8068","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-148","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nname","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-148"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-148","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":20,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-184","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nbm_0 = where(close/shift(close,5)-1<-0.05,1,0)","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-184"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-184","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":24,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-189","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"left","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-189"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-189"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-189","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":25,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-196","ModuleId":"BigQuantSpace.select_columns.select_columns-v3","ModuleParameters":[{"Name":"columns","Value":"date,bm_0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"reverse_select","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-196"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"columns_ds","NodeId":"-196"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-196","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":26,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-202","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"left","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-202"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-202"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-202","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":27,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-224","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"instruments_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-224"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-224"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-224","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":22,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-318","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nprice_limit_status_0\n\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-318"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-318","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-323","ModuleId":"BigQuantSpace.select_columns.select_columns-v3","ModuleParameters":[{"Name":"columns","Value":"date,instrument,price_limit_status_0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"reverse_select","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-323"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"columns_ds","NodeId":"-323"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-323","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":10,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-329","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"inner","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-329"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-329"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-329","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":11,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-490","ModuleId":"BigQuantSpace.sort.sort-v4","ModuleParameters":[{"Name":"sort_by","Value":"position","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"group_by","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"keep_columns","Value":"--","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"ascending","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-490"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"sort_by_ds","NodeId":"-490"}],"OutputPortsInternal":[{"Name":"sorted_data","NodeId":"-490","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":12,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-174","ModuleId":"BigQuantSpace.index_feature_extract.index_feature_extract-v3","ModuleParameters":[{"Name":"before_days","Value":100,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"index","Value":"000300.HIX","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-174"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-174"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-174","OutputType":null},{"Name":"data_2","NodeId":"-174","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":19,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-6892","ModuleId":"BigQuantSpace.filter_delist_stocks.filter_delist_stocks-v3","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-6892"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-6892","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":29,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-6898","ModuleId":"BigQuantSpace.filter_stockcode.filter_stockcode-v2","ModuleParameters":[{"Name":"start","Value":"688","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-6898"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-6898","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":31,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-193","ModuleId":"BigQuantSpace.filter_stockcode.filter_stockcode-v2","ModuleParameters":[{"Name":"start","Value":"688","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-193"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-193","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":21,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-200","ModuleId":"BigQuantSpace.filter_delist_stocks.filter_delist_stocks-v3","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-200"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-200","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":28,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='248,98,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-15' Position='79,197,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='698,42,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='268,365,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-60' Position='782,629,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='1001,129,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-84' Position='269,702,200,200'/><NodePosition Node='-86' Position='1011,485,200,200'/><NodePosition Node='-404' Position='381,188,200,200'/><NodePosition Node='-411' Position='385,280,200,200'/><NodePosition Node='-418' Position='1002,254,200,200'/><NodePosition Node='-425' Position='1008,376,200,200'/><NodePosition Node='-1918' Position='1266,954,200,200'/><NodePosition Node='-8068' Position='591,536,200,200'/><NodePosition Node='-148' Position='1399,464,200,200'/><NodePosition Node='-184' Position='1708,360,200,200'/><NodePosition Node='-189' Position='1506,682,200,200'/><NodePosition Node='-196' Position='1690,564,200,200'/><NodePosition Node='-202' Position='1240,798,200,200'/><NodePosition Node='-224' Position='1396,562,200,200'/><NodePosition Node='-318' Position='696,129,200,200'/><NodePosition Node='-323' Position='1079,598,200,200'/><NodePosition Node='-329' Position='1083,704,200,200'/><NodePosition Node='-490' Position='1311,876,200,200'/><NodePosition Node='-174' Position='1709,464,200,200'/><NodePosition Node='-6892' Position='864,972,200,200'/><NodePosition Node='-6898' Position='866,821,200,200'/><NodePosition Node='-193' Position='265,469,200,200'/><NodePosition Node='-200' Position='268,591,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
    In [6]:
    # 本代码由可视化策略环境自动生成 2020年3月21日 11:49
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # 回测引擎:初始化函数,只执行一次
    def m4_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 = 3
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument = 0.6
        context.options['hold_days'] = 1
    
        from zipline.finance.slippage import SlippageModel
        class FixedPriceSlippage(SlippageModel):
            def process_order(self, data, order, bar_volume=0, trigger_check_price=0):
                if order.limit is None:
                    price_field = self._price_field_buy if order.amount > 0 else self._price_field_sell
                    price = data.current(order.asset, price_field)
                else:
                    price = data.current(order.asset, self._price_field_buy)
                # 返回希望成交的价格和数量
                return (price, order.amount)
        # 设置price_field,默认是开盘买入,收盘卖出
        context.fix_slippage = FixedPriceSlippage(price_field_buy='open', price_field_sell='close')
        context.set_slippage(us_equities=context.fix_slippage)
        
    
        
    
       
    # 回测引擎:每日数据处理函数,每天执行一次
    def m4_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]
        
        #大盘风控模块,读取风控数据    
        benckmark_risk=ranker_prediction['bm_0'].values[0]
    
        #当risk为1时,市场有风险,全部平仓,不再执行其它操作
        if benckmark_risk > 0:
            for instrument in positions.keys():
                context.order_target(context.symbol(instrument), 0)
            print(today,'大盘风控止损触发,全仓卖出')
            return
        
        # 1. 资金分配
        # 平均持仓时间是hold_days,每日都将买入股票,每日预期使用 1/hold_days 的资金
        # 实际操作中,会存在一定的买入误差,所以在前hold_days天,等量使用资金;之后,尽量使用剩余资金(这里设置最多用等量的1.5倍)
        is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天)
        cash_avg = context.portfolio.portfolio_value / context.options['hold_days']
        cash_for_buy = min(context.portfolio.cash, (1 if is_staging else 1.5) * cash_avg)
        cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)
       
        
        # 2. 根据需要加入移动止赢止损模块、固定天数卖出模块、ST或退市股卖出模块
        stock_sold = [] # 记录卖出的股票,防止多次卖出出现空单
        
        #------------------------START:止赢止损模块(含建仓期)---------------
        current_stopwin_stock=[]
        current_stoploss_stock = []   
        positions_cost={e.symbol:p.cost_basis for e,p in context.portfolio.positions.items()}
        if len(positions)>0:
            for instrument in positions.keys():
                stock_cost=positions_cost[instrument]  
                stock_market_price=data.current(context.symbol(instrument),'price')  
                # 赚9%且为可交易状态就止盈
                if stock_market_price/stock_cost-1>=0.30 and data.can_trade(context.symbol(instrument)):
                    context.order_target_percent(context.symbol(instrument),0)
                    cash_for_sell -= positions[instrument]
                    current_stopwin_stock.append(instrument)
            if len(current_stopwin_stock)>0:
                print(today,'止盈股票列表',current_stopwin_stock)
                stock_sold += current_stopwin_stock
        #--------------------------END: 止赢止损模块--------------------------
        
        #------------------------------------------止损模块START--------------------------------------------
        equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}
        
        # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断
        stoploss_stock = [] 
        if len(equities) > 0:
            for i in equities.keys():
                stock_market_price = data.current(context.symbol(i), 'price')  # 最新市场价格
                last_sale_date = equities[i].last_sale_date   # 上次交易日期
                delta_days = data.current_dt - last_sale_date  
                hold_days = delta_days.days # 持仓天数
                # 建仓以来的最高价
                highest_price_since_buy = data.history(context.symbol(i), 'high', hold_days, '1d').max()
                # 确定止损位置
                stoploss_line = highest_price_since_buy - highest_price_since_buy * 0.03
                #record('止损位置', stoploss_line)
                # 如果价格下穿止损位置
                if stock_market_price < stoploss_line:
                    context.order_target_percent(context.symbol(i), 0)     
                    stoploss_stock.append(i)
            if len(stoploss_stock)>0:
                print('日期:', today, '股票:', stoploss_stock, '出现跟踪止损状况')
        #-------------------------------------------止损模块END--------------------------------------------- 
        
        #--------------------------START:持有固定天数卖出(不含建仓期)-----------
        current_stopdays_stock = []
        positions_lastdate = {e.symbol:p.last_sale_date for e,p in context.portfolio.positions.items()}
        # 不是建仓期(在前hold_days属于建仓期)
        if not is_staging:
            for instrument in positions.keys():
                #如果上面的止盈止损已经卖出过了,就不要重复卖出以防止产生空单
                if instrument in stock_sold:
                    continue
                # 今天和上次交易的时间相隔hold_days就全部卖出 datetime.timedelta(context.options['hold_days'])也可以换成自己需要的天数,比如datetime.timedelta(5)
                if data.current_dt - positions_lastdate[instrument]>=datetime.timedelta(1) and data.can_trade(context.symbol(instrument)):
                    context.order_target_percent(context.symbol(instrument), 0)
                    current_stopdays_stock.append(instrument)
                    cash_for_sell -= positions[instrument]
            if len(current_stopdays_stock)>0:        
                print(today,'固定天数卖出列表',current_stopdays_stock)
                stock_sold += current_stopdays_stock
        #-------------------------  END:持有固定天数卖出-----------------------
    
    
        # 4. 生成轮仓买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票
        # 计算今日跌停的股票
        dt_list = list(ranker_prediction[ranker_prediction.price_limit_status_0==1].instrument)
        # 计算所有禁止买入的股票池
        banned_list = stock_sold+dt_list
        buy_cash_weights = context.stock_weights
        buy_instruments=[k for k in list(ranker_prediction.instrument) if k not in banned_list][:len(buy_cash_weights)]
        max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
        for i, instrument in enumerate(buy_instruments):
            cash = cash_for_buy * 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 m4_prepare_bigquant_run(context):
        pass
    def m4_before_trading_start_bigquant_run(context, data):
        # 获取涨跌停状态数据
        df_price_limit_status = context.ranker_prediction.set_index('date')
        today=data.current_dt.strftime('%Y-%m-%d')
        # 得到当前未完成订单
        for orders in get_open_orders().values():
            # 循环,撤销订单
            for _order in orders:
                ins=str(_order.sid.symbol)
                try:
                    #判断一下如果当日涨停,则取消卖单
                    if  df_price_limit_status[df_price_limit_status.instrument==ins].price_limit_status_0.ix[today]>2 and _order.amount<0:
                        cancel_order(_order)
                        print(today,'尾盘涨停取消卖单',ins) 
                except:
                    continue
    
    m1 = M.instruments.v2(
        start_date='2010-01-01',
        end_date='2017-12-31',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.advanced_auto_labeler.v2(
        instruments=m1.data,
        label_expr="""# #号开始的表示注释
    # 0. 每行一个,顺序执行,从第二个开始,可以使用label字段
    # 1. 可用数据字段见 https://bigquant.com/docs/data_history_data.html
    #   添加benchmark_前缀,可使用对应的benchmark数据
    # 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/big_expr.html>`_
    
    # 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)
    shift(close, -2) / shift(open, -1)
    
    # 极值处理:用1%和99%分位的值做clip
    clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))
    
    # 将分数映射到分类,这里使用20个分类
    all_wbins(label, 20)
    
    # 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)
    where(shift(high, -1) == shift(low, -1), NaN, label)
    """,
        start_date='',
        end_date='',
        benchmark='000300.SHA',
        drop_na_label=True,
        cast_label_int=True
    )
    
    m3 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    # #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    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
    where((open_0>close_1)&(mean(close_0,5)>mean(close_0,10)),1,0)
    pe_ttm_0
    
    
    # 夏普比率降序
    rank_pb_lf_0
    rank_market_cap_0
    rank_market_cap_float_0
    #wq_54
    #gtja_95
    
    (close_0-mean(close_0,12))/mean(close_0,12)*100
    rank(std(amount_0,15))
    rank_avg_amount_0/rank_avg_amount_8
    ts_argmin(low_0,20)
    rank_return_30
    (low_1-close_0)/close_0
    ta_bbands_lowerband_14_0
    mean(mf_net_pct_s_0,4)
    amount_0/avg_amount_3
    return_0/return_5
    return_1/return_5
    rank_avg_amount_7/rank_avg_amount_10
    ta_sma_10_0/close_0
    sqrt(high_0*low_0)-amount_0/volume_0*adjust_factor_0
    avg_turn_15/(turn_0+1e-5)
    return_10
    mf_net_pct_s_0
    (close_0-open_0)/close_1
    
    
    """
    )
    
    m6 = M.input_features.v1(
        features_ds=m3.data,
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    price_limit_status_0
    
    """
    )
    
    m15 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m6.data,
        start_date='',
        end_date='',
        before_start_days=0
    )
    
    m16 = M.derived_feature_extractor.v3(
        input_data=m15.data,
        features=m6.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m7 = M.join.v3(
        data1=m2.data,
        data2=m16.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m21 = M.filter_stockcode.v2(
        input_1=m7.data,
        start='688'
    )
    
    m28 = M.filter_delist_stocks.v3(
        input_1=m21.data_1
    )
    
    m13 = M.dropnan.v1(
        input_data=m28.data
    )
    
    m5 = M.stock_ranker_train.v6(
        training_ds=m13.data,
        features=m6.data,
        learning_algorithm='排序',
        number_of_leaves=30,
        minimum_docs_per_leaf=1000,
        number_of_trees=20,
        learning_rate=0.1,
        max_bins=1023,
        feature_fraction=1,
        data_row_fraction=1,
        ndcg_discount_base=1,
        m_lazy_run=False
    )
    
    m9 = M.instruments.v2(
        start_date=T.live_run_param('trading_date', '2018-01-01'),
        end_date=T.live_run_param('trading_date', '2019-12-31'),
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m17 = M.general_feature_extractor.v7(
        instruments=m9.data,
        features=m6.data,
        start_date='',
        end_date='',
        before_start_days=0
    )
    
    m18 = M.derived_feature_extractor.v3(
        input_data=m17.data,
        features=m6.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False
    )
    
    m14 = M.dropnan.v1(
        input_data=m18.data
    )
    
    m8 = M.stock_ranker_predict.v5(
        model=m5.model,
        data=m14.data,
        m_lazy_run=False
    )
    
    m10 = M.select_columns.v3(
        input_ds=m14.data,
        columns='date,instrument,price_limit_status_0',
        reverse_select=False
    )
    
    m11 = M.join.v3(
        data1=m8.predictions,
        data2=m10.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m20 = M.input_features.v1(
        features="""# #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    name"""
    )
    
    m22 = M.use_datasource.v1(
        instruments=m9.data,
        features=m20.data,
        datasource_id='instruments_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m24 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    bm_0 = where(close/shift(close,5)-1<-0.05,1,0)"""
    )
    
    m19 = M.index_feature_extract.v3(
        input_1=m9.data,
        input_2=m24.data,
        before_days=100,
        index='000300.HIX'
    )
    
    m26 = M.select_columns.v3(
        input_ds=m19.data_1,
        columns='date,bm_0',
        reverse_select=False
    )
    
    m25 = M.join.v3(
        data1=m22.data,
        data2=m26.data,
        on='date',
        how='left',
        sort=True
    )
    
    m27 = M.join.v3(
        data1=m11.data,
        data2=m25.data,
        on='date,instrument',
        how='left',
        sort=False
    )
    
    m31 = M.filter_stockcode.v2(
        input_1=m27.data,
        start='688'
    )
    
    m29 = M.filter_delist_stocks.v3(
        input_1=m31.data_1
    )
    
    m12 = M.sort.v4(
        input_ds=m29.data,
        sort_by='position',
        group_by='date',
        keep_columns='--',
        ascending=True
    )
    
    m4 = M.trade.v4(
        instruments=m9.data,
        options_data=m12.sorted_data,
        start_date='',
        end_date='',
        initialize=m4_initialize_bigquant_run,
        handle_data=m4_handle_data_bigquant_run,
        prepare=m4_prepare_bigquant_run,
        before_trading_start=m4_before_trading_start_bigquant_run,
        volume_limit=0.025,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=300000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='后复权',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark=''
    )
    
    设置测试数据集,查看训练迭代过程的NDCG
    bigcharts-data-start/{"__type":"tabs","__id":"bigchart-07686d6b90b9409f90960c425482ba60"}/bigcharts-data-end

    过滤退市或即将退市股票(filter_delist_stocks)使用错误,你可以:

    1.一键查看文档

    2.一键搜索答案

    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    KeyError: 'name'
    
    During handling of the above exception, another exception occurred:
    
    KeyError                                  Traceback (most recent call last)
    <ipython-input-6-e58c02476bd9> in <module>()
        422 
        423 m29 = M.filter_delist_stocks.v3(
    --> 424     input_1=m31.data_1
        425 )
        426 
    
    KeyError: 'name'

    麻烦老师帮忙看下这个报错是什么原因


    (suhanxue) #2

    @iQuant 麻烦老师拨冗解答一下


    (达达) #3

    因为你在上面抽取了name列,用这个去除退市股模块时候默认的name列做了一个merge产生了name_x和name_y列,建议你的退市股处理放到主函数来过滤,因为不仅要禁止买入退市股,还要防止你的持仓的股票突然变成退市股。保险的做法是每天判断一下持仓股和要买入的股票名字。

    克隆策略

      {"Description":"实验创建于2017/8/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"DestinationInputPortId":"-404:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:data"},{"DestinationInputPortId":"-318:features_ds","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"DestinationInputPortId":"-193:input_1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"},{"DestinationInputPortId":"-329:data1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:predictions"},{"DestinationInputPortId":"-418:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-1918:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-224:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-174:input_1","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"-8068:training_ds","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:data","SourceOutputPortId":"-86:data"},{"DestinationInputPortId":"-323:input_ds","SourceOutputPortId":"-86:data"},{"DestinationInputPortId":"-411:input_data","SourceOutputPortId":"-404:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","SourceOutputPortId":"-411:data"},{"DestinationInputPortId":"-425:input_data","SourceOutputPortId":"-418:data"},{"DestinationInputPortId":"-86:input_data","SourceOutputPortId":"-425:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60:model","SourceOutputPortId":"-8068:model"},{"DestinationInputPortId":"-224:features","SourceOutputPortId":"-148:data"},{"DestinationInputPortId":"-174:input_2","SourceOutputPortId":"-184:data"},{"DestinationInputPortId":"-202:data2","SourceOutputPortId":"-189:data"},{"DestinationInputPortId":"-189:data2","SourceOutputPortId":"-196:data"},{"DestinationInputPortId":"-6898:input_1","SourceOutputPortId":"-202:data"},{"DestinationInputPortId":"-189:data1","SourceOutputPortId":"-224:data"},{"DestinationInputPortId":"-418:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-425:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-8068:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-404:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-411:features","SourceOutputPortId":"-318:data"},{"DestinationInputPortId":"-329:data2","SourceOutputPortId":"-323:data"},{"DestinationInputPortId":"-202:data1","SourceOutputPortId":"-329:data"},{"DestinationInputPortId":"-1918:options_data","SourceOutputPortId":"-490:sorted_data"},{"DestinationInputPortId":"-196:input_ds","SourceOutputPortId":"-174:data_1"},{"DestinationInputPortId":"-490:input_ds","SourceOutputPortId":"-6898:data_1"},{"DestinationInputPortId":"-200:input_1","SourceOutputPortId":"-193:data_1"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84:input_data","SourceOutputPortId":"-200:data"}],"ModuleNodes":[{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2010-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2017-12-31","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15","ModuleId":"BigQuantSpace.advanced_auto_labeler.advanced_auto_labeler-v2","ModuleParameters":[{"Name":"label_expr","Value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/data_history_data.html\n# 添加benchmark_前缀,可使用对应的benchmark数据\n# 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/big_expr.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\nshift(close, -2) / 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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"000300.SHA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na_label","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"cast_label_int","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-15","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\n# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\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\nwhere((open_0>close_1)&(mean(close_0,5)>mean(close_0,10)),1,0)\npe_ttm_0\n\n\n# 夏普比率降序\nrank_pb_lf_0\nrank_market_cap_0\nrank_market_cap_float_0\n#wq_54\n#gtja_95\n\n(close_0-mean(close_0,12))/mean(close_0,12)*100\nrank(std(amount_0,15))\nrank_avg_amount_0/rank_avg_amount_8\nts_argmin(low_0,20)\nrank_return_30\n(low_1-close_0)/close_0\nta_bbands_lowerband_14_0\nmean(mf_net_pct_s_0,4)\namount_0/avg_amount_3\nreturn_0/return_5\nreturn_1/return_5\nrank_avg_amount_7/rank_avg_amount_10\nta_sma_10_0/close_0\nsqrt(high_0*low_0)-amount_0/volume_0*adjust_factor_0\navg_turn_15/(turn_0+1e-5)\nreturn_10\nmf_net_pct_s_0\n(close_0-open_0)/close_1\n\n\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"inner","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","ModuleId":"BigQuantSpace.stock_ranker_predict.stock_ranker_predict-v5","ModuleParameters":[{"Name":"m_lazy_run","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"model","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60"}],"OutputPortsInternal":[{"Name":"predictions","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","OutputType":null},{"Name":"m_lazy_run","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-60","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":8,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2018-01-01","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"end_date","Value":"2019-12-31","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":9,"IsPartOfPartialRun":null,"Comment":"预测数据,用于回测和模拟","CommentCollapsed":false},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-84","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-84","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":13,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-86","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-86"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-86","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":14,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-404","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-404"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-404"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-404","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":15,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-411","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-411"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-411"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-411","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":16,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-418","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":"100","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-418"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-418"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-418","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":17,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-425","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-425"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-425"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-425","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":18,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1918","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":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 = 3\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 # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 0.6\n context.options['hold_days'] = 1\n\n from zipline.finance.slippage import SlippageModel\n class FixedPriceSlippage(SlippageModel):\n def process_order(self, data, order, bar_volume=0, trigger_check_price=0):\n if order.limit is None:\n price_field = self._price_field_buy if order.amount > 0 else self._price_field_sell\n price = data.current(order.asset, price_field)\n else:\n price = data.current(order.asset, self._price_field_buy)\n # 返回希望成交的价格和数量\n return (price, order.amount)\n # 设置price_field,默认是开盘买入,收盘卖出\n context.fix_slippage = FixedPriceSlippage(price_field_buy='open', price_field_sell='close')\n context.set_slippage(us_equities=context.fix_slippage)\n \n\n \n\n ","ValueType":"Literal","LinkedGlobalParameter":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 \n #大盘风控模块,读取风控数据 \n benckmark_risk=ranker_prediction['bm_0'].values[0]\n\n #当risk为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 \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 \n \n # 2. 根据需要加入移动止赢止损模块、固定天数卖出模块、ST或退市股卖出模块\n stock_sold = [] # 记录卖出的股票,防止多次卖出出现空单\n \n #------------------------START:止赢止损模块(含建仓期)---------------\n current_stopwin_stock=[]\n current_stoploss_stock = [] \n positions_cost={e.symbol:p.cost_basis for e,p in context.portfolio.positions.items()}\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 # 赚9%且为可交易状态就止盈\n if stock_market_price/stock_cost-1>=0.30 and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument),0)\n cash_for_sell -= positions[instrument]\n current_stopwin_stock.append(instrument)\n if len(current_stopwin_stock)>0:\n print(today,'止盈股票列表',current_stopwin_stock)\n stock_sold += current_stopwin_stock\n #--------------------------END: 止赢止损模块--------------------------\n \n #------------------------------------------止损模块START--------------------------------------------\n equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}\n \n # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断\n stoploss_stock = [] \n if len(equities) > 0:\n for i in equities.keys():\n stock_market_price = data.current(context.symbol(i), 'price') # 最新市场价格\n last_sale_date = equities[i].last_sale_date # 上次交易日期\n delta_days = data.current_dt - last_sale_date \n hold_days = delta_days.days # 持仓天数\n # 建仓以来的最高价\n highest_price_since_buy = data.history(context.symbol(i), 'high', hold_days, '1d').max()\n # 确定止损位置\n stoploss_line = highest_price_since_buy - highest_price_since_buy * 0.03\n #record('止损位置', stoploss_line)\n # 如果价格下穿止损位置\n if stock_market_price < stoploss_line:\n context.order_target_percent(context.symbol(i), 0) \n stoploss_stock.append(i)\n if len(stoploss_stock)>0:\n print('日期:', today, '股票:', stoploss_stock, '出现跟踪止损状况')\n #-------------------------------------------止损模块END--------------------------------------------- \n \n #--------------------------START:持有固定天数卖出(不含建仓期)-----------\n current_stopdays_stock = []\n positions_lastdate = {e.symbol:p.last_sale_date for e,p in context.portfolio.positions.items()}\n # 不是建仓期(在前hold_days属于建仓期)\n if not is_staging:\n for instrument in positions.keys():\n #如果上面的止盈止损已经卖出过了,就不要重复卖出以防止产生空单\n if instrument in stock_sold:\n continue\n # 今天和上次交易的时间相隔hold_days就全部卖出 datetime.timedelta(context.options['hold_days'])也可以换成自己需要的天数,比如datetime.timedelta(5)\n if data.current_dt - positions_lastdate[instrument]>=datetime.timedelta(1) and data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument), 0)\n current_stopdays_stock.append(instrument)\n cash_for_sell -= positions[instrument]\n if len(current_stopdays_stock)>0: \n print(today,'固定天数卖出列表',current_stopdays_stock)\n stock_sold += current_stopdays_stock\n #------------------------- END:持有固定天数卖出-----------------------\n\n\n # 4. 生成轮仓买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票\n # 计算今日跌停的股票\n dt_list = list(ranker_prediction[ranker_prediction.price_limit_status_0==1].instrument)\n # 计算所有禁止买入的股票池\n banned_list = stock_sold+dt_list\n buy_cash_weights = context.stock_weights\n buy_instruments=[k for k in list(ranker_prediction.instrument) if k not in banned_list][: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\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"def bigquant_run(context, data):\n # 获取涨跌停状态数据\n df_price_limit_status = context.ranker_prediction.set_index('date')\n today=data.current_dt.strftime('%Y-%m-%d')\n # 得到当前未完成订单\n for orders in get_open_orders().values():\n # 循环,撤销订单\n for _order in orders:\n ins=str(_order.sid.symbol)\n try:\n #判断一下如果当日涨停,则取消卖单\n if df_price_limit_status[df_price_limit_status.instrument==ins].price_limit_status_0.ix[today]>2 and _order.amount<0:\n cancel_order(_order)\n print(today,'尾盘涨停取消卖单',ins) \n except:\n continue","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"volume_limit","Value":0.025,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_buy","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_sell","Value":"close","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":"300000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"daily","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"price_type","Value":"后复权","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"product_type","Value":"股票","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"plot_charts","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"backtest_only","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-1918"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-1918"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-1918","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-8068","ModuleId":"BigQuantSpace.stock_ranker_train.stock_ranker_train-v6","ModuleParameters":[{"Name":"learning_algorithm","Value":"排序","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"number_of_leaves","Value":30,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"minimum_docs_per_leaf","Value":1000,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"number_of_trees","Value":20,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"learning_rate","Value":0.1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_bins","Value":1023,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"feature_fraction","Value":1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_row_fraction","Value":1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"ndcg_discount_base","Value":1,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"m_lazy_run","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"training_ds","NodeId":"-8068"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-8068"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"test_ds","NodeId":"-8068"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"base_model","NodeId":"-8068"}],"OutputPortsInternal":[{"Name":"model","NodeId":"-8068","OutputType":null},{"Name":"feature_gains","NodeId":"-8068","OutputType":null},{"Name":"m_lazy_run","NodeId":"-8068","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-148","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nname","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-148"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-148","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":20,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-184","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nbm_0 = where(close/shift(close,5)-1<-0.05,1,0)","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-184"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-184","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":24,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-189","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"left","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-189"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-189"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-189","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":25,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-196","ModuleId":"BigQuantSpace.select_columns.select_columns-v3","ModuleParameters":[{"Name":"columns","Value":"date,bm_0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"reverse_select","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-196"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"columns_ds","NodeId":"-196"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-196","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":26,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-202","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"left","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-202"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-202"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-202","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":27,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-224","ModuleId":"BigQuantSpace.use_datasource.use_datasource-v1","ModuleParameters":[{"Name":"datasource_id","Value":"instruments_CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-224"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-224"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-224","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":22,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-318","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nprice_limit_status_0\n\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-318"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-318","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-323","ModuleId":"BigQuantSpace.select_columns.select_columns-v3","ModuleParameters":[{"Name":"columns","Value":"date,instrument,price_limit_status_0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"reverse_select","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-323"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"columns_ds","NodeId":"-323"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-323","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":10,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-329","ModuleId":"BigQuantSpace.join.join-v3","ModuleParameters":[{"Name":"on","Value":"date,instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"how","Value":"inner","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sort","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data1","NodeId":"-329"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"data2","NodeId":"-329"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-329","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":11,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-490","ModuleId":"BigQuantSpace.sort.sort-v4","ModuleParameters":[{"Name":"sort_by","Value":"position","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"group_by","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"keep_columns","Value":"--","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"ascending","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_ds","NodeId":"-490"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"sort_by_ds","NodeId":"-490"}],"OutputPortsInternal":[{"Name":"sorted_data","NodeId":"-490","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":12,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-174","ModuleId":"BigQuantSpace.index_feature_extract.index_feature_extract-v3","ModuleParameters":[{"Name":"before_days","Value":100,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"index","Value":"000300.HIX","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-174"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-174"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-174","OutputType":null},{"Name":"data_2","NodeId":"-174","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":19,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-6898","ModuleId":"BigQuantSpace.filter_stockcode.filter_stockcode-v2","ModuleParameters":[{"Name":"start","Value":"688","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-6898"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-6898","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":31,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-193","ModuleId":"BigQuantSpace.filter_stockcode.filter_stockcode-v2","ModuleParameters":[{"Name":"start","Value":"688","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-193"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-193","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":21,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-200","ModuleId":"BigQuantSpace.filter_delist_stocks.filter_delist_stocks-v3","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-200"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-200","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":28,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='248,98,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-15' Position='79,197,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='698,42,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='268,365,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-60' Position='782,629,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='1001,129,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-84' Position='269,702,200,200'/><NodePosition Node='-86' Position='1011,485,200,200'/><NodePosition Node='-404' Position='381,188,200,200'/><NodePosition Node='-411' Position='385,280,200,200'/><NodePosition Node='-418' Position='1002,254,200,200'/><NodePosition Node='-425' Position='1008,376,200,200'/><NodePosition Node='-1918' Position='1343,1115,200,200'/><NodePosition Node='-8068' Position='591,536,200,200'/><NodePosition Node='-148' Position='1399,464,200,200'/><NodePosition Node='-184' Position='1708,360,200,200'/><NodePosition Node='-189' Position='1506,682,200,200'/><NodePosition Node='-196' Position='1690,564,200,200'/><NodePosition Node='-202' Position='1240,798,200,200'/><NodePosition Node='-224' Position='1396,562,200,200'/><NodePosition Node='-318' Position='696,129,200,200'/><NodePosition Node='-323' Position='1079,598,200,200'/><NodePosition Node='-329' Position='1083,704,200,200'/><NodePosition Node='-490' Position='1327,1040,200,200'/><NodePosition Node='-174' Position='1709,464,200,200'/><NodePosition Node='-6898' Position='1265,930,200,200'/><NodePosition Node='-193' Position='265,469,200,200'/><NodePosition Node='-200' Position='268,591,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
      In [2]:
      # 本代码由可视化策略环境自动生成 2020年3月21日 21:58
      # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
      
      
      # 回测引擎:初始化函数,只执行一次
      def m4_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 = 3
          # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
          context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])
          # 设置每只股票占用的最大资金比例
          context.max_cash_per_instrument = 0.6
          context.options['hold_days'] = 1
      
          from zipline.finance.slippage import SlippageModel
          class FixedPriceSlippage(SlippageModel):
              def process_order(self, data, order, bar_volume=0, trigger_check_price=0):
                  if order.limit is None:
                      price_field = self._price_field_buy if order.amount > 0 else self._price_field_sell
                      price = data.current(order.asset, price_field)
                  else:
                      price = data.current(order.asset, self._price_field_buy)
                  # 返回希望成交的价格和数量
                  return (price, order.amount)
          # 设置price_field,默认是开盘买入,收盘卖出
          context.fix_slippage = FixedPriceSlippage(price_field_buy='open', price_field_sell='close')
          context.set_slippage(us_equities=context.fix_slippage)
          
      
          
      
         
      # 回测引擎:每日数据处理函数,每天执行一次
      def m4_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]
          
          #大盘风控模块,读取风控数据    
          benckmark_risk=ranker_prediction['bm_0'].values[0]
      
          #当risk为1时,市场有风险,全部平仓,不再执行其它操作
          if benckmark_risk > 0:
              for instrument in positions.keys():
                  context.order_target(context.symbol(instrument), 0)
              print(today,'大盘风控止损触发,全仓卖出')
              return
          
          # 1. 资金分配
          # 平均持仓时间是hold_days,每日都将买入股票,每日预期使用 1/hold_days 的资金
          # 实际操作中,会存在一定的买入误差,所以在前hold_days天,等量使用资金;之后,尽量使用剩余资金(这里设置最多用等量的1.5倍)
          is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天)
          cash_avg = context.portfolio.portfolio_value / context.options['hold_days']
          cash_for_buy = min(context.portfolio.cash, (1 if is_staging else 1.5) * cash_avg)
          cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)
         
          
          # 2. 根据需要加入移动止赢止损模块、固定天数卖出模块、ST或退市股卖出模块
          stock_sold = [] # 记录卖出的股票,防止多次卖出出现空单
          
          #------------------------START:止赢止损模块(含建仓期)---------------
          current_stopwin_stock=[]
          current_stoploss_stock = []   
          positions_cost={e.symbol:p.cost_basis for e,p in context.portfolio.positions.items()}
          if len(positions)>0:
              for instrument in positions.keys():
                  stock_cost=positions_cost[instrument]  
                  stock_market_price=data.current(context.symbol(instrument),'price')  
                  # 赚9%且为可交易状态就止盈
                  if stock_market_price/stock_cost-1>=0.30 and data.can_trade(context.symbol(instrument)):
                      context.order_target_percent(context.symbol(instrument),0)
                      cash_for_sell -= positions[instrument]
                      current_stopwin_stock.append(instrument)
              if len(current_stopwin_stock)>0:
                  print(today,'止盈股票列表',current_stopwin_stock)
                  stock_sold += current_stopwin_stock
          #--------------------------END: 止赢止损模块--------------------------
          
          #------------------------------------------止损模块START--------------------------------------------
          equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}
          
          # 新建当日止损股票列表是为了handle_data 策略逻辑部分不再对该股票进行判断
          stoploss_stock = [] 
          if len(equities) > 0:
              for i in equities.keys():
                  stock_market_price = data.current(context.symbol(i), 'price')  # 最新市场价格
                  last_sale_date = equities[i].last_sale_date   # 上次交易日期
                  delta_days = data.current_dt - last_sale_date  
                  hold_days = delta_days.days # 持仓天数
                  # 建仓以来的最高价
                  highest_price_since_buy = data.history(context.symbol(i), 'high', hold_days, '1d').max()
                  # 确定止损位置
                  stoploss_line = highest_price_since_buy - highest_price_since_buy * 0.03
                  #record('止损位置', stoploss_line)
                  # 如果价格下穿止损位置
                  if stock_market_price < stoploss_line:
                      context.order_target_percent(context.symbol(i), 0)     
                      stoploss_stock.append(i)
              if len(stoploss_stock)>0:
                  print('日期:', today, '股票:', stoploss_stock, '出现跟踪止损状况')
          #-------------------------------------------止损模块END--------------------------------------------- 
          
          #--------------------------START:持有固定天数卖出(不含建仓期)-----------
          current_stopdays_stock = []
          positions_lastdate = {e.symbol:p.last_sale_date for e,p in context.portfolio.positions.items()}
          # 不是建仓期(在前hold_days属于建仓期)
          if not is_staging:
              for instrument in positions.keys():
                  #如果上面的止盈止损已经卖出过了,就不要重复卖出以防止产生空单
                  if instrument in stock_sold:
                      continue
                  # 今天和上次交易的时间相隔hold_days就全部卖出 datetime.timedelta(context.options['hold_days'])也可以换成自己需要的天数,比如datetime.timedelta(5)
                  if data.current_dt - positions_lastdate[instrument]>=datetime.timedelta(1) and data.can_trade(context.symbol(instrument)):
                      context.order_target_percent(context.symbol(instrument), 0)
                      current_stopdays_stock.append(instrument)
                      cash_for_sell -= positions[instrument]
              if len(current_stopdays_stock)>0:        
                  print(today,'固定天数卖出列表',current_stopdays_stock)
                  stock_sold += current_stopdays_stock
          #-------------------------  END:持有固定天数卖出-----------------------
      
      
          # 4. 生成轮仓买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票
          # 计算今日跌停的股票
          dt_list = list(ranker_prediction[ranker_prediction.price_limit_status_0==1].instrument)
          # 计算所有禁止买入的股票池
          banned_list = stock_sold+dt_list
          buy_cash_weights = context.stock_weights
          buy_instruments=[k for k in list(ranker_prediction.instrument) if k not in banned_list][:len(buy_cash_weights)]
          max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
          for i, instrument in enumerate(buy_instruments):
              cash = cash_for_buy * 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 m4_prepare_bigquant_run(context):
          pass
      def m4_before_trading_start_bigquant_run(context, data):
          # 获取涨跌停状态数据
          df_price_limit_status = context.ranker_prediction.set_index('date')
          today=data.current_dt.strftime('%Y-%m-%d')
          # 得到当前未完成订单
          for orders in get_open_orders().values():
              # 循环,撤销订单
              for _order in orders:
                  ins=str(_order.sid.symbol)
                  try:
                      #判断一下如果当日涨停,则取消卖单
                      if  df_price_limit_status[df_price_limit_status.instrument==ins].price_limit_status_0.ix[today]>2 and _order.amount<0:
                          cancel_order(_order)
                          print(today,'尾盘涨停取消卖单',ins) 
                  except:
                      continue
      
      m1 = M.instruments.v2(
          start_date='2010-01-01',
          end_date='2017-12-31',
          market='CN_STOCK_A',
          instrument_list='',
          max_count=0
      )
      
      m2 = M.advanced_auto_labeler.v2(
          instruments=m1.data,
          label_expr="""# #号开始的表示注释
      # 0. 每行一个,顺序执行,从第二个开始,可以使用label字段
      # 1. 可用数据字段见 https://bigquant.com/docs/data_history_data.html
      #   添加benchmark_前缀,可使用对应的benchmark数据
      # 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/big_expr.html>`_
      
      # 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)
      shift(close, -2) / shift(open, -1)
      
      # 极值处理:用1%和99%分位的值做clip
      clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))
      
      # 将分数映射到分类,这里使用20个分类
      all_wbins(label, 20)
      
      # 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)
      where(shift(high, -1) == shift(low, -1), NaN, label)
      """,
          start_date='',
          end_date='',
          benchmark='000300.SHA',
          drop_na_label=True,
          cast_label_int=True
      )
      
      m3 = M.input_features.v1(
          features="""# #号开始的表示注释
      # 多个特征,每行一个,可以包含基础特征和衍生特征
      # #号开始的表示注释
      # 多个特征,每行一个,可以包含基础特征和衍生特征
      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
      where((open_0>close_1)&(mean(close_0,5)>mean(close_0,10)),1,0)
      pe_ttm_0
      
      
      # 夏普比率降序
      rank_pb_lf_0
      rank_market_cap_0
      rank_market_cap_float_0
      #wq_54
      #gtja_95
      
      (close_0-mean(close_0,12))/mean(close_0,12)*100
      rank(std(amount_0,15))
      rank_avg_amount_0/rank_avg_amount_8
      ts_argmin(low_0,20)
      rank_return_30
      (low_1-close_0)/close_0
      ta_bbands_lowerband_14_0
      mean(mf_net_pct_s_0,4)
      amount_0/avg_amount_3
      return_0/return_5
      return_1/return_5
      rank_avg_amount_7/rank_avg_amount_10
      ta_sma_10_0/close_0
      sqrt(high_0*low_0)-amount_0/volume_0*adjust_factor_0
      avg_turn_15/(turn_0+1e-5)
      return_10
      mf_net_pct_s_0
      (close_0-open_0)/close_1
      
      
      """
      )
      
      m6 = M.input_features.v1(
          features_ds=m3.data,
          features="""# #号开始的表示注释
      # 多个特征,每行一个,可以包含基础特征和衍生特征
      price_limit_status_0
      
      """
      )
      
      m15 = M.general_feature_extractor.v7(
          instruments=m1.data,
          features=m6.data,
          start_date='',
          end_date='',
          before_start_days=0
      )
      
      m16 = M.derived_feature_extractor.v3(
          input_data=m15.data,
          features=m6.data,
          date_col='date',
          instrument_col='instrument',
          drop_na=False,
          remove_extra_columns=False
      )
      
      m7 = M.join.v3(
          data1=m2.data,
          data2=m16.data,
          on='date,instrument',
          how='inner',
          sort=False
      )
      
      m21 = M.filter_stockcode.v2(
          input_1=m7.data,
          start='688'
      )
      
      m28 = M.filter_delist_stocks.v3(
          input_1=m21.data_1
      )
      
      m13 = M.dropnan.v1(
          input_data=m28.data
      )
      
      m5 = M.stock_ranker_train.v6(
          training_ds=m13.data,
          features=m6.data,
          learning_algorithm='排序',
          number_of_leaves=30,
          minimum_docs_per_leaf=1000,
          number_of_trees=20,
          learning_rate=0.1,
          max_bins=1023,
          feature_fraction=1,
          data_row_fraction=1,
          ndcg_discount_base=1,
          m_lazy_run=False
      )
      
      m9 = M.instruments.v2(
          start_date=T.live_run_param('trading_date', '2018-01-01'),
          end_date=T.live_run_param('trading_date', '2019-12-31'),
          market='CN_STOCK_A',
          instrument_list='',
          max_count=0
      )
      
      m17 = M.general_feature_extractor.v7(
          instruments=m9.data,
          features=m6.data,
          start_date='',
          end_date='',
          before_start_days=100
      )
      
      m18 = M.derived_feature_extractor.v3(
          input_data=m17.data,
          features=m6.data,
          date_col='date',
          instrument_col='instrument',
          drop_na=False,
          remove_extra_columns=False
      )
      
      m14 = M.dropnan.v1(
          input_data=m18.data
      )
      
      m8 = M.stock_ranker_predict.v5(
          model=m5.model,
          data=m14.data,
          m_lazy_run=False
      )
      
      m10 = M.select_columns.v3(
          input_ds=m14.data,
          columns='date,instrument,price_limit_status_0',
          reverse_select=False
      )
      
      m11 = M.join.v3(
          data1=m8.predictions,
          data2=m10.data,
          on='date,instrument',
          how='inner',
          sort=False
      )
      
      m20 = M.input_features.v1(
          features="""# #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      name"""
      )
      
      m22 = M.use_datasource.v1(
          instruments=m9.data,
          features=m20.data,
          datasource_id='instruments_CN_STOCK_A',
          start_date='',
          end_date=''
      )
      
      m24 = M.input_features.v1(
          features="""
      # #号开始的表示注释,注释需单独一行
      # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
      bm_0 = where(close/shift(close,5)-1<-0.05,1,0)"""
      )
      
      m19 = M.index_feature_extract.v3(
          input_1=m9.data,
          input_2=m24.data,
          before_days=100,
          index='000300.HIX'
      )
      
      m26 = M.select_columns.v3(
          input_ds=m19.data_1,
          columns='date,bm_0',
          reverse_select=False
      )
      
      m25 = M.join.v3(
          data1=m22.data,
          data2=m26.data,
          on='date',
          how='left',
          sort=True
      )
      
      m27 = M.join.v3(
          data1=m11.data,
          data2=m25.data,
          on='date,instrument',
          how='left',
          sort=False
      )
      
      m31 = M.filter_stockcode.v2(
          input_1=m27.data,
          start='688'
      )
      
      m12 = M.sort.v4(
          input_ds=m31.data_1,
          sort_by='position',
          group_by='date',
          keep_columns='--',
          ascending=True
      )
      
      m4 = M.trade.v4(
          instruments=m9.data,
          options_data=m12.sorted_data,
          start_date='',
          end_date='',
          initialize=m4_initialize_bigquant_run,
          handle_data=m4_handle_data_bigquant_run,
          prepare=m4_prepare_bigquant_run,
          before_trading_start=m4_before_trading_start_bigquant_run,
          volume_limit=0.025,
          order_price_field_buy='open',
          order_price_field_sell='close',
          capital_base=300000,
          auto_cancel_non_tradable_orders=True,
          data_frequency='daily',
          price_type='后复权',
          product_type='股票',
          plot_charts=True,
          backtest_only=False,
          benchmark=''
      )
      
      设置测试数据集,查看训练迭代过程的NDCG
      bigcharts-data-start/{"__type":"tabs","__id":"bigchart-7970da1367944acdabef949ad2f65115"}/bigcharts-data-end
      2018-01-04 固定天数卖出列表 ['002883.SZA', '600817.SHA', '300540.SZA']
      2018-01-05 尾盘涨停取消卖单 002883.SZA
      2018-01-05 固定天数卖出列表 ['002883.SZA']
      2018-01-09 固定天数卖出列表 ['300268.SZA', '600817.SHA', '300540.SZA']
      日期: 2018-01-10 股票: ['600759.SHA'] 出现跟踪止损状况
      2018-01-10 固定天数卖出列表 ['300669.SZA', '603991.SHA', '600759.SHA']
      日期: 2018-01-12 股票: ['603887.SHA'] 出现跟踪止损状况
      2018-01-12 固定天数卖出列表 ['603887.SHA', '000613.SZA', '300498.SZA']
      日期: 2018-01-15 股票: ['603879.SHA', '600080.SHA', '600740.SHA'] 出现跟踪止损状况
      2018-01-15 固定天数卖出列表 ['603879.SHA', '600080.SHA', '600740.SHA']
      2018-01-17 固定天数卖出列表 ['300440.SZA', '300051.SZA', '002833.SZA']
      2018-01-18 固定天数卖出列表 ['600462.SHA', '600179.SHA', '603580.SHA']
      日期: 2018-01-22 股票: ['300268.SZA', '600789.SHA'] 出现跟踪止损状况
      2018-01-22 固定天数卖出列表 ['300268.SZA', '600789.SHA', '600301.SHA']
      日期: 2018-01-23 股票: ['603106.SHA'] 出现跟踪止损状况
      2018-01-23 固定天数卖出列表 ['300702.SZA', '603106.SHA', '300710.SZA']
      日期: 2018-01-25 股票: ['300719.SZA'] 出现跟踪止损状况
      2018-01-25 固定天数卖出列表 ['300719.SZA', '300553.SZA']
      日期: 2018-01-26 股票: ['300368.SZA'] 出现跟踪止损状况
      2018-01-26 固定天数卖出列表 ['600289.SHA', '300368.SZA', '600258.SHA']
      2018-01-30 固定天数卖出列表 ['603813.SHA', '000906.SZA', '300576.SZA']
      2018-01-31 固定天数卖出列表 ['600837.SHA', '600369.SHA', '601377.SHA']
      日期: 2018-02-02 股票: ['300584.SZA', '002445.SZA'] 出现跟踪止损状况
      2018-02-02 固定天数卖出列表 ['300584.SZA', '000892.SZA', '002445.SZA']
      日期: 2018-02-05 股票: ['300651.SZA', '300497.SZA', '002438.SZA'] 出现跟踪止损状况
      2018-02-05 固定天数卖出列表 ['300651.SZA', '300497.SZA', '002438.SZA']
      2018-02-07 大盘风控止损触发,全仓卖出
      2018-02-08 大盘风控止损触发,全仓卖出
      2018-02-09 大盘风控止损触发,全仓卖出
      2018-02-12 大盘风控止损触发,全仓卖出
      2018-02-13 大盘风控止损触发,全仓卖出
      2018-02-23 固定天数卖出列表 ['600680.SHA', '603703.SHA', '002799.SZA']
      日期: 2018-02-28 股票: ['603286.SHA'] 出现跟踪止损状况
      2018-02-28 固定天数卖出列表 ['603286.SHA', '300192.SZA', '002569.SZA']
      2018-03-01 尾盘涨停取消卖单 002569.SZA
      2018-03-01 固定天数卖出列表 ['002569.SZA']
      日期: 2018-03-02 股票: ['600313.SHA'] 出现跟踪止损状况
      2018-03-02 固定天数卖出列表 ['600313.SHA']
      2018-03-05 固定天数卖出列表 ['002760.SZA']
      2018-03-06 固定天数卖出列表 ['300167.SZA', '002188.SZA', '002729.SZA']
      2018-03-08 固定天数卖出列表 ['600112.SHA', '600355.SHA']
      2018-03-09 固定天数卖出列表 ['603088.SHA', '002188.SZA', '002729.SZA']
      日期: 2018-03-13 股票: ['002569.SZA', '300167.SZA', '002112.SZA'] 出现跟踪止损状况
      2018-03-13 固定天数卖出列表 ['002569.SZA', '300167.SZA', '002112.SZA']
      日期: 2018-03-14 股票: ['002188.SZA'] 出现跟踪止损状况
      2018-03-14 固定天数卖出列表 ['002188.SZA', '600112.SHA', '600817.SHA']
      2018-03-16 固定天数卖出列表 ['603496.SHA', '300250.SZA', '300486.SZA']
      日期: 2018-03-19 股票: ['600379.SHA', '002901.SZA'] 出现跟踪止损状况
      2018-03-19 固定天数卖出列表 ['600379.SHA', '002901.SZA', '600889.SHA']
      日期: 2018-03-21 股票: ['300417.SZA'] 出现跟踪止损状况
      2018-03-21 固定天数卖出列表 ['300417.SZA', '300553.SZA', '300592.SZA']
      日期: 2018-03-22 股票: ['300573.SZA'] 出现跟踪止损状况
      2018-03-22 固定天数卖出列表 ['300540.SZA', '300573.SZA', '300538.SZA']
      日期: 2018-03-23 股票: ['300538.SZA'] 出现跟踪止损状况
      2018-03-23 固定天数卖出列表 ['300538.SZA']
      日期: 2018-03-26 股票: ['002858.SZA', '002847.SZA'] 出现跟踪止损状况
      2018-03-26 固定天数卖出列表 ['002858.SZA', '002847.SZA', '300595.SZA']
      日期: 2018-03-27 股票: ['603617.SHA'] 出现跟踪止损状况
      2018-03-27 固定天数卖出列表 ['300260.SZA', '603617.SHA', '600857.SHA']
      2018-03-28 大盘风控止损触发,全仓卖出
      日期: 2018-04-02 股票: ['603738.SHA', '300696.SZA'] 出现跟踪止损状况
      2018-04-02 固定天数卖出列表 ['603738.SHA', '300696.SZA', '300540.SZA']
      2018-04-03 尾盘涨停取消卖单 300540.SZA
      2018-04-03 固定天数卖出列表 ['300540.SZA', '000502.SZA']
      日期: 2018-04-09 股票: ['002780.SZA'] 出现跟踪止损状况
      2018-04-09 固定天数卖出列表 ['002780.SZA', '603383.SHA']
      日期: 2018-04-10 股票: ['603918.SHA'] 出现跟踪止损状况
      2018-04-10 固定天数卖出列表 ['300445.SZA', '300548.SZA', '603918.SHA']
      日期: 2018-04-12 股票: ['300132.SZA', '600540.SHA'] 出现跟踪止损状况
      2018-04-12 固定天数卖出列表 ['603912.SHA', '300132.SZA', '600540.SHA']
      日期: 2018-04-13 股票: ['603229.SHA', '300278.SZA'] 出现跟踪止损状况
      2018-04-13 固定天数卖出列表 ['603229.SHA', '300278.SZA', '000004.SZA']
      日期: 2018-04-17 股票: ['300639.SZA', '603767.SHA', '603991.SHA'] 出现跟踪止损状况
      2018-04-17 固定天数卖出列表 ['300639.SZA', '603767.SHA', '603991.SHA']
      日期: 2018-04-18 股票: ['002895.SZA'] 出现跟踪止损状况
      2018-04-18 固定天数卖出列表 ['002895.SZA', '300371.SZA', '603076.SHA']
      日期: 2018-04-20 股票: ['300729.SZA', '000560.SZA', '300282.SZA'] 出现跟踪止损状况
      2018-04-20 固定天数卖出列表 ['300729.SZA', '000560.SZA', '300282.SZA']
      日期: 2018-04-23 股票: ['300278.SZA', '600539.SHA', '600768.SHA'] 出现跟踪止损状况
      2018-04-23 固定天数卖出列表 ['300278.SZA', '600539.SHA', '600768.SHA']
      日期: 2018-04-24 股票: ['600539.SHA'] 出现跟踪止损状况
      日期: 2018-04-25 股票: ['300456.SZA'] 出现跟踪止损状况
      2018-04-25 固定天数卖出列表 ['603677.SHA', '300623.SZA', '300456.SZA']
      日期: 2018-04-26 股票: ['000586.SZA'] 出现跟踪止损状况
      2018-04-26 固定天数卖出列表 ['000586.SZA']
      日期: 2018-04-27 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-04-27 固定天数卖出列表 ['603032.SHA', '300278.SZA', '600610.SHA']
      日期: 2018-05-02 股票: ['600610.SHA', '002467.SZA', '603099.SHA'] 出现跟踪止损状况
      2018-05-02 固定天数卖出列表 ['002395.SZA', '002467.SZA', '603099.SHA']
      日期: 2018-05-03 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-05-03 固定天数卖出列表 ['300659.SZA', '300123.SZA', '300143.SZA']
      日期: 2018-05-04 股票: ['600610.SHA', '600288.SHA'] 出现跟踪止损状况
      2018-05-04 固定天数卖出列表 ['600990.SHA', '600288.SHA', '601798.SHA']
      日期: 2018-05-07 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-05-07 固定天数卖出列表 ['300139.SZA', '603032.SHA']
      日期: 2018-05-08 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-05-08 固定天数卖出列表 ['002604.SZA', '002564.SZA', '603699.SHA']
      日期: 2018-05-09 股票: ['600610.SHA', '002604.SZA'] 出现跟踪止损状况
      2018-05-09 固定天数卖出列表 ['002604.SZA', '300216.SZA']
      2018-05-10 尾盘涨停取消卖单 300216.SZA
      日期: 2018-05-10 股票: ['600610.SHA', '002604.SZA'] 出现跟踪止损状况
      2018-05-10 固定天数卖出列表 ['002604.SZA', '600238.SHA', '300216.SZA', '002427.SZA', '300551.SZA']
      2018-05-11 尾盘涨停取消卖单 002427.SZA
      日期: 2018-05-11 股票: ['600610.SHA', '002604.SZA', '603067.SHA', '300093.SZA'] 出现跟踪止损状况
      2018-05-11 固定天数卖出列表 ['002604.SZA', '002427.SZA', '603067.SHA', '600817.SHA', '300093.SZA']
      日期: 2018-05-14 股票: ['600610.SHA', '002604.SZA'] 出现跟踪止损状况
      2018-05-14 固定天数卖出列表 ['002604.SZA']
      日期: 2018-05-15 股票: ['600610.SHA', '002604.SZA'] 出现跟踪止损状况
      2018-05-15 固定天数卖出列表 ['002604.SZA', '300539.SZA', '000632.SZA', '603577.SHA']
      日期: 2018-05-16 股票: ['600610.SHA', '300025.SZA', '300703.SZA'] 出现跟踪止损状况
      2018-05-16 固定天数卖出列表 ['300025.SZA', '300703.SZA', '600319.SHA']
      日期: 2018-05-17 股票: ['600610.SHA'] 出现跟踪止损状况
      日期: 2018-05-18 股票: ['600610.SHA', '300731.SZA'] 出现跟踪止损状况
      2018-05-18 固定天数卖出列表 ['300731.SZA', '600209.SHA']
      日期: 2018-05-21 股票: ['600610.SHA', '600250.SHA'] 出现跟踪止损状况
      2018-05-21 固定天数卖出列表 ['600238.SHA', '300069.SZA', '600250.SHA']
      日期: 2018-05-22 股票: ['600610.SHA'] 出现跟踪止损状况
      日期: 2018-05-23 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-05-23 固定天数卖出列表 ['603050.SHA', '600817.SHA']
      日期: 2018-05-24 股票: ['600610.SHA', '600634.SHA'] 出现跟踪止损状况
      2018-05-24 固定天数卖出列表 ['600634.SHA', '002357.SZA', '002604.SZA']
      日期: 2018-05-25 股票: ['600610.SHA', '002604.SZA'] 出现跟踪止损状况
      2018-05-25 固定天数卖出列表 ['002604.SZA']
      日期: 2018-05-28 股票: ['600610.SHA', '002604.SZA', '300637.SZA', '300664.SZA', '002557.SZA'] 出现跟踪止损状况
      2018-05-28 固定天数卖出列表 ['002604.SZA', '300637.SZA', '300664.SZA', '002557.SZA']
      日期: 2018-05-29 股票: ['600610.SHA', '002604.SZA', '600749.SHA'] 出现跟踪止损状况
      2018-05-29 固定天数卖出列表 ['002604.SZA', '603996.SHA', '600749.SHA', '000620.SZA']
      日期: 2018-05-30 股票: ['600610.SHA', '002604.SZA'] 出现跟踪止损状况
      2018-05-30 固定天数卖出列表 ['002604.SZA']
      日期: 2018-05-31 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-05-31 固定天数卖出列表 ['603196.SHA', '002805.SZA', '300536.SZA']
      日期: 2018-06-01 股票: ['600610.SHA', '600287.SHA'] 出现跟踪止损状况
      2018-06-01 固定天数卖出列表 ['300721.SZA', '603506.SHA', '600287.SHA']
      日期: 2018-06-04 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-06-04 固定天数卖出列表 ['002357.SZA', '002799.SZA', '600778.SHA']
      2018-06-05 尾盘涨停取消卖单 002799.SZA
      日期: 2018-06-05 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-06-05 固定天数卖出列表 ['002799.SZA', '600540.SHA', '300282.SZA', '600077.SHA']
      日期: 2018-06-06 股票: ['600610.SHA', '002891.SZA', '002702.SZA'] 出现跟踪止损状况
      2018-06-06 固定天数卖出列表 ['002891.SZA', '603365.SHA', '002702.SZA']
      日期: 2018-06-07 股票: ['600610.SHA', '603577.SHA'] 出现跟踪止损状况
      2018-06-07 固定天数卖出列表 ['603577.SHA', '002622.SZA', '300703.SZA']
      2018-06-08 尾盘涨停取消卖单 002622.SZA
      日期: 2018-06-08 股票: ['600610.SHA'] 出现跟踪止损状况
      2018-06-08 固定天数卖出列表 ['002622.SZA', '300680.SZA', '002437.SZA']
      日期: 2018-06-11 股票: ['600610.SHA', '600634.SHA', '002437.SZA', '002198.SZA', '601858.SHA'] 出现跟踪止损状况
      2018-06-11 固定天数卖出列表 ['600634.SHA', '002198.SZA', '601858.SHA']
      日期: 2018-06-12 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-06-12 固定天数卖出列表 ['000608.SZA', '600666.SHA', '600271.SHA']
      日期: 2018-06-13 股票: ['600610.SHA', '002437.SZA', '300549.SZA'] 出现跟踪止损状况
      2018-06-13 固定天数卖出列表 ['300549.SZA', '002830.SZA', '600138.SHA']
      日期: 2018-06-14 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-06-14 固定天数卖出列表 ['300032.SZA', '300071.SZA', '300109.SZA']
      日期: 2018-06-15 股票: ['600610.SHA', '002437.SZA', '603776.SHA', '600673.SHA'] 出现跟踪止损状况
      2018-06-15 固定天数卖出列表 ['603776.SHA', '600839.SHA', '600673.SHA']
      日期: 2018-06-19 股票: ['600610.SHA', '002437.SZA', '603776.SHA', '002785.SZA', '300557.SZA', '600074.SHA'] 出现跟踪止损状况
      2018-06-19 固定天数卖出列表 ['603776.SHA', '002785.SZA', '300557.SZA', '600074.SHA']
      日期: 2018-06-20 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-06-20 固定天数卖出列表 ['002246.SZA', '300729.SZA', '300415.SZA']
      2018-06-21 大盘风控止损触发,全仓卖出
      2018-06-22 尾盘涨停取消卖单 300411.SZA
      日期: 2018-06-22 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-06-22 固定天数卖出列表 ['300411.SZA']
      2018-06-25 大盘风控止损触发,全仓卖出
      日期: 2018-06-26 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      日期: 2018-06-27 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      日期: 2018-06-28 股票: ['600610.SHA', '002437.SZA', '600695.SHA', '600365.SHA'] 出现跟踪止损状况
      2018-06-28 固定天数卖出列表 ['600695.SHA', '600365.SHA', '603488.SHA']
      2018-06-29 尾盘涨停取消卖单 600695.SHA
      日期: 2018-06-29 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-06-29 固定天数卖出列表 ['600695.SHA']
      日期: 2018-07-02 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-02 固定天数卖出列表 ['600610.SHA']
      日期: 2018-07-03 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-03 固定天数卖出列表 ['600610.SHA', '600130.SHA', '002021.SZA']
      日期: 2018-07-04 股票: ['600610.SHA', '002437.SZA', '000752.SZA', '002584.SZA'] 出现跟踪止损状况
      2018-07-04 固定天数卖出列表 ['600610.SHA', '000752.SZA', '002584.SZA', '600870.SHA']
      日期: 2018-07-05 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-05 固定天数卖出列表 ['600610.SHA']
      日期: 2018-07-06 股票: ['600610.SHA', '002437.SZA', '300677.SZA'] 出现跟踪止损状况
      2018-07-06 固定天数卖出列表 ['600610.SHA', '603897.SHA', '300141.SZA', '300677.SZA']
      日期: 2018-07-09 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-09 固定天数卖出列表 ['600610.SHA', '300374.SZA', '603960.SHA']
      日期: 2018-07-10 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-10 固定天数卖出列表 ['600610.SHA', '600289.SHA', '300706.SZA', '603519.SHA']
      日期: 2018-07-11 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-11 固定天数卖出列表 ['600610.SHA', '600682.SHA']
      日期: 2018-07-12 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-12 固定天数卖出列表 ['600610.SHA', '002021.SZA', '600365.SHA', '600807.SHA']
      日期: 2018-07-13 股票: ['600610.SHA', '002437.SZA', '603356.SHA'] 出现跟踪止损状况
      2018-07-13 固定天数卖出列表 ['600610.SHA', '603356.SHA', '300150.SZA', '600228.SHA']
      日期: 2018-07-16 股票: ['600610.SHA', '002437.SZA', '300243.SZA', '300216.SZA', '300074.SZA'] 出现跟踪止损状况
      2018-07-16 固定天数卖出列表 ['600610.SHA', '300243.SZA', '300216.SZA', '300074.SZA']
      日期: 2018-07-17 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-17 固定天数卖出列表 ['600610.SHA', '000752.SZA', '603519.SHA']
      日期: 2018-07-18 股票: ['600610.SHA', '002437.SZA', '300023.SZA'] 出现跟踪止损状况
      2018-07-18 固定天数卖出列表 ['600610.SHA', '002259.SZA', '600241.SHA', '300023.SZA']
      日期: 2018-07-19 股票: ['600610.SHA', '002437.SZA', '002897.SZA'] 出现跟踪止损状况
      2018-07-19 固定天数卖出列表 ['600610.SHA', '300393.SZA', '002897.SZA']
      日期: 2018-07-20 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-20 固定天数卖出列表 ['600610.SHA', '002072.SZA', '600152.SHA']
      日期: 2018-07-23 股票: ['600610.SHA', '002437.SZA', '002072.SZA', '000153.SZA'] 出现跟踪止损状况
      2018-07-23 固定天数卖出列表 ['600610.SHA', '002072.SZA', '000153.SZA']
      日期: 2018-07-24 股票: ['600610.SHA', '002437.SZA', '600212.SHA'] 出现跟踪止损状况
      2018-07-24 固定天数卖出列表 ['600610.SHA', '600212.SHA', '300469.SZA']
      日期: 2018-07-25 股票: ['600610.SHA', '002437.SZA'] 出现跟踪止损状况
      2018-07-25 固定天数卖出列表 ['600610.SHA', '000409.SZA', '002861.SZA', '300460.SZA']
      日期: 2018-07-26 股票: ['002437.SZA', '300551.SZA'] 出现跟踪止损状况
      2018-07-26 固定天数卖出列表 ['300551.SZA', '600385.SHA', '600202.SHA']
      日期: 2018-07-27 股票: ['002437.SZA', '002576.SZA', '002560.SZA'] 出现跟踪止损状况
      2018-07-27 固定天数卖出列表 ['600896.SHA', '002576.SZA', '002560.SZA']
      日期: 2018-07-30 股票: ['002437.SZA', '000576.SZA', '600165.SHA', '002219.SZA'] 出现跟踪止损状况
      2018-07-30 固定天数卖出列表 ['000576.SZA', '600165.SHA', '002219.SZA']
      日期: 2018-07-31 股票: ['002437.SZA', '300011.SZA', '600338.SHA', '000498.SZA'] 出现跟踪止损状况
      2018-07-31 固定天数卖出列表 ['300011.SZA', '600338.SHA', '000498.SZA']
      2018-08-01 尾盘涨停取消卖单 000498.SZA
      日期: 2018-08-01 股票: ['002437.SZA', '600368.SHA'] 出现跟踪止损状况
      2018-08-01 固定天数卖出列表 ['000498.SZA', '600107.SHA', '000655.SZA', '600368.SHA']
      日期: 2018-08-02 股票: ['002437.SZA', '600753.SHA', '600817.SHA', '300354.SZA'] 出现跟踪止损状况
      2018-08-02 固定天数卖出列表 ['600753.SHA', '600817.SHA', '300354.SZA']
      2018-08-03 大盘风控止损触发,全仓卖出
      2018-08-06 大盘风控止损触发,全仓卖出
      日期: 2018-08-07 股票: ['002437.SZA'] 出现跟踪止损状况
      日期: 2018-08-08 股票: ['002437.SZA'] 出现跟踪止损状况
      日期: 2018-08-09 股票: ['002437.SZA', '600234.SHA', '600165.SHA'] 出现跟踪止损状况
      2018-08-09 固定天数卖出列表 ['600212.SHA', '600234.SHA', '600165.SHA']
      日期: 2018-08-10 股票: ['002437.SZA'] 出现跟踪止损状况
      日期: 2018-08-13 股票: ['002437.SZA'] 出现跟踪止损状况
      2018-08-13 固定天数卖出列表 ['002437.SZA']
      日期: 2018-08-14 股票: ['002437.SZA'] 出现跟踪止损状况
      2018-08-14 固定天数卖出列表 ['002437.SZA', '600610.SHA']
      日期: 2018-08-15 股票: ['600610.SHA', '600165.SHA'] 出现跟踪止损状况
      2018-08-15 固定天数卖出列表 ['600610.SHA', '600165.SHA']
      日期: 2018-08-16 股票: ['000939.SZA'] 出现跟踪止损状况
      2018-08-16 固定天数卖出列表 ['000939.SZA']
      2018-08-17 大盘风控止损触发,全仓卖出
      日期: 2018-08-22 股票: ['000673.SZA'] 出现跟踪止损状况
      2018-08-22 固定天数卖出列表 ['300198.SZA', '603920.SHA', '000673.SZA']
      日期: 2018-08-27 股票: ['300517.SZA'] 出现跟踪止损状况
      2018-08-27 固定天数卖出列表 ['000707.SZA', '300517.SZA']
      2018-08-28 固定天数卖出列表 ['300198.SZA', '300471.SZA']
      日期: 2018-08-30 股票: ['600890.SHA', '002848.SZA'] 出现跟踪止损状况
      2018-08-30 固定天数卖出列表 ['600218.SHA', '600890.SHA', '002848.SZA']
      日期: 2018-08-31 股票: ['600146.SHA'] 出现跟踪止损状况
      2018-08-31 固定天数卖出列表 ['002798.SZA', '600146.SHA', '002087.SZA']
      2018-09-04 固定天数卖出列表 ['600501.SHA', '600610.SHA', '600882.SHA']
      日期: 2018-09-05 股票: ['300517.SZA', '000673.SZA'] 出现跟踪止损状况
      2018-09-05 固定天数卖出列表 ['600146.SHA', '300517.SZA', '000673.SZA']
      2018-09-07 固定天数卖出列表 ['002921.SZA', '300416.SZA', '002234.SZA']
      日期: 2018-09-10 股票: ['300659.SZA', '603076.SHA', '300517.SZA'] 出现跟踪止损状况
      2018-09-10 固定天数卖出列表 ['300659.SZA', '603076.SHA', '300517.SZA']
      日期: 2018-09-12 股票: ['300663.SZA'] 出现跟踪止损状况
      2018-09-12 固定天数卖出列表 ['300663.SZA', '601811.SHA', '603727.SHA']
      2018-09-13 固定天数卖出列表 ['000008.SZA', '002808.SZA', '600406.SHA']
      日期: 2018-09-17 股票: ['300458.SZA', '002473.SZA'] 出现跟踪止损状况
      2018-09-17 固定天数卖出列表 ['600539.SHA', '300458.SZA', '002473.SZA']
      2018-09-18 固定天数卖出列表 ['300603.SZA', '002321.SZA', '300426.SZA']
      日期: 2018-09-20 股票: ['002113.SZA'] 出现跟踪止损状况
      2018-09-20 固定天数卖出列表 ['600280.SHA', '002113.SZA', '600687.SHA']
      2018-09-21 尾盘涨停取消卖单 002113.SZA
      2018-09-21 固定天数卖出列表 ['002113.SZA', '603880.SHA', '000622.SZA', '600767.SHA']
      2018-09-25 尾盘涨停取消卖单 002113.SZA
      2018-09-25 固定天数卖出列表 ['002113.SZA']
      2018-09-26 尾盘涨停取消卖单 002113.SZA
      2018-09-26 止盈股票列表 ['002113.SZA']
      日期: 2018-09-26 股票: ['002098.SZA'] 出现跟踪止损状况
      2018-09-26 固定天数卖出列表 ['603036.SHA', '002098.SZA', '600421.SHA']
      2018-09-27 尾盘涨停取消卖单 002113.SZA
      2018-09-27 止盈股票列表 ['002113.SZA']
      日期: 2018-09-27 股票: ['300071.SZA', '600701.SHA', '000962.SZA'] 出现跟踪止损状况
      2018-09-27 固定天数卖出列表 ['300071.SZA', '600701.SHA', '000962.SZA']
      日期: 2018-10-08 股票: ['603716.SHA', '600462.SHA', '002388.SZA'] 出现跟踪止损状况
      2018-10-08 固定天数卖出列表 ['603716.SHA', '600462.SHA', '002388.SZA']
      2018-10-09 固定天数卖出列表 ['300354.SZA', '600701.SHA', '300321.SZA']
      2018-10-11 大盘风控止损触发,全仓卖出
      2018-10-12 大盘风控止损触发,全仓卖出
      2018-10-16 大盘风控止损触发,全仓卖出
      日期: 2018-10-19 股票: ['603311.SHA'] 出现跟踪止损状况
      2018-10-19 固定天数卖出列表 ['603856.SHA', '603311.SHA']
      2018-10-22 固定天数卖出列表 ['002012.SZA', '300381.SZA']
      2018-10-24 固定天数卖出列表 ['002723.SZA', '600701.SHA']
      2018-10-25 尾盘涨停取消卖单 600701.SHA
      2018-10-25 固定天数卖出列表 ['600701.SHA', '600490.SHA', '603389.SHA', '300042.SZA']
      2018-10-26 尾盘涨停取消卖单 600701.SHA
      2018-10-26 固定天数卖出列表 ['600701.SHA']
      2018-10-29 尾盘涨停取消卖单 600701.SHA
      2018-10-29 大盘风控止损触发,全仓卖出
      2018-10-30 尾盘涨停取消卖单 600701.SHA
      2018-10-30 尾盘涨停取消卖单 002259.SZA
      2018-10-30 固定天数卖出列表 ['600701.SHA', '002259.SZA']
      2018-10-31 尾盘涨停取消卖单 600701.SHA
      2018-10-31 固定天数卖出列表 ['600701.SHA']
      2018-11-01 尾盘涨停取消卖单 600701.SHA
      2018-11-01 止盈股票列表 ['600701.SHA']
      2018-11-01 固定天数卖出列表 ['300042.SZA', '600238.SHA']
      2018-11-02 尾盘涨停取消卖单 600238.SHA
      日期: 2018-11-02 股票: ['300608.SZA'] 出现跟踪止损状况
      2018-11-02 固定天数卖出列表 ['603389.SHA', '600238.SHA', '002333.SZA', '300608.SZA']
      2018-11-06 固定天数卖出列表 ['300163.SZA', '300161.SZA', '300042.SZA']
      2018-11-07 固定天数卖出列表 ['300515.SZA', '300521.SZA', '000056.SZA']
      2018-11-08 固定天数卖出列表 ['603996.SHA']
      日期: 2018-11-09 股票: ['000590.SZA'] 出现跟踪止损状况
      2018-11-09 固定天数卖出列表 ['600095.SHA', '000590.SZA', '300417.SZA']
      日期: 2018-11-12 股票: ['300549.SZA'] 出现跟踪止损状况
      2018-11-12 固定天数卖出列表 ['002758.SZA', '300549.SZA']
      日期: 2018-11-13 股票: ['600257.SHA'] 出现跟踪止损状况
      2018-11-13 固定天数卖出列表 ['002496.SZA', '600257.SHA']
      2018-11-14 固定天数卖出列表 ['002680.SZA', '603090.SHA', '300453.SZA']
      2018-11-15 尾盘涨停取消卖单 002680.SZA
      2018-11-15 固定天数卖出列表 ['002680.SZA', '300549.SZA', '300042.SZA', '600791.SHA']
      2018-11-16 尾盘涨停取消卖单 002680.SZA
      日期: 2018-11-16 股票: ['002606.SZA'] 出现跟踪止损状况
      2018-11-16 固定天数卖出列表 ['002680.SZA', '600275.SHA', '002606.SZA']
      日期: 2018-11-19 股票: ['000691.SZA', '000585.SZA'] 出现跟踪止损状况
      2018-11-19 固定天数卖出列表 ['000638.SZA', '000691.SZA', '000585.SZA']
      日期: 2018-11-20 股票: ['000638.SZA', '300644.SZA', '000004.SZA'] 出现跟踪止损状况
      2018-11-20 固定天数卖出列表 ['000638.SZA', '300644.SZA', '000004.SZA']
      2018-11-21 固定天数卖出列表 ['002207.SZA', '600608.SHA', '000995.SZA']
      2018-11-22 尾盘涨停取消卖单 000995.SZA
      2018-11-22 固定天数卖出列表 ['000995.SZA', '603165.SHA', '300709.SZA', '002740.SZA']
      日期: 2018-11-23 股票: ['000995.SZA', '300268.SZA', '600539.SHA', '600193.SHA'] 出现跟踪止损状况
      2018-11-23 固定天数卖出列表 ['000995.SZA', '300268.SZA', '600539.SHA', '600193.SHA']
      日期: 2018-11-26 股票: ['300343.SZA', '300029.SZA', '600234.SHA'] 出现跟踪止损状况
      2018-11-26 固定天数卖出列表 ['300343.SZA', '300029.SZA', '600234.SHA']
      2018-11-27 固定天数卖出列表 ['600860.SHA', '002758.SZA', '300067.SZA']
      日期: 2018-11-28 股票: ['000668.SZA'] 出现跟踪止损状况
      2018-11-28 固定天数卖出列表 ['002817.SZA', '000668.SZA', '300569.SZA']
      日期: 2018-11-29 股票: ['603309.SHA', '600696.SHA', '300330.SZA'] 出现跟踪止损状况
      2018-11-29 固定天数卖出列表 ['603309.SHA', '600696.SHA', '300330.SZA']
      日期: 2018-11-30 股票: ['600225.SHA'] 出现跟踪止损状况
      2018-11-30 固定天数卖出列表 ['600225.SHA', '600421.SHA', '300557.SZA']
      2018-12-03 固定天数卖出列表 ['002837.SZA', '600833.SHA', '600198.SHA']
      日期: 2018-12-04 股票: ['300606.SZA', '000979.SZA'] 出现跟踪止损状况
      2018-12-04 固定天数卖出列表 ['300606.SZA', '600310.SHA', '000979.SZA']
      日期: 2018-12-05 股票: ['600301.SHA'] 出现跟踪止损状况
      2018-12-05 固定天数卖出列表 ['600608.SHA', '600301.SHA', '603029.SHA']
      2018-12-06 固定天数卖出列表 ['300370.SZA', '300551.SZA', '002531.SZA']
      日期: 2018-12-07 股票: ['002450.SZA'] 出现跟踪止损状况
      2018-12-07 固定天数卖出列表 ['002450.SZA', '300220.SZA', '000806.SZA']
      日期: 2018-12-10 股票: ['000979.SZA', '000981.SZA'] 出现跟踪止损状况
      2018-12-10 固定天数卖出列表 ['000979.SZA', '600776.SHA', '000981.SZA']
      2018-12-11 尾盘涨停取消卖单 600776.SHA
      2018-12-11 止盈股票列表 ['600776.SHA']
      2018-12-11 固定天数卖出列表 ['002017.SZA', '600223.SHA', '000004.SZA']
      日期: 2018-12-12 股票: ['002856.SZA'] 出现跟踪止损状况
      2018-12-12 固定天数卖出列表 ['002856.SZA', '300435.SZA']
      日期: 2018-12-13 股票: ['000979.SZA'] 出现跟踪止损状况
      2018-12-13 固定天数卖出列表 ['000979.SZA', '603222.SHA', '600099.SHA']
      日期: 2018-12-14 股票: ['600209.SHA', '600610.SHA', '300071.SZA'] 出现跟踪止损状况
      2018-12-14 固定天数卖出列表 ['600209.SHA', '600610.SHA', '300071.SZA']
      2018-12-17 尾盘涨停取消卖单 600610.SHA
      日期: 2018-12-17 股票: ['002732.SZA'] 出现跟踪止损状况
      2018-12-17 固定天数卖出列表 ['600610.SHA', '603096.SHA', '002732.SZA', '600768.SHA']
      2018-12-18 尾盘涨停取消卖单 600610.SHA
      日期: 2018-12-18 股票: ['603966.SHA', '603238.SHA'] 出现跟踪止损状况
      2018-12-18 固定天数卖出列表 ['600610.SHA', '603912.SHA', '603966.SHA', '603238.SHA']
      2018-12-19 尾盘涨停取消卖单 600610.SHA
      2018-12-19 固定天数卖出列表 ['600610.SHA', '300585.SZA', '601798.SHA', '603880.SHA']
      2018-12-20 固定天数卖出列表 ['300228.SZA', '300260.SZA', '603326.SHA']
      日期: 2018-12-21 股票: ['603131.SHA', '300746.SZA'] 出现跟踪止损状况
      2018-12-21 固定天数卖出列表 ['603131.SHA', '300746.SZA']
      日期: 2018-12-24 股票: ['002660.SZA'] 出现跟踪止损状况
      2018-12-24 固定天数卖出列表 ['002660.SZA', '300732.SZA']
      日期: 2018-12-25 股票: ['000979.SZA'] 出现跟踪止损状况
      2018-12-25 固定天数卖出列表 ['000979.SZA', '002252.SZA', '300495.SZA']
      2018-12-26 尾盘涨停取消卖单 002252.SZA
      日期: 2018-12-26 股票: ['000979.SZA', '300392.SZA'] 出现跟踪止损状况
      2018-12-26 固定天数卖出列表 ['000979.SZA', '002252.SZA', '300392.SZA', '300494.SZA', '600250.SHA']
      日期: 2018-12-27 股票: ['600212.SHA', '603895.SHA', '600767.SHA'] 出现跟踪止损状况
      2018-12-27 固定天数卖出列表 ['600212.SHA', '603895.SHA', '600767.SHA']
      日期: 2018-12-28 股票: ['603283.SHA', '300362.SZA'] 出现跟踪止损状况
      2018-12-28 固定天数卖出列表 ['603283.SHA', '300362.SZA']
      2019-01-02 尾盘涨停取消卖单 300362.SZA
      日期: 2019-01-02 股票: ['002922.SZA'] 出现跟踪止损状况
      2019-01-02 固定天数卖出列表 ['300362.SZA', '300548.SZA', '002860.SZA', '002922.SZA']
      日期: 2019-01-03 股票: ['300687.SZA', '002719.SZA'] 出现跟踪止损状况
      2019-01-03 固定天数卖出列表 ['300687.SZA', '300490.SZA', '002719.SZA']
      日期: 2019-01-07 股票: ['300662.SZA'] 出现跟踪止损状况
      2019-01-07 固定天数卖出列表 ['300662.SZA', '002174.SZA', '600388.SHA']
      日期: 2019-01-08 股票: ['300575.SZA', '600605.SHA'] 出现跟踪止损状况
      2019-01-08 固定天数卖出列表 ['300575.SZA', '600605.SHA', '603037.SHA']
      2019-01-10 固定天数卖出列表 ['002761.SZA', '603039.SHA', '000590.SZA']
      日期: 2019-01-11 股票: ['300602.SZA'] 出现跟踪止损状况
      2019-01-11 固定天数卖出列表 ['300602.SZA', '300556.SZA', '600113.SHA']
      2019-01-15 固定天数卖出列表 ['000862.SZA', '300129.SZA', '603500.SHA']
      日期: 2019-01-16 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-16 固定天数卖出列表 ['002680.SZA', '600983.SHA', '000004.SZA', '601019.SHA']
      日期: 2019-01-17 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-17 固定天数卖出列表 ['002680.SZA']
      日期: 2019-01-18 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-18 固定天数卖出列表 ['002680.SZA', '002783.SZA', '002200.SZA']
      2019-01-21 尾盘涨停取消卖单 002783.SZA
      日期: 2019-01-21 股票: ['002680.SZA', '300152.SZA', '000692.SZA'] 出现跟踪止损状况
      2019-01-21 固定天数卖出列表 ['002680.SZA', '300152.SZA', '002783.SZA', '000692.SZA', '002082.SZA']
      日期: 2019-01-22 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-22 固定天数卖出列表 ['002680.SZA']
      日期: 2019-01-23 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-23 固定天数卖出列表 ['002680.SZA', '000004.SZA', '300354.SZA', '300517.SZA']
      2019-01-24 尾盘涨停取消卖单 300354.SZA
      日期: 2019-01-24 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-24 固定天数卖出列表 ['002680.SZA', '300354.SZA', '600552.SHA', '002781.SZA', '601003.SHA']
      日期: 2019-01-25 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-01-25 固定天数卖出列表 ['002680.SZA']
      日期: 2019-01-28 股票: ['002680.SZA', '600566.SHA', '600099.SHA', '300521.SZA'] 出现跟踪止损状况
      2019-01-28 固定天数卖出列表 ['002680.SZA', '600566.SHA', '600099.SHA', '300521.SZA']
      日期: 2019-01-29 股票: ['002680.SZA', '600929.SHA', '002674.SZA', '600470.SHA'] 出现跟踪止损状况
      2019-01-29 固定天数卖出列表 ['002680.SZA', '600929.SHA', '002674.SZA', '600470.SHA']
      日期: 2019-01-30 股票: ['002680.SZA', '600470.SHA'] 出现跟踪止损状况
      2019-01-30 固定天数卖出列表 ['002680.SZA', '600470.SHA']
      日期: 2019-01-31 股票: ['002680.SZA', '300520.SZA', '300547.SZA'] 出现跟踪止损状况
      2019-01-31 固定天数卖出列表 ['002680.SZA', '002321.SZA', '300520.SZA', '300547.SZA']
      日期: 2019-02-01 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-01 固定天数卖出列表 ['002680.SZA', '603131.SHA', '600446.SHA', '603848.SHA']
      日期: 2019-02-11 股票: ['002680.SZA', '002778.SZA', '300362.SZA'] 出现跟踪止损状况
      2019-02-11 固定天数卖出列表 ['002680.SZA', '002778.SZA', '300362.SZA', '601828.SHA']
      日期: 2019-02-12 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-12 固定天数卖出列表 ['002680.SZA', '002774.SZA', '002207.SZA', '603088.SHA']
      2019-02-13 尾盘涨停取消卖单 002680.SZA
      日期: 2019-02-13 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-13 固定天数卖出列表 ['002680.SZA', '600462.SHA']
      日期: 2019-02-14 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-14 固定天数卖出列表 ['002680.SZA', '601798.SHA']
      日期: 2019-02-15 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-15 固定天数卖出列表 ['002680.SZA', '600768.SHA']
      2019-02-18 固定天数卖出列表 ['000611.SZA', '300254.SZA']
      2019-02-19 固定天数卖出列表 ['603088.SHA', '600355.SHA']
      2019-02-20 固定天数卖出列表 ['600768.SHA', '300573.SZA']
      2019-02-21 固定天数卖出列表 ['002207.SZA']
      日期: 2019-02-22 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-22 固定天数卖出列表 ['002680.SZA', '600608.SHA']
      2019-02-25 尾盘涨停取消卖单 002680.SZA
      日期: 2019-02-25 股票: ['002680.SZA'] 出现跟踪止损状况
      2019-02-25 固定天数卖出列表 ['002680.SZA', '002660.SZA', '002122.SZA', '002102.SZA']
      2019-02-26 固定天数卖出列表 ['300387.SZA', '600768.SHA', '002890.SZA']
      2019-02-27 固定天数卖出列表 ['002760.SZA', '600275.SHA', '600817.SHA']
      2019-02-28 尾盘涨停取消卖单 600275.SHA
      日期: 2019-02-28 股票: ['300264.SZA'] 出现跟踪止损状况
      2019-02-28 固定天数卖出列表 ['600275.SHA', '300264.SZA', '300400.SZA', '600146.SHA']
      2019-03-01 固定天数卖出列表 ['300709.SZA', '002862.SZA', '600898.SHA']
      日期: 2019-03-04 股票: ['300578.SZA', '300380.SZA'] 出现跟踪止损状况
      2019-03-04 固定天数卖出列表 ['300578.SZA', '300380.SZA', '002378.SZA']
      2019-03-05 固定天数卖出列表 ['600455.SHA', '300321.SZA']
      2019-03-06 固定天数卖出列表 ['000502.SZA', '600385.SHA']
      日期: 2019-03-07 股票: ['603879.SHA', '002875.SZA'] 出现跟踪止损状况
      2019-03-07 固定天数卖出列表 ['603879.SHA', '002875.SZA', '000995.SZA']
      日期: 2019-03-08 股票: ['002875.SZA', '000995.SZA', '600306.SHA', '300622.SZA', '600234.SHA'] 出现跟踪止损状况
      2019-03-08 固定天数卖出列表 ['002875.SZA', '000995.SZA', '600306.SHA', '300622.SZA', '600234.SHA']
      日期: 2019-03-11 股票: ['600608.SHA', '000004.SZA', '600137.SHA'] 出现跟踪止损状况
      2019-03-11 固定天数卖出列表 ['600608.SHA', '000004.SZA', '600137.SHA']
      日期: 2019-03-12 股票: ['300663.SZA', '300062.SZA'] 出现跟踪止损状况
      2019-03-12 固定天数卖出列表 ['603081.SHA', '300663.SZA', '300062.SZA']
      2019-03-13 固定天数卖出列表 ['600385.SHA', '600817.SHA']
      日期: 2019-03-14 股票: ['000004.SZA'] 出现跟踪止损状况
      2019-03-14 固定天数卖出列表 ['002473.SZA', '000004.SZA', '002188.SZA']
      2019-03-15 尾盘涨停取消卖单 002473.SZA
      日期: 2019-03-15 股票: ['603197.SHA'] 出现跟踪止损状况
      2019-03-15 固定天数卖出列表 ['002473.SZA', '603197.SHA', '300119.SZA', '300419.SZA']
      日期: 2019-03-18 股票: ['300108.SZA', '000663.SZA', '300338.SZA'] 出现跟踪止损状况
      2019-03-18 固定天数卖出列表 ['300108.SZA', '000663.SZA', '300338.SZA']
      2019-03-19 固定天数卖出列表 ['002473.SZA', '603266.SHA', '002862.SZA', '300290.SZA']
      2019-03-20 尾盘涨停取消卖单 002473.SZA
      日期: 2019-03-20 股票: ['300579.SZA'] 出现跟踪止损状况
      2019-03-20 固定天数卖出列表 ['002473.SZA', '300579.SZA', '603908.SHA', '000953.SZA']
      2019-03-21 尾盘涨停取消卖单 002473.SZA
      2019-03-21 尾盘涨停取消卖单 000953.SZA
      2019-03-21 止盈股票列表 ['002473.SZA']
      2019-03-21 固定天数卖出列表 ['000953.SZA', '002260.SZA']
      2019-03-22 固定天数卖出列表 ['603286.SHA', '300626.SZA']
      日期: 2019-03-25 股票: ['600860.SHA'] 出现跟踪止损状况
      2019-03-25 固定天数卖出列表 ['300354.SZA', '600860.SHA', '000004.SZA']
      日期: 2019-03-26 股票: ['603578.SHA', '002760.SZA'] 出现跟踪止损状况
      2019-03-26 固定天数卖出列表 ['603578.SHA', '002109.SZA', '002760.SZA']
      2019-03-27 固定天数卖出列表 ['603303.SHA', '600493.SHA', '300702.SZA']
      日期: 2019-03-28 股票: ['600289.SHA', '603888.SHA', '603666.SHA'] 出现跟踪止损状况
      2019-03-28 固定天数卖出列表 ['600289.SHA', '603888.SHA', '603666.SHA']
      2019-03-29 尾盘涨停取消卖单 603888.SHA
      2019-03-29 固定天数卖出列表 ['603888.SHA', '300489.SZA', '300013.SZA', '000929.SZA']
      2019-04-01 固定天数卖出列表 ['300709.SZA', '300569.SZA', '603528.SHA']
      日期: 2019-04-02 股票: ['300507.SZA'] 出现跟踪止损状况
      2019-04-02 固定天数卖出列表 ['300507.SZA', '603963.SHA', '000953.SZA']
      2019-04-03 固定天数卖出列表 ['002800.SZA', '600605.SHA']
      2019-04-04 固定天数卖出列表 ['600099.SHA', '603668.SHA']
      日期: 2019-04-08 股票: ['002188.SZA'] 出现跟踪止损状况
      2019-04-08 固定天数卖出列表 ['002188.SZA', '600234.SHA', '600275.SHA']
      2019-04-09 固定天数卖出列表 ['300640.SZA', '300029.SZA']
      日期: 2019-04-10 股票: ['300220.SZA'] 出现跟踪止损状况
      2019-04-10 固定天数卖出列表 ['000004.SZA', '603991.SHA', '603131.SHA', '300220.SZA']
      日期: 2019-04-11 股票: ['603378.SHA'] 出现跟踪止损状况
      2019-04-11 固定天数卖出列表 ['603378.SHA', '603580.SHA', '600516.SHA']
      2019-04-12 固定天数卖出列表 ['603360.SHA', '600796.SHA', '002633.SZA']
      日期: 2019-04-15 股票: ['603639.SHA', '603086.SHA', '002553.SZA'] 出现跟踪止损状况
      2019-04-15 固定天数卖出列表 ['603639.SHA', '603086.SHA', '002553.SZA']
      日期: 2019-04-16 股票: ['300165.SZA'] 出现跟踪止损状况
      2019-04-16 固定天数卖出列表 ['300165.SZA', '300014.SZA', '002188.SZA']
      2019-04-17 尾盘涨停取消卖单 002188.SZA
      2019-04-17 固定天数卖出列表 ['002188.SZA', '600513.SHA', '000004.SZA', '002919.SZA']
      2019-04-18 固定天数卖出列表 ['603879.SHA', '002357.SZA', '000929.SZA']
      2019-04-19 固定天数卖出列表 ['002633.SZA', '300354.SZA', '300626.SZA']
      日期: 2019-04-22 股票: ['603709.SHA', '600634.SHA', '000897.SZA'] 出现跟踪止损状况
      2019-04-22 固定天数卖出列表 ['603709.SHA', '600634.SHA', '000897.SZA']
      日期: 2019-04-23 股票: ['600634.SHA', '002388.SZA', '000502.SZA'] 出现跟踪止损状况
      2019-04-23 固定天数卖出列表 ['600634.SHA', '603266.SHA', '002388.SZA', '000502.SZA']
      日期: 2019-04-24 股票: ['600634.SHA'] 出现跟踪止损状况
      2019-04-24 固定天数卖出列表 ['600634.SHA', '000632.SZA', '002205.SZA', '601601.SHA']
      日期: 2019-04-25 股票: ['600634.SHA', '300345.SZA', '002758.SZA', '600539.SHA'] 出现跟踪止损状况
      2019-04-25 固定天数卖出列表 ['600634.SHA', '300345.SZA', '002758.SZA', '600539.SHA']
      2019-04-26 大盘风控止损触发,全仓卖出
      2019-05-06 大盘风控止损触发,全仓卖出
      2019-05-07 大盘风控止损触发,全仓卖出
      2019-05-08 大盘风控止损触发,全仓卖出
      2019-05-09 大盘风控止损触发,全仓卖出
      日期: 2019-05-14 股票: ['002143.SZA'] 出现跟踪止损状况
      2019-05-14 固定天数卖出列表 ['002143.SZA', '600891.SHA']
      日期: 2019-05-15 股票: ['600891.SHA'] 出现跟踪止损状况
      2019-05-15 固定天数卖出列表 ['600119.SHA', '600891.SHA']
      日期: 2019-05-16 股票: ['300362.SZA'] 出现跟踪止损状况
      2019-05-16 固定天数卖出列表 ['300362.SZA']
      日期: 2019-05-17 股票: ['600652.SHA'] 出现跟踪止损状况
      2019-05-17 固定天数卖出列表 ['002333.SZA', '600652.SHA']
      日期: 2019-05-20 股票: ['000820.SZA', '002333.SZA', '600652.SHA', '000760.SZA', '002175.SZA'] 出现跟踪止损状况
      2019-05-20 固定天数卖出列表 ['000820.SZA', '002333.SZA', '600652.SHA', '000760.SZA', '002175.SZA']
      日期: 2019-05-21 股票: ['000820.SZA', '000760.SZA', '002175.SZA'] 出现跟踪止损状况
      2019-05-21 固定天数卖出列表 ['000820.SZA', '000760.SZA', '002175.SZA', '300023.SZA']
      日期: 2019-05-22 股票: ['000760.SZA', '002175.SZA'] 出现跟踪止损状况
      2019-05-22 固定天数卖出列表 ['000760.SZA', '002175.SZA']
      日期: 2019-05-23 股票: ['000760.SZA', '002175.SZA', '600209.SHA', '300726.SZA'] 出现跟踪止损状况
      2019-05-23 固定天数卖出列表 ['000760.SZA', '002175.SZA', '600209.SHA', '300726.SZA', '000737.SZA']
      日期: 2019-05-24 股票: ['000760.SZA', '002175.SZA', '600209.SHA'] 出现跟踪止损状况
      2019-05-24 固定天数卖出列表 ['000760.SZA', '002175.SZA', '600209.SHA', '300430.SZA', '603266.SHA', '300417.SZA']
      2019-05-28 固定天数卖出列表 ['300462.SZA', '000526.SZA', '002153.SZA']
      日期: 2019-05-29 股票: ['000981.SZA'] 出现跟踪止损状况
      2019-05-29 固定天数卖出列表 ['600652.SHA', '000981.SZA']
      2019-05-30 固定天数卖出列表 ['000820.SZA', '002872.SZA']
      日期: 2019-05-31 股票: ['000820.SZA', '300626.SZA'] 出现跟踪止损状况
      2019-05-31 固定天数卖出列表 ['000820.SZA', '600792.SHA', '300626.SZA', '300192.SZA']
      日期: 2019-06-03 股票: ['002501.SZA', '002684.SZA', '600584.SHA'] 出现跟踪止损状况
      2019-06-03 固定天数卖出列表 ['002501.SZA', '002684.SZA', '600584.SHA']
      日期: 2019-06-04 股票: ['002684.SZA', '600666.SHA', '002089.SZA'] 出现跟踪止损状况
      2019-06-04 固定天数卖出列表 ['002684.SZA', '600666.SHA', '002175.SZA', '002089.SZA']
      日期: 2019-06-05 股票: ['002684.SZA', '603278.SHA', '603619.SHA'] 出现跟踪止损状况
      2019-06-05 固定天数卖出列表 ['002684.SZA', '603278.SHA', '603706.SHA', '603619.SHA']
      日期: 2019-06-06 股票: ['002684.SZA', '300525.SZA', '600608.SHA'] 出现跟踪止损状况
      2019-06-06 固定天数卖出列表 ['002684.SZA', '300525.SZA', '600608.SHA', '300629.SZA']
      日期: 2019-06-10 股票: ['603663.SHA', '300611.SZA', '002501.SZA'] 出现跟踪止损状况
      2019-06-10 固定天数卖出列表 ['603663.SHA', '300611.SZA', '002501.SZA']
      日期: 2019-06-11 股票: ['002943.SZA'] 出现跟踪止损状况
      2019-06-11 固定天数卖出列表 ['002943.SZA', '300283.SZA', '002089.SZA']
      日期: 2019-06-12 股票: ['300421.SZA'] 出现跟踪止损状况
      2019-06-12 固定天数卖出列表 ['300090.SZA', '300421.SZA', '603286.SHA']
      2019-06-13 尾盘涨停取消卖单 300090.SZA
      2019-06-13 固定天数卖出列表 ['300090.SZA', '002143.SZA']
      2019-06-14 尾盘涨停取消卖单 300090.SZA
      2019-06-14 止盈股票列表 ['300090.SZA']
      日期: 2019-06-14 股票: ['600666.SHA', '002866.SZA'] 出现跟踪止损状况
      2019-06-14 固定天数卖出列表 ['600666.SHA', '000010.SZA', '002866.SZA']
      日期: 2019-06-17 股票: ['300739.SZA', '002089.SZA', '002210.SZA'] 出现跟踪止损状况
      2019-06-17 固定天数卖出列表 ['300739.SZA', '002089.SZA', '002210.SZA']
      日期: 2019-06-18 股票: ['002210.SZA', '600127.SHA'] 出现跟踪止损状况
      2019-06-18 固定天数卖出列表 ['002210.SZA', '600127.SHA', '000911.SZA']
      日期: 2019-06-19 股票: ['300730.SZA'] 出现跟踪止损状况
      2019-06-19 固定天数卖出列表 ['300730.SZA', '601212.SHA', '002417.SZA']
      日期: 2019-06-20 股票: ['300730.SZA'] 出现跟踪止损状况
      2019-06-20 固定天数卖出列表 ['300730.SZA', '300588.SZA', '002333.SZA', '603516.SHA']
      2019-06-21 固定天数卖出列表 ['603963.SHA', '002427.SZA', '603880.SHA']
      日期: 2019-06-24 股票: ['002522.SZA'] 出现跟踪止损状况
      2019-06-24 固定天数卖出列表 ['603138.SHA', '002522.SZA', '603269.SHA']
      2019-06-25 固定天数卖出列表 ['002692.SZA', '002359.SZA', '600518.SHA']
      2019-06-26 尾盘涨停取消卖单 002359.SZA
      2019-06-26 尾盘涨停取消卖单 600518.SHA
      2019-06-26 固定天数卖出列表 ['002359.SZA', '600518.SHA', '002687.SZA', '600193.SHA', '002499.SZA']
      2019-06-27 尾盘涨停取消卖单 600518.SHA
      日期: 2019-06-27 股票: ['300022.SZA'] 出现跟踪止损状况
      2019-06-27 固定天数卖出列表 ['600518.SHA', '300674.SZA', '300022.SZA', '300074.SZA']
      2019-06-28 尾盘涨停取消卖单 300022.SZA
      2019-06-28 尾盘涨停取消卖单 600518.SHA
      日期: 2019-06-28 股票: ['300629.SZA', '300431.SZA'] 出现跟踪止损状况
      2019-06-28 固定天数卖出列表 ['600518.SHA', '300022.SZA', '300629.SZA', '002159.SZA', '300431.SZA']
      2019-07-01 尾盘涨停取消卖单 600518.SHA
      2019-07-01 止盈股票列表 ['600518.SHA']
      日期: 2019-07-01 股票: ['002823.SZA'] 出现跟踪止损状况
      2019-07-01 固定天数卖出列表 ['002735.SZA', '002823.SZA', '002188.SZA']
      2019-07-02 尾盘涨停取消卖单 600518.SHA
      2019-07-02 止盈股票列表 ['600518.SHA']
      日期: 2019-07-02 股票: ['603825.SHA'] 出现跟踪止损状况
      2019-07-02 固定天数卖出列表 ['603316.SHA', '603825.SHA', '000408.SZA']
      2019-07-03 止盈股票列表 ['600518.SHA']
      日期: 2019-07-03 股票: ['600518.SHA'] 出现跟踪止损状况
      2019-07-03 固定天数卖出列表 ['300169.SZA', '000693.SZA']
      日期: 2019-07-04 股票: ['600518.SHA'] 出现跟踪止损状况
      2019-07-04 固定天数卖出列表 ['600518.SHA', '600234.SHA', '600866.SHA', '002236.SZA']
      2019-07-05 尾盘涨停取消卖单 600518.SHA
      2019-07-05 止盈股票列表 ['600518.SHA']
      日期: 2019-07-05 股票: ['600518.SHA', '603619.SHA'] 出现跟踪止损状况
      2019-07-05 固定天数卖出列表 ['603619.SHA', '002499.SZA', '603090.SHA']
      日期: 2019-07-08 股票: ['600518.SHA', '600547.SHA', '300403.SZA'] 出现跟踪止损状况
      2019-07-08 固定天数卖出列表 ['600518.SHA', '600547.SHA', '300403.SZA']
      2019-07-09 固定天数卖出列表 ['600247.SHA', '600634.SHA', '600119.SHA']
      日期: 2019-07-10 股票: ['002858.SZA'] 出现跟踪止损状况
      2019-07-10 固定天数卖出列表 ['300735.SZA', '002858.SZA', '603506.SHA']
      2019-07-11 固定天数卖出列表 ['002259.SZA']
      2019-07-12 尾盘涨停取消卖单 002259.SZA
      2019-07-12 固定天数卖出列表 ['002259.SZA', '300169.SZA', '002037.SZA']
      日期: 2019-07-15 股票: ['603996.SHA', '600634.SHA'] 出现跟踪止损状况
      2019-07-15 固定天数卖出列表 ['603996.SHA', '600745.SHA', '600634.SHA']
      2019-07-17 固定天数卖出列表 ['600247.SHA', '002420.SZA']
      2019-07-18 固定天数卖出列表 ['600462.SHA', '002021.SZA', '600209.SHA']
      日期: 2019-07-22 股票: ['300424.SZA', '300573.SZA', '603859.SHA'] 出现跟踪止损状况
      2019-07-22 固定天数卖出列表 ['300424.SZA', '300573.SZA', '603859.SHA']
      2019-07-23 固定天数卖出列表 ['002105.SZA', '002626.SZA', '300706.SZA']
      2019-07-25 固定天数卖出列表 ['601007.SHA', '000953.SZA']
      2019-07-26 固定天数卖出列表 ['002420.SZA', '600540.SHA', '600608.SHA']
      2019-07-30 固定天数卖出列表 ['603297.SHA', '300616.SZA', '600470.SHA']
      2019-07-31 固定天数卖出列表 ['300447.SZA', '600232.SHA', '600539.SHA']
      2019-08-02 固定天数卖出列表 ['002943.SZA', '002868.SZA', '300598.SZA']
      日期: 2019-08-05 股票: ['000625.SZA'] 出现跟踪止损状况
      2019-08-05 固定天数卖出列表 ['000625.SZA', '300442.SZA', '002207.SZA']
      2019-08-06 大盘风控止损触发,全仓卖出
      2019-08-07 大盘风控止损触发,全仓卖出
      2019-08-12 固定天数卖出列表 ['600421.SHA', '603029.SHA', '000089.SZA']
      2019-08-13 尾盘涨停取消卖单 000089.SZA
      2019-08-13 固定天数卖出列表 ['000089.SZA']
      2019-08-15 固定天数卖出列表 ['002354.SZA', '002556.SZA', '000504.SZA']
      日期: 2019-08-16 股票: ['603920.SHA'] 出现跟踪止损状况
      2019-08-16 固定天数卖出列表 ['603920.SHA', '300480.SZA', '300553.SZA']
      2019-08-20 固定天数卖出列表 ['600612.SHA', '300381.SZA', '600072.SHA']
      日期: 2019-08-21 股票: ['600614.SHA'] 出现跟踪止损状况
      2019-08-21 固定天数卖出列表 ['600614.SHA', '002420.SZA', '002778.SZA']
      2019-08-22 尾盘涨停取消卖单 002420.SZA
      2019-08-22 固定天数卖出列表 ['002420.SZA']
      日期: 2019-08-23 股票: ['002766.SZA'] 出现跟踪止损状况
      2019-08-23 固定天数卖出列表 ['600462.SHA', '000752.SZA', '002766.SZA']
      日期: 2019-08-26 股票: ['603926.SHA', '300731.SZA'] 出现跟踪止损状况
      2019-08-26 固定天数卖出列表 ['603926.SHA', '300731.SZA']
      2019-08-27 固定天数卖出列表 ['600539.SHA', '300074.SZA', '603118.SHA']
      2019-08-28 固定天数卖出列表 ['300417.SZA', '600735.SHA', '002134.SZA']
      日期: 2019-08-29 股票: ['002569.SZA'] 出现跟踪止损状况
      2019-08-29 固定天数卖出列表 ['600275.SHA', '002569.SZA', '600608.SHA']
      日期: 2019-08-30 股票: ['601865.SHA', '300350.SZA'] 出现跟踪止损状况
      2019-08-30 固定天数卖出列表 ['601865.SHA', '300014.SZA', '300350.SZA']
      2019-09-02 尾盘涨停取消卖单 300014.SZA
      2019-09-02 固定天数卖出列表 ['300014.SZA', '300671.SZA', '603028.SHA']
      2019-09-03 固定天数卖出列表 ['002347.SZA', '603690.SHA', '300279.SZA']
      2019-09-04 固定天数卖出列表 ['002089.SZA']
      2019-09-05 固定天数卖出列表 ['600608.SHA', '603259.SHA', '002808.SZA']
      2019-09-06 固定天数卖出列表 ['300621.SZA', '002473.SZA', '002357.SZA']
      2019-09-09 固定天数卖出列表 ['300344.SZA', '000502.SZA', '000752.SZA']
      2019-09-10 固定天数卖出列表 ['000571.SZA', '002715.SZA', '603286.SHA']
      2019-09-11 固定天数卖出列表 ['600817.SHA']
      日期: 2019-09-12 股票: ['300655.SZA'] 出现跟踪止损状况
      2019-09-12 固定天数卖出列表 ['002473.SZA', '300655.SZA']
      2019-09-16 固定天数卖出列表 ['002420.SZA', '300766.SZA']
      日期: 2019-09-17 股票: ['600275.SHA'] 出现跟踪止损状况
      2019-09-17 固定天数卖出列表 ['603903.SHA', '600275.SHA']
      2019-09-18 固定天数卖出列表 ['000752.SZA', '600539.SHA', '600817.SHA']
      2019-09-19 尾盘涨停取消卖单 000752.SZA
      2019-09-19 固定天数卖出列表 ['000752.SZA', '603996.SHA', '300650.SZA', '300773.SZA']
      2019-09-20 固定天数卖出列表 ['603798.SHA', '300612.SZA', '300180.SZA']
      日期: 2019-09-23 股票: ['000691.SZA', '000502.SZA', '002200.SZA'] 出现跟踪止损状况
      2019-09-23 固定天数卖出列表 ['000691.SZA', '000502.SZA', '002200.SZA']
      日期: 2019-09-24 股票: ['300507.SZA', '600485.SHA'] 出现跟踪止损状况
      2019-09-24 固定天数卖出列表 ['300507.SZA', '600485.SHA', '002188.SZA']
      日期: 2019-09-25 股票: ['300594.SZA', '603882.SHA'] 出现跟踪止损状况
      2019-09-25 固定天数卖出列表 ['300594.SZA', '603882.SHA', '603903.SHA']
      日期: 2019-09-26 股票: ['002723.SZA', '300460.SZA', '002200.SZA'] 出现跟踪止损状况
      2019-09-26 固定天数卖出列表 ['002723.SZA', '300460.SZA', '002200.SZA']
      日期: 2019-09-27 股票: ['603023.SHA'] 出现跟踪止损状况
      2019-09-27 固定天数卖出列表 ['603023.SHA', '603040.SHA', '603908.SHA']
      日期: 2019-09-30 股票: ['300622.SZA', '300379.SZA', '300759.SZA'] 出现跟踪止损状况
      2019-09-30 固定天数卖出列表 ['300622.SZA', '300379.SZA', '300759.SZA']
      日期: 2019-10-08 股票: ['002943.SZA', '000611.SZA'] 出现跟踪止损状况
      2019-10-08 固定天数卖出列表 ['002943.SZA', '000611.SZA']
      2019-10-09 固定天数卖出列表 ['601828.SHA', '002651.SZA', '603399.SHA']
      2019-10-10 固定天数卖出列表 ['300601.SZA', '300253.SZA', '300451.SZA']
      2019-10-11 固定天数卖出列表 ['603029.SHA', '300321.SZA']
      2019-10-14 固定天数卖出列表 ['002290.SZA', '002715.SZA', '603286.SHA']
      日期: 2019-10-15 股票: ['300388.SZA'] 出现跟踪止损状况
      2019-10-15 固定天数卖出列表 ['603813.SHA', '300388.SZA', '002086.SZA']
      2019-10-17 固定天数卖出列表 ['300019.SZA', '000810.SZA', '002290.SZA']
      日期: 2019-10-18 股票: ['603029.SHA'] 出现跟踪止损状况
      2019-10-18 固定天数卖出列表 ['600107.SHA', '603029.SHA', '000007.SZA']
      2019-10-22 固定天数卖出列表 ['002892.SZA', '600767.SHA', '603726.SHA']
      日期: 2019-10-23 股票: ['300007.SZA'] 出现跟踪止损状况
      2019-10-23 固定天数卖出列表 ['002728.SZA', '603022.SHA', '300007.SZA']
      2019-10-25 固定天数卖出列表 ['300006.SZA', '600529.SHA', '002276.SZA']
      日期: 2019-10-28 股票: ['600319.SHA', '002563.SZA'] 出现跟踪止损状况
      2019-10-28 固定天数卖出列表 ['600319.SHA', '300650.SZA', '002563.SZA']
      日期: 2019-10-30 股票: ['603739.SHA'] 出现跟踪止损状况
      2019-10-30 固定天数卖出列表 ['603739.SHA', '600817.SHA', '600301.SHA']
      日期: 2019-10-31 股票: ['002368.SZA', '300295.SZA'] 出现跟踪止损状况
      2019-10-31 固定天数卖出列表 ['603608.SHA', '002368.SZA', '300295.SZA']
      日期: 2019-11-04 股票: ['002735.SZA', '300562.SZA'] 出现跟踪止损状况
      2019-11-04 固定天数卖出列表 ['002735.SZA', '300562.SZA', '603823.SHA']
      日期: 2019-11-05 股票: ['002143.SZA'] 出现跟踪止损状况
      2019-11-05 固定天数卖出列表 ['002143.SZA', '600892.SHA', '603088.SHA']
      2019-11-06 尾盘涨停取消卖单 002143.SZA
      2019-11-06 固定天数卖出列表 ['002143.SZA']
      2019-11-07 固定天数卖出列表 ['002799.SZA', '002112.SZA']
      日期: 2019-11-08 股票: ['002716.SZA'] 出现跟踪止损状况
      2019-11-08 固定天数卖出列表 ['002716.SZA', '002865.SZA']
      日期: 2019-11-11 股票: ['002716.SZA', '002680.SZA', '002850.SZA'] 出现跟踪止损状况
      2019-11-11 固定天数卖出列表 ['002716.SZA', '002680.SZA', '002850.SZA', '603035.SHA']
      2019-11-12 固定天数卖出列表 ['300155.SZA', '603608.SHA', '300693.SZA']
      2019-11-14 固定天数卖出列表 ['300168.SZA', '300529.SZA', '300315.SZA']
      2019-11-15 固定天数卖出列表 ['300277.SZA', '002716.SZA', '600176.SHA']
      2019-11-19 固定天数卖出列表 ['002501.SZA', '603992.SHA', '603788.SHA']
      日期: 2019-11-20 股票: ['002892.SZA'] 出现跟踪止损状况
      2019-11-20 固定天数卖出列表 ['002892.SZA', '601231.SHA', '600722.SHA']
      日期: 2019-11-22 股票: ['603790.SHA'] 出现跟踪止损状况
      2019-11-22 固定天数卖出列表 ['603790.SHA', '603226.SHA', '002756.SZA']
      日期: 2019-11-25 股票: ['603226.SHA', '002957.SZA', '600114.SHA', '603318.SHA'] 出现跟踪止损状况
      2019-11-25 固定天数卖出列表 ['603226.SHA', '002957.SZA', '600114.SHA', '603318.SHA']
      日期: 2019-11-26 股票: ['603226.SHA'] 出现跟踪止损状况
      2019-11-26 固定天数卖出列表 ['603226.SHA']
      日期: 2019-11-27 股票: ['300397.SZA'] 出现跟踪止损状况
      2019-11-27 固定天数卖出列表 ['300397.SZA', '600358.SHA', '300277.SZA']
      2019-11-28 尾盘涨停取消卖单 300277.SZA
      2019-11-28 固定天数卖出列表 ['300277.SZA', '002145.SZA', '300221.SZA', '002212.SZA']
      2019-11-29 尾盘涨停取消卖单 300221.SZA
      2019-11-29 固定天数卖出列表 ['300221.SZA', '600227.SHA', '600408.SHA', '603787.SHA']
      日期: 2019-12-02 股票: ['002483.SZA'] 出现跟踪止损状况
      2019-12-02 固定天数卖出列表 ['000663.SZA', '002483.SZA', '603633.SHA']
      2019-12-03 固定天数卖出列表 ['603685.SHA', '601872.SHA', '600507.SHA']
      日期: 2019-12-04 股票: ['000981.SZA'] 出现跟踪止损状况
      2019-12-04 固定天数卖出列表 ['000981.SZA', '002259.SZA', '002890.SZA']
      2019-12-05 固定天数卖出列表 ['300370.SZA']
      2019-12-06 固定天数卖出列表 ['000611.SZA', '600385.SHA', '603226.SHA']
      2019-12-09 固定天数卖出列表 ['000561.SZA', '600319.SHA', '601899.SHA']
      2019-12-10 固定天数卖出列表 ['600791.SHA', '002021.SZA', '600634.SHA']
      日期: 2019-12-11 股票: ['002021.SZA', '002489.SZA'] 出现跟踪止损状况
      2019-12-11 固定天数卖出列表 ['002021.SZA', '603088.SHA', '002489.SZA']
      2019-12-12 固定天数卖出列表 ['600275.SHA', '600319.SHA', '000502.SZA']
      2019-12-13 固定天数卖出列表 ['600891.SHA', '600634.SHA', '002196.SZA']
      日期: 2019-12-16 股票: ['300063.SZA'] 出现跟踪止损状况
      2019-12-16 固定天数卖出列表 ['603179.SHA', '300063.SZA', '603103.SHA']
      2019-12-17 固定天数卖出列表 ['600112.SHA', '600275.SHA', '300680.SZA']
      2019-12-18 固定天数卖出列表 ['000752.SZA', '002205.SZA', '600634.SHA']
      2019-12-19 尾盘涨停取消卖单 000752.SZA
      2019-12-19 尾盘涨停取消卖单 600634.SHA
      2019-12-19 固定天数卖出列表 ['000752.SZA', '600634.SHA', '300106.SZA', '603286.SHA']
      2019-12-20 尾盘涨停取消卖单 000752.SZA
      2019-12-20 尾盘涨停取消卖单 600634.SHA
      2019-12-20 固定天数卖出列表 ['000752.SZA', '600634.SHA', '600099.SHA', '300535.SZA', '600883.SHA']
      2019-12-23 尾盘涨停取消卖单 000752.SZA
      2019-12-23 尾盘涨停取消卖单 600634.SHA
      日期: 2019-12-23 股票: ['600889.SHA', '000502.SZA'] 出现跟踪止损状况
      2019-12-23 固定天数卖出列表 ['000752.SZA', '600634.SHA', '600889.SHA', '000502.SZA', '000611.SZA']
      2019-12-24 尾盘涨停取消卖单 000752.SZA
      2019-12-24 尾盘涨停取消卖单 600634.SHA
      2019-12-24 固定天数卖出列表 ['000752.SZA', '600634.SHA', '300656.SZA', '300582.SZA', '603890.SHA']
      日期: 2019-12-25 股票: ['000752.SZA', '600634.SHA'] 出现跟踪止损状况
      2019-12-25 固定天数卖出列表 ['000752.SZA', '600634.SHA', '300758.SZA', '300556.SZA', '002622.SZA']
      2019-12-26 固定天数卖出列表 ['600156.SHA']
      2019-12-27 固定天数卖出列表 ['300106.SZA', '002921.SZA', '300535.SZA']
      日期: 2019-12-30 股票: ['002205.SZA', '600240.SHA', '300736.SZA'] 出现跟踪止损状况
      2019-12-30 固定天数卖出列表 ['002205.SZA', '600240.SHA', '300736.SZA']
      
      • 收益率-38.29%
      • 年化收益率-22.1%
      • 基准收益率1.63%
      • 阿尔法-0.22
      • 贝塔0.72
      • 夏普比率-0.66
      • 胜率0.49
      • 盈亏比0.94
      • 收益波动率33.7%
      • 信息比率-0.05
      • 最大回撤50.55%
      bigcharts-data-start/{"__type":"tabs","__id":"bigchart-7527d4733d414f689d2b264d4343bdba"}/bigcharts-data-end

      (suhanxue) #4

      谢谢老师