复制链接
克隆策略

    {"description":"实验创建于2018/6/27","graph":{"edges":[{"to_node_id":"-353:instruments","from_node_id":"-51:data"},{"to_node_id":"-370:instruments","from_node_id":"-51:data"},{"to_node_id":"-353:features","from_node_id":"-59:data"},{"to_node_id":"-360:features","from_node_id":"-59:data"},{"to_node_id":"-1372:input_1","from_node_id":"-353:data"},{"to_node_id":"-865:input_data","from_node_id":"-360:data"},{"to_node_id":"-531:input_data","from_node_id":"-390:sorted_data"},{"to_node_id":"-370:options_data","from_node_id":"-531:data"},{"to_node_id":"-93:input_data","from_node_id":"-865:data"},{"to_node_id":"-390:input_ds","from_node_id":"-93:data"},{"to_node_id":"-443:input_data","from_node_id":"-220:data"},{"to_node_id":"-220:instruments","from_node_id":"-226:data"},{"to_node_id":"-220:features","from_node_id":"-234:data"},{"to_node_id":"-443:features","from_node_id":"-234:data"},{"to_node_id":"-2883:input_1","from_node_id":"-443:data"},{"to_node_id":"-360:input_data","from_node_id":"-1372:data"},{"to_node_id":"-2883:input_2","from_node_id":"-2864:data"},{"to_node_id":"-2864:instruments","from_node_id":"-2870:data"},{"to_node_id":"-2864:features","from_node_id":"-2878:data"},{"to_node_id":"-1372:input_2","from_node_id":"-2883:data"}],"nodes":[{"node_id":"-51","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-12-31","type":"Literal","bound_global_parameter":"交易日期"},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-51"}],"output_ports":[{"name":"data","node_id":"-51"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-59","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"amount_zf=amount_0/amount_1\nzhangf=(close_0-open_0)/close_1\nzhangf_max=max((close_0-open_0)/open_0,(close_0-close_1)/close_1)\n\npriceHighBl10=close_0/ts_max(close_0,10)\npriceLowBl10=close_0/ts_min(close_0,10)\n\npriceHighBl30=close_0/ts_max(close_0,30)\npriceLowBl30=close_0/ts_min(close_0,30)\n\nhpbl10=ts_max(close_0,10)/ts_min(close_0,10)\n\nisZhangtToday=where((return_0>1.09)&(close_0==high_0),1,0)\n\nzt_num=group_sum(date, isZhangtToday)\nzt_shouyi=where(shift(isZhangtToday,1)==1,return_0,0)\nmean_ztShouyi=group_sum(date, zt_shouyi)/shift(zt_num,1)\n\n#低位开始启动拉升策略\nmy1=where((zs_return_0>1)&(zs_return_1<1)&(zs_open<1.0025)&(shift(priceLowBl10,1)==1)&(return_1>0.96)&(abs(open_0/close_1-1.03)<0.01)&(zhangf>0)&(amount_zf<2)&(priceLowBl30<1.08),1,0)\n#涨停后调整2天布局再次拉升策略\nmy2=where((shift(zt_num,2)<=90)&(shift(mean_ztShouyi,1)>1)&(zs_return_0<1.005)&(shift(hpbl10,3)<1.1)&(ts_max(return_3,120)>1.2)&(shift(isZhangtToday,2)==1)&(ts_max(high_0,2)/close_0>1.05)&(priceLowBl10<1.2)&(abs(close_0/close_2-1)<0.02)&(zhangf>0),1,0)\n\n\n#按策略优质度排序\nyzd1=where(my1==1,10,0)\nyzd2=where(my2==1,8,0)\nyzd=yzd1+yzd2\n\nmy=max(my1,my2)\nbuy_condition=where(my==1,1,0)\nsell_condition=where(my==3,1,0)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-59"}],"output_ports":[{"name":"data","node_id":"-59"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"-353","module_id":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":"180","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-353"},{"name":"features","node_id":"-353"}],"output_ports":[{"name":"data","node_id":"-353"}],"cacheable":false,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-360","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"False","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"True","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-360"},{"name":"features","node_id":"-360"}],"output_ports":[{"name":"data","node_id":"-360"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-370","module_id":"BigQuantSpace.trade.trade-v4","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"initialize","value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n #context.set_commission(PerOrder(buy_cost=0.00001, sell_cost=0.0001, min_cost=1))\n \n # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只\n context.stock_count = 1\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.stock_weights = 1/context.stock_count\n # 设置每只股票占用的最大资金比例\n context.max_cash_per_instrument = 1\n context.options['hold_days'] = 1\n\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n today = data.current_dt.strftime('%Y-%m-%d')\n equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}\n stock_now = len(equities); #获取当前持仓股票数量\n stock_count = context.stock_count\n \n # 按日期过滤得到今日的预测数据\n # 加载预测数据\n df = context.options['data'].read_df()\n df_today = df[df.date == data.current_dt.strftime('%Y-%m-%d')]\n df_today.set_index('instrument')\n \n \n now_stock = []\n sell_stock = []\n \n try:\n buy_list = context.daily_buy_stock[today]\n except:\n buy_list = []\n\n \n # 1. 资金分配\n #is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天) \n #stock_cash = context.portfolio.portfolio_value/stock_count\n #cash_avg = context.portfolio.portfolio_value\n #cash_for_buy = min(context.portfolio.cash, stock_cash)\n #cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)\n \n positions = {e.symbol: p.amount * p.last_sale_price\n for e, p in context.perf_tracker.position_tracker.positions.items()}\n \n \n #if not is_staging :\n if 1==1 : \n if len(equities) > 0:\n for i in equities.keys():\n last_sale_date = equities[i].last_sale_date\t# 上次交易日期\n delta_days = data.current_dt - last_sale_date \n hold_days = delta_days.days # 持仓天数\n if hold_days >= context.options['hold_days'] and i not in buy_list :\n print('日期:',today,'卖出2:',i)\n context.order_target(context.symbol(i), 0)\n sell_stock.append(i)\n stock_now = stock_now -1\n #print('日期:', today, '股票:', i, ' 卖出')\n \n# 3. 生成买入订单\n buy_num = stock_count - stock_now\n #if is_staging :\n # buy_num = 1\n if len(buy_list)>0:\n print('日期:', today, '选出股票数量:', len(buy_list))\n if buy_num>0 and len(buy_list)>0 :\n # 不再买入已经轮仓卖出和移动止损的股票,以防止出现空头持仓\n buy_instruments = [i for i in buy_list if i not in now_stock][:buy_num]\n cash_for_buy = context.portfolio.cash/len(buy_instruments)\n for i, instrument in enumerate(buy_instruments):\n current_price = data.current(context.symbol(instrument), 'price')\n \n if cash_for_buy>0 and data.can_trade(context.symbol(instrument)): \n amount = math.floor(cash_for_buy / current_price / 100) * 100\n context.order(context.symbol(instrument), amount)\n #if(instrument=='002735.SZA'):\n print('日期:',today,'买入:',instrument)\n else :\n print('日期:',today,'无资金或不能交易未买入:',instrument)","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n # 加载预测数据\n df = context.options['data'].read_df()\n # 函数:求满足开仓条件的股票列表\n def open_pos_con(df):\n return list(df[df['buy_condition']>0].instrument)\n # 函数:求满足平仓条件的股票列表\n def close_pos_con(df):\n return list(df[df['sell_condition']>0].instrument)\n \n # 每日卖出股票的数据框\n context.daily_sell_stock= df.groupby('date').apply(close_pos_con) \n # 每日买入股票的数据框\n context.daily_buy_stock= df.groupby('date').apply(open_pos_con) \n\n\n \n","type":"Literal","bound_global_parameter":null},{"name":"before_trading_start","value":"# 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":0.025,"type":"Literal","bound_global_parameter":null},{"name":"order_price_field_buy","value":"open","type":"Literal","bound_global_parameter":null},{"name":"order_price_field_sell","value":"close","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":"100000","type":"Literal","bound_global_parameter":null},{"name":"auto_cancel_non_tradable_orders","value":"True","type":"Literal","bound_global_parameter":null},{"name":"data_frequency","value":"daily","type":"Literal","bound_global_parameter":null},{"name":"price_type","value":"后复权","type":"Literal","bound_global_parameter":null},{"name":"product_type","value":"股票","type":"Literal","bound_global_parameter":null},{"name":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-370"},{"name":"options_data","node_id":"-370"},{"name":"history_ds","node_id":"-370"},{"name":"benchmark_ds","node_id":"-370"},{"name":"trading_calendar","node_id":"-370"}],"output_ports":[{"name":"raw_perf","node_id":"-370"}],"cacheable":false,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-390","module_id":"BigQuantSpace.sort.sort-v4","parameters":[{"name":"sort_by","value":"yzd","type":"Literal","bound_global_parameter":null},{"name":"group_by","value":"date","type":"Literal","bound_global_parameter":null},{"name":"keep_columns","value":"--","type":"Literal","bound_global_parameter":null},{"name":"ascending","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_ds","node_id":"-390"},{"name":"sort_by_ds","node_id":"-390"}],"output_ports":[{"name":"sorted_data","node_id":"-390"}],"cacheable":true,"seq_num":9,"comment":"","comment_collapsed":true},{"node_id":"-531","module_id":"BigQuantSpace.filter.filter-v3","parameters":[{"name":"expr","value":"my==1","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-531"}],"output_ports":[{"name":"data","node_id":"-531"},{"name":"left_data","node_id":"-531"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"-865","module_id":"BigQuantSpace.chinaa_stock_filter.chinaa_stock_filter-v1","parameters":[{"name":"index_constituent_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%8150%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%8150%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B2%AA%E6%B7%B1300%22%2C%22displayValue%22%3A%22%E6%B2%AA%E6%B7%B1300%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81500%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81500%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81800%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81800%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%81180%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%81180%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%AD%E8%AF%81100%22%2C%22displayValue%22%3A%22%E4%B8%AD%E8%AF%81100%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B7%B1%E8%AF%81100%22%2C%22displayValue%22%3A%22%E6%B7%B1%E8%AF%81100%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"board_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%B8%8A%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22displayValue%22%3A%22%E4%B8%8A%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E6%B7%B1%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22displayValue%22%3A%22%E6%B7%B1%E8%AF%81%E4%B8%BB%E6%9D%BF%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E5%88%9B%E4%B8%9A%E6%9D%BF%22%2C%22displayValue%22%3A%22%E5%88%9B%E4%B8%9A%E6%9D%BF%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%A7%91%E5%88%9B%E6%9D%BF%22%2C%22displayValue%22%3A%22%E7%A7%91%E5%88%9B%E6%9D%BF%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"industry_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22%E4%BA%A4%E9%80%9A%E8%BF%90%E8%BE%93%22%2C%22displayValue%22%3A%22%E4%BA%A4%E9%80%9A%E8%BF%90%E8%BE%93%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%BC%91%E9%97%B2%E6%9C%8D%E5%8A%A1%22%2C%22displayValue%22%3A%22%E4%BC%91%E9%97%B2%E6%9C%8D%E5%8A%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E4%BC%A0%E5%AA%92%2F%E4%BF%A1%E6%81%AF%E6%9C%8D%E5%8A%A1%22%2C%22displayValue%22%3A%22%E4%BC%A0%E5%AA%92%2F%E4%BF%A1%E6%81%AF%E6%9C%8D%E5%8A%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%85%AC%E7%94%A8%E4%BA%8B%E4%B8%9A%22%2C%22displayValue%22%3A%22%E5%85%AC%E7%94%A8%E4%BA%8B%E4%B8%9A%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%86%9C%E6%9E%97%E7%89%A7%E6%B8%94%22%2C%22displayValue%22%3A%22%E5%86%9C%E6%9E%97%E7%89%A7%E6%B8%94%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%8C%96%E5%B7%A5%22%2C%22displayValue%22%3A%22%E5%8C%96%E5%B7%A5%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%8C%BB%E8%8D%AF%E7%94%9F%E7%89%A9%22%2C%22displayValue%22%3A%22%E5%8C%BB%E8%8D%AF%E7%94%9F%E7%89%A9%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%95%86%E4%B8%9A%E8%B4%B8%E6%98%93%22%2C%22displayValue%22%3A%22%E5%95%86%E4%B8%9A%E8%B4%B8%E6%98%93%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%9B%BD%E9%98%B2%E5%86%9B%E5%B7%A5%22%2C%22displayValue%22%3A%22%E5%9B%BD%E9%98%B2%E5%86%9B%E5%B7%A5%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%AE%B6%E7%94%A8%E7%94%B5%E5%99%A8%22%2C%22displayValue%22%3A%22%E5%AE%B6%E7%94%A8%E7%94%B5%E5%99%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%BB%BA%E7%AD%91%E6%9D%90%E6%96%99%2F%E5%BB%BA%E7%AD%91%E5%BB%BA%E6%9D%90%22%2C%22displayValue%22%3A%22%E5%BB%BA%E7%AD%91%E6%9D%90%E6%96%99%2F%E5%BB%BA%E7%AD%91%E5%BB%BA%E6%9D%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E5%BB%BA%E7%AD%91%E8%A3%85%E9%A5%B0%22%2C%22displayValue%22%3A%22%E5%BB%BA%E7%AD%91%E8%A3%85%E9%A5%B0%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%88%BF%E5%9C%B0%E4%BA%A7%22%2C%22displayValue%22%3A%22%E6%88%BF%E5%9C%B0%E4%BA%A7%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9C%89%E8%89%B2%E9%87%91%E5%B1%9E%22%2C%22displayValue%22%3A%22%E6%9C%89%E8%89%B2%E9%87%91%E5%B1%9E%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9C%BA%E6%A2%B0%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E6%9C%BA%E6%A2%B0%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%B1%BD%E8%BD%A6%2F%E4%BA%A4%E8%BF%90%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E6%B1%BD%E8%BD%A6%2F%E4%BA%A4%E8%BF%90%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%94%B5%E5%AD%90%22%2C%22displayValue%22%3A%22%E7%94%B5%E5%AD%90%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%94%B5%E6%B0%94%E8%AE%BE%E5%A4%87%22%2C%22displayValue%22%3A%22%E7%94%B5%E6%B0%94%E8%AE%BE%E5%A4%87%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%BA%BA%E7%BB%87%E6%9C%8D%E8%A3%85%22%2C%22displayValue%22%3A%22%E7%BA%BA%E7%BB%87%E6%9C%8D%E8%A3%85%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E7%BB%BC%E5%90%88%22%2C%22displayValue%22%3A%22%E7%BB%BC%E5%90%88%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%AE%A1%E7%AE%97%E6%9C%BA%22%2C%22displayValue%22%3A%22%E8%AE%A1%E7%AE%97%E6%9C%BA%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E8%BD%BB%E5%B7%A5%E5%88%B6%E9%80%A0%22%2C%22displayValue%22%3A%22%E8%BD%BB%E5%B7%A5%E5%88%B6%E9%80%A0%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%80%9A%E4%BF%A1%22%2C%22displayValue%22%3A%22%E9%80%9A%E4%BF%A1%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%87%87%E6%8E%98%22%2C%22displayValue%22%3A%22%E9%87%87%E6%8E%98%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%92%A2%E9%93%81%22%2C%22displayValue%22%3A%22%E9%92%A2%E9%93%81%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%93%B6%E8%A1%8C%22%2C%22displayValue%22%3A%22%E9%93%B6%E8%A1%8C%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%9D%9E%E9%93%B6%E9%87%91%E8%9E%8D%22%2C%22displayValue%22%3A%22%E9%9D%9E%E9%93%B6%E9%87%91%E8%9E%8D%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%A3%9F%E5%93%81%E9%A5%AE%E6%96%99%22%2C%22displayValue%22%3A%22%E9%A3%9F%E5%93%81%E9%A5%AE%E6%96%99%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"st_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%AD%A3%E5%B8%B8%22%2C%22displayValue%22%3A%22%E6%AD%A3%E5%B8%B8%22%2C%22selected%22%3Atrue%7D%2C%7B%22value%22%3A%22ST%22%2C%22displayValue%22%3A%22ST%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22*ST%22%2C%22displayValue%22%3A%22*ST%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E6%9A%82%E5%81%9C%E4%B8%8A%E5%B8%82%22%2C%22displayValue%22%3A%22%E6%9A%82%E5%81%9C%E4%B8%8A%E5%B8%82%22%2C%22selected%22%3Afalse%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"delist_cond","value":"%7B%22enumItems%22%3A%5B%7B%22value%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22displayValue%22%3A%22%E5%85%A8%E9%83%A8%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%80%80%E5%B8%82%22%2C%22displayValue%22%3A%22%E9%80%80%E5%B8%82%22%2C%22selected%22%3Afalse%7D%2C%7B%22value%22%3A%22%E9%9D%9E%E9%80%80%E5%B8%82%22%2C%22displayValue%22%3A%22%E9%9D%9E%E9%80%80%E5%B8%82%22%2C%22selected%22%3Atrue%7D%5D%7D","type":"Literal","bound_global_parameter":null},{"name":"output_left_data","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-865"}],"output_ports":[{"name":"data","node_id":"-865"},{"name":"left_data","node_id":"-865"}],"cacheable":true,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-93","module_id":"BigQuantSpace.dropnan.dropnan-v2","parameters":[],"input_ports":[{"name":"input_data","node_id":"-93"},{"name":"features","node_id":"-93"}],"output_ports":[{"name":"data","node_id":"-93"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-220","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_index_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-220"},{"name":"features","node_id":"-220"}],"output_ports":[{"name":"data","node_id":"-220"}],"cacheable":true,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-226","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2010-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2050-12-30","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000002.HIX","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-226"}],"output_ports":[{"name":"data","node_id":"-226"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-234","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nzs_zhangf=(close-open)/open\nzs_huiluo=(high-close)/close\nzs_huishen=(close-low)/low\nzs_zhenf=(high-low)/shift(close,1)\nzs_volume_zf=volume/shift(volume,1)\nzs_return_0=close/shift(close,1)\nzs_return_1=shift(zs_return_0,1)\nzs_return_2=shift(zs_return_0,2)\nzs_open=open/shift(close,1)\nzs_max10=ts_max(close,10)\n#zs_max10d=ts_argmax(close,10)\nzs_max30=ts_max(close,30)\n#zs_max30d=ts_argmax(close,30)\nzs_min10=ts_min(close,10)\n#zs_min10d=ts_argmin(close,10)\nzs_min30=ts_min(close,30)\n#zs_min30d=ts_argmin(close,30)\nzs_priceHighBl10=close/zs_max10\nzs_priceLowBl10=close/zs_min10\nzs_priceHighBl30=close/zs_max30\nzs_priceLowBl30=close/zs_min30","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-234"}],"output_ports":[{"name":"data","node_id":"-234"}],"cacheable":true,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-443","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"False","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"True","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-443"},{"name":"features","node_id":"-443"}],"output_ports":[{"name":"data","node_id":"-443"}],"cacheable":true,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-1372","module_id":"BigQuantSpace.data_join.data_join-v3","parameters":[{"name":"on","value":"date","type":"Literal","bound_global_parameter":null},{"name":"how","value":"left","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"True","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-1372"},{"name":"input_2","node_id":"-1372"}],"output_ports":[{"name":"data","node_id":"-1372"}],"cacheable":true,"seq_num":14,"comment":"","comment_collapsed":true},{"node_id":"-2864","module_id":"BigQuantSpace.use_datasource.use_datasource-v1","parameters":[{"name":"datasource_id","value":"bar1d_index_CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-2864"},{"name":"features","node_id":"-2864"}],"output_ports":[{"name":"data","node_id":"-2864"}],"cacheable":true,"seq_num":17,"comment":"","comment_collapsed":true},{"node_id":"-2870","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2020-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2020-12-30","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000002.HIX","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-2870"}],"output_ports":[{"name":"data","node_id":"-2870"}],"cacheable":true,"seq_num":18,"comment":"","comment_collapsed":true},{"node_id":"-2878","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"\n# #号开始的表示注释,注释需单独一行\n# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征\nclose\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-2878"}],"output_ports":[{"name":"data","node_id":"-2878"}],"cacheable":true,"seq_num":19,"comment":"","comment_collapsed":true},{"node_id":"-2883","module_id":"BigQuantSpace.data_join.data_join-v3","parameters":[{"name":"on","value":"date","type":"Literal","bound_global_parameter":null},{"name":"how","value":"left","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-2883"},{"name":"input_2","node_id":"-2883"}],"output_ports":[{"name":"data","node_id":"-2883"}],"cacheable":true,"seq_num":20,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-51' Position='95,-88,200,200'/><node_position Node='-59' Position='419,57,200,200'/><node_position Node='-353' Position='170,168,200,200'/><node_position Node='-360' Position='239,338,200,200'/><node_position Node='-370' Position='478,838,200,200'/><node_position Node='-390' Position='288,618,200,200'/><node_position Node='-531' Position='321,707,200,200'/><node_position Node='-865' Position='261,433,200,200'/><node_position Node='-93' Position='269,519,200,200'/><node_position Node='-220' Position='801,-38,200,200'/><node_position Node='-226' Position='664,-179,200,200'/><node_position Node='-234' Position='1055,-184,200,200'/><node_position Node='-443' Position='806,119,200,200'/><node_position Node='-1372' Position='767,307,200,200'/><node_position Node='-2864' Position='1274,117,200,200'/><node_position Node='-2870' Position='1137,-23,200,200'/><node_position Node='-2878' Position='1528,-25,200,200'/><node_position Node='-2883' Position='1032,212,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [1]:
    # 本代码由可视化策略环境自动生成 2022年3月25日 10:20
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # 回测引擎:初始化函数,只执行一次
    def m8_initialize_bigquant_run(context):
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        #context.set_commission(PerOrder(buy_cost=0.00001, sell_cost=0.0001, min_cost=1))
        
        # 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
        context.stock_count = 1
        # 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
        #context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])
        # 每只股票的权重平均分配
        context.stock_weights = 1/context.stock_count
        # 设置每只股票占用的最大资金比例
        context.max_cash_per_instrument = 1
        context.options['hold_days'] = 1
    
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m8_handle_data_bigquant_run(context, data):
        today = data.current_dt.strftime('%Y-%m-%d')
        equities = {e.symbol: p for e, p in context.portfolio.positions.items() if p.amount>0}
        stock_now = len(equities); #获取当前持仓股票数量
        stock_count = context.stock_count
        
        # 按日期过滤得到今日的预测数据
        # 加载预测数据
        df = context.options['data'].read_df()
        df_today = df[df.date == data.current_dt.strftime('%Y-%m-%d')]
        df_today.set_index('instrument')
        
        
        now_stock = []
        sell_stock = []
           
        try:
            buy_list = context.daily_buy_stock[today]
        except:
            buy_list = []
    
        
        # 1. 资金分配
        #is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天) 
        #stock_cash = context.portfolio.portfolio_value/stock_count
        #cash_avg = context.portfolio.portfolio_value
        #cash_for_buy = min(context.portfolio.cash,  stock_cash)
        #cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)
        
        positions = {e.symbol: p.amount * p.last_sale_price
                     for e, p in context.perf_tracker.position_tracker.positions.items()}
        
                
        #if not is_staging :
        if 1==1 :    
            if len(equities) > 0:
                for i in equities.keys():
                    last_sale_date = equities[i].last_sale_date	# 上次交易日期
                    delta_days = data.current_dt - last_sale_date  
                    hold_days = delta_days.days # 持仓天数
                    if hold_days >= context.options['hold_days'] and i not in buy_list :
                        print('日期:',today,'卖出2:',i)
                        context.order_target(context.symbol(i), 0)
                        sell_stock.append(i)
                        stock_now = stock_now -1
                        #print('日期:', today, '股票:', i, ' 卖出')
                     
    # 3. 生成买入订单
        buy_num = stock_count - stock_now
        #if is_staging :
        #    buy_num = 1
        if len(buy_list)>0:
            print('日期:', today, '选出股票数量:', len(buy_list))
        if buy_num>0 and len(buy_list)>0 :
            # 不再买入已经轮仓卖出和移动止损的股票,以防止出现空头持仓
            buy_instruments = [i for i in buy_list if i not in now_stock][:buy_num]
            cash_for_buy = context.portfolio.cash/len(buy_instruments)
            for i, instrument in enumerate(buy_instruments):
                current_price = data.current(context.symbol(instrument), 'price')
                
                if cash_for_buy>0 and data.can_trade(context.symbol(instrument)):           
                    amount = math.floor(cash_for_buy / current_price / 100) * 100
                    context.order(context.symbol(instrument), amount)
                    #if(instrument=='002735.SZA'):
                    print('日期:',today,'买入:',instrument)
                else :
                    print('日期:',today,'无资金或不能交易未买入:',instrument)
    # 回测引擎:准备数据,只执行一次
    def m8_prepare_bigquant_run(context):
        # 加载预测数据
        df = context.options['data'].read_df()
        # 函数:求满足开仓条件的股票列表
        def open_pos_con(df):
            return list(df[df['buy_condition']>0].instrument)
        # 函数:求满足平仓条件的股票列表
        def close_pos_con(df):
            return list(df[df['sell_condition']>0].instrument)
        
        # 每日卖出股票的数据框
        context.daily_sell_stock= df.groupby('date').apply(close_pos_con)  
        # 每日买入股票的数据框
        context.daily_buy_stock= df.groupby('date').apply(open_pos_con)  
    
    
        
    
    # 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。
    def m8_before_trading_start_bigquant_run(context, data):
        pass
    
    
    m1 = M.instruments.v2(
        start_date='2021-01-01',
        end_date=T.live_run_param('trading_date', '2021-12-31'),
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.input_features.v1(
        features="""amount_zf=amount_0/amount_1
    zhangf=(close_0-open_0)/close_1
    zhangf_max=max((close_0-open_0)/open_0,(close_0-close_1)/close_1)
    
    priceHighBl10=close_0/ts_max(close_0,10)
    priceLowBl10=close_0/ts_min(close_0,10)
    
    priceHighBl30=close_0/ts_max(close_0,30)
    priceLowBl30=close_0/ts_min(close_0,30)
    
    hpbl10=ts_max(close_0,10)/ts_min(close_0,10)
    
    isZhangtToday=where((return_0>1.09)&(close_0==high_0),1,0)
    
    zt_num=group_sum(date, isZhangtToday)
    zt_shouyi=where(shift(isZhangtToday,1)==1,return_0,0)
    mean_ztShouyi=group_sum(date, zt_shouyi)/shift(zt_num,1)
    
    #低位开始启动拉升策略
    my1=where((zs_return_0>1)&(zs_return_1<1)&(zs_open<1.0025)&(shift(priceLowBl10,1)==1)&(return_1>0.96)&(abs(open_0/close_1-1.03)<0.01)&(zhangf>0)&(amount_zf<2)&(priceLowBl30<1.08),1,0)
    #涨停后调整2天布局再次拉升策略
    my2=where((shift(zt_num,2)<=90)&(shift(mean_ztShouyi,1)>1)&(zs_return_0<1.005)&(shift(hpbl10,3)<1.1)&(ts_max(return_3,120)>1.2)&(shift(isZhangtToday,2)==1)&(ts_max(high_0,2)/close_0>1.05)&(priceLowBl10<1.2)&(abs(close_0/close_2-1)<0.02)&(zhangf>0),1,0)
    
    
    #按策略优质度排序
    yzd1=where(my1==1,10,0)
    yzd2=where(my2==1,8,0)
    yzd=yzd1+yzd2
    
    my=max(my1,my2)
    buy_condition=where(my==1,1,0)
    sell_condition=where(my==3,1,0)"""
    )
    
    m5 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m2.data,
        start_date='',
        end_date='',
        before_start_days=180,
        m_cached=False
    )
    
    m10 = M.instruments.v2(
        start_date='2010-01-01',
        end_date='2050-12-30',
        market='CN_STOCK_A',
        instrument_list='000002.HIX',
        max_count=0
    )
    
    m12 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    zs_zhangf=(close-open)/open
    zs_huiluo=(high-close)/close
    zs_huishen=(close-low)/low
    zs_zhenf=(high-low)/shift(close,1)
    zs_volume_zf=volume/shift(volume,1)
    zs_return_0=close/shift(close,1)
    zs_return_1=shift(zs_return_0,1)
    zs_return_2=shift(zs_return_0,2)
    zs_open=open/shift(close,1)
    zs_max10=ts_max(close,10)
    #zs_max10d=ts_argmax(close,10)
    zs_max30=ts_max(close,30)
    #zs_max30d=ts_argmax(close,30)
    zs_min10=ts_min(close,10)
    #zs_min10d=ts_argmin(close,10)
    zs_min30=ts_min(close,30)
    #zs_min30d=ts_argmin(close,30)
    zs_priceHighBl10=close/zs_max10
    zs_priceLowBl10=close/zs_min10
    zs_priceHighBl30=close/zs_max30
    zs_priceLowBl30=close/zs_min30"""
    )
    
    m4 = M.use_datasource.v1(
        instruments=m10.data,
        features=m12.data,
        datasource_id='bar1d_index_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m13 = M.derived_feature_extractor.v3(
        input_data=m4.data,
        features=m12.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=True,
        user_functions={}
    )
    
    m18 = M.instruments.v2(
        start_date='2020-01-01',
        end_date='2020-12-30',
        market='CN_STOCK_A',
        instrument_list='000002.HIX',
        max_count=0
    )
    
    m19 = M.input_features.v1(
        features="""
    # #号开始的表示注释,注释需单独一行
    # 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
    close
    """
    )
    
    m17 = M.use_datasource.v1(
        instruments=m18.data,
        features=m19.data,
        datasource_id='bar1d_index_CN_STOCK_A',
        start_date='',
        end_date=''
    )
    
    m20 = M.data_join.v3(
        input_1=m13.data,
        input_2=m17.data,
        on='date',
        how='left',
        sort=False
    )
    
    m14 = M.data_join.v3(
        input_1=m5.data,
        input_2=m20.data,
        on='date',
        how='left',
        sort=True
    )
    
    m7 = M.derived_feature_extractor.v3(
        input_data=m14.data,
        features=m2.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=True,
        user_functions={}
    )
    
    m6 = M.chinaa_stock_filter.v1(
        input_data=m7.data,
        index_constituent_cond=['全部'],
        board_cond=['上证主板', '深证主板'],
        industry_cond=['全部'],
        st_cond=['正常'],
        delist_cond=['非退市'],
        output_left_data=False
    )
    
    m11 = M.dropnan.v2(
        input_data=m6.data
    )
    
    m9 = M.sort.v4(
        input_ds=m11.data,
        sort_by='yzd',
        group_by='date',
        keep_columns='--',
        ascending=False
    )
    
    m3 = M.filter.v3(
        input_data=m9.sorted_data,
        expr='my==1',
        output_left_data=False
    )
    
    m8 = M.trade.v4(
        instruments=m1.data,
        options_data=m3.data,
        start_date='',
        end_date='',
        initialize=m8_initialize_bigquant_run,
        handle_data=m8_handle_data_bigquant_run,
        prepare=m8_prepare_bigquant_run,
        before_trading_start=m8_before_trading_start_bigquant_run,
        volume_limit=0.025,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=100000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='后复权',
        product_type='股票',
        plot_charts=True,
        backtest_only=False,
        benchmark=''
    )
    
    日期: 2021-01-12 选出股票数量: 4
    日期: 2021-01-12 买入: 002713.SZA
    日期: 2021-01-14 卖出2: 002713.SZA
    日期: 2021-01-15 选出股票数量: 1
    日期: 2021-01-15 买入: 002922.SZA
    日期: 2021-01-19 卖出2: 002922.SZA
    日期: 2021-01-25 选出股票数量: 1
    日期: 2021-01-25 买入: 002930.SZA
    日期: 2021-01-27 卖出2: 002930.SZA
    日期: 2021-02-01 选出股票数量: 5
    日期: 2021-02-01 买入: 000501.SZA
    日期: 2021-02-03 卖出2: 000501.SZA
    日期: 2021-02-08 选出股票数量: 7
    日期: 2021-02-08 买入: 601678.SHA
    日期: 2021-02-10 卖出2: 601678.SHA
    日期: 2021-03-29 选出股票数量: 1
    日期: 2021-03-29 买入: 002674.SZA
    日期: 2021-03-31 卖出2: 002674.SZA
    日期: 2021-03-31 选出股票数量: 1
    日期: 2021-03-31 买入: 000421.SZA
    日期: 2021-04-08 选出股票数量: 1
    日期: 2021-04-08 买入: 003009.SZA
    日期: 2021-04-12 卖出2: 003009.SZA
    日期: 2021-04-13 选出股票数量: 1
    日期: 2021-04-13 买入: 603598.SHA
    日期: 2021-04-14 选出股票数量: 3
    日期: 2021-04-15 卖出2: 603598.SHA
    日期: 2021-04-15 选出股票数量: 1
    日期: 2021-04-15 买入: 002474.SZA
    日期: 2021-04-16 选出股票数量: 1
    日期: 2021-04-16 买入: 600844.SHA
    日期: 2021-04-20 卖出2: 600844.SHA
    日期: 2021-04-30 选出股票数量: 1
    日期: 2021-04-30 买入: 002989.SZA
    日期: 2021-05-07 卖出2: 002989.SZA
    日期: 2021-05-10 选出股票数量: 1
    日期: 2021-05-10 买入: 600056.SHA
    日期: 2021-05-12 卖出2: 600056.SHA
    日期: 2021-05-14 选出股票数量: 1
    日期: 2021-05-14 买入: 600176.SHA
    日期: 2021-05-18 卖出2: 600176.SHA
    日期: 2021-05-19 选出股票数量: 1
    日期: 2021-05-19 买入: 000890.SZA
    日期: 2021-05-20 选出股票数量: 2
    日期: 2021-05-21 卖出2: 000890.SZA
    日期: 2021-05-24 选出股票数量: 1
    日期: 2021-05-24 买入: 002735.SZA
    日期: 2021-05-26 卖出2: 002735.SZA
    日期: 2021-05-26 选出股票数量: 1
    日期: 2021-05-26 买入: 600559.SHA
    日期: 2021-05-27 选出股票数量: 3
    日期: 2021-05-27 买入: 601187.SHA
    日期: 2021-05-31 卖出2: 601187.SHA
    日期: 2021-06-03 选出股票数量: 1
    日期: 2021-06-03 买入: 002805.SZA
    日期: 2021-06-04 选出股票数量: 2
    日期: 2021-06-07 卖出2: 002805.SZA
    日期: 2021-06-08 选出股票数量: 1
    日期: 2021-06-08 买入: 600212.SHA
    日期: 2021-06-10 卖出2: 600212.SHA
    日期: 2021-06-17 选出股票数量: 1
    日期: 2021-06-17 买入: 002557.SZA
    日期: 2021-06-21 卖出2: 002557.SZA
    日期: 2021-06-21 选出股票数量: 2
    日期: 2021-06-21 买入: 603378.SHA
    日期: 2021-06-24 选出股票数量: 1
    日期: 2021-06-24 买入: 605099.SHA
    日期: 2021-06-28 卖出2: 605099.SHA
    日期: 2021-06-28 选出股票数量: 1
    日期: 2021-06-28 买入: 002309.SZA
    日期: 2021-06-30 卖出2: 002309.SZA
    日期: 2021-07-05 选出股票数量: 2
    日期: 2021-07-05 买入: 003030.SZA
    日期: 2021-07-07 卖出2: 003030.SZA
    日期: 2021-07-19 选出股票数量: 1
    日期: 2021-07-19 买入: 603076.SHA
    日期: 2021-07-21 卖出2: 603076.SHA
    日期: 2021-07-22 选出股票数量: 1
    日期: 2021-07-22 买入: 000711.SZA
    日期: 2021-07-26 卖出2: 000711.SZA
    日期: 2021-08-02 选出股票数量: 2
    日期: 2021-08-02 买入: 600066.SHA
    日期: 2021-08-04 卖出2: 600066.SHA
    日期: 2021-08-04 选出股票数量: 1
    日期: 2021-08-04 买入: 601666.SHA
    日期: 2021-08-06 卖出2: 601666.SHA
    日期: 2021-08-09 选出股票数量: 1
    日期: 2021-08-09 买入: 603038.SHA
    日期: 2021-08-11 卖出2: 603038.SHA
    日期: 2021-09-28 选出股票数量: 2
    日期: 2021-09-28 买入: 002430.SZA
    日期: 2021-09-30 卖出2: 002430.SZA
    日期: 2021-09-30 选出股票数量: 18
    日期: 2021-09-30 买入: 002740.SZA
    日期: 2021-10-11 卖出2: 002740.SZA
    日期: 2021-10-13 选出股票数量: 6
    日期: 2021-10-13 买入: 605020.SHA
    日期: 2021-10-14 选出股票数量: 1
    日期: 2021-10-15 卖出2: 605020.SHA
    日期: 2021-10-21 选出股票数量: 1
    日期: 2021-10-21 买入: 000656.SZA
    日期: 2021-10-25 卖出2: 000656.SZA
    日期: 2021-10-25 选出股票数量: 1
    日期: 2021-10-25 买入: 002121.SZA
    日期: 2021-10-29 选出股票数量: 9
    日期: 2021-10-29 买入: 002875.SZA
    日期: 2021-11-02 卖出2: 002875.SZA
    日期: 2021-11-04 选出股票数量: 1
    日期: 2021-11-04 买入: 003040.SZA
    日期: 2021-11-08 卖出2: 003040.SZA
    日期: 2021-11-08 选出股票数量: 3
    日期: 2021-11-08 买入: 600008.SHA
    日期: 2021-11-11 选出股票数量: 2
    日期: 2021-11-11 买入: 000959.SZA
    日期: 2021-11-15 卖出2: 000959.SZA
    日期: 2021-11-17 选出股票数量: 5
    日期: 2021-11-17 买入: 000155.SZA
    日期: 2021-11-19 卖出2: 000155.SZA
    日期: 2021-12-01 选出股票数量: 1
    日期: 2021-12-01 买入: 600236.SHA
    日期: 2021-12-02 选出股票数量: 1
    日期: 2021-12-03 卖出2: 600236.SHA
    日期: 2021-12-06 选出股票数量: 1
    日期: 2021-12-06 买入: 600381.SHA
    日期: 2021-12-08 卖出2: 600381.SHA
    日期: 2021-12-10 选出股票数量: 1
    日期: 2021-12-10 买入: 001896.SZA
    日期: 2021-12-14 卖出2: 001896.SZA
    日期: 2021-12-15 选出股票数量: 1
    日期: 2021-12-15 买入: 600444.SHA
    日期: 2021-12-17 卖出2: 600444.SHA
    日期: 2021-12-20 选出股票数量: 1
    日期: 2021-12-20 买入: 000852.SZA
    日期: 2021-12-21 选出股票数量: 3
    日期: 2021-12-22 卖出2: 000852.SZA
    日期: 2021-12-28 选出股票数量: 2
    日期: 2021-12-28 买入: 601615.SHA
    日期: 2021-12-30 卖出2: 601615.SHA
    
    • 收益率111.4%
    • 年化收益率117.35%
    • 基准收益率-5.2%
    • 阿尔法1.24
    • 贝塔0.02
    • 夏普比率2.34
    • 胜率0.62
    • 盈亏比2.11
    • 收益波动率34.39%
    • 信息比率0.14
    • 最大回撤9.65%
    bigcharts-data-start/{"__type":"tabs","__id":"bigchart-3401fa93e00b42729fbe7298a7e65c81"}/bigcharts-data-end