{"Description":"实验创建于2019/4/24","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-64:input_ds","SourceOutputPortId":"-6:data"},{"DestinationInputPortId":"-6:instruments","SourceOutputPortId":"-21:data"},{"DestinationInputPortId":"-43:instruments","SourceOutputPortId":"-21:data"},{"DestinationInputPortId":"-43:options_data","SourceOutputPortId":"-30:data"},{"DestinationInputPortId":"-6:features","SourceOutputPortId":"-35:data"},{"DestinationInputPortId":"-30:input_data","SourceOutputPortId":"-64:data_1"}],"ModuleNodes":[{"Id":"-6","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":90,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-6"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-6"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-6","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-21","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2015-01-01","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2019-04-23","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":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-21"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-21","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-30","ModuleId":"BigQuantSpace.filter.filter-v3","ModuleParameters":[{"Name":"expr","Value":"pb_lf_0 < 1.5 & pe_ttm_0 < 15 & amount_0 > 0 & pb_lf_0 > 0 & pe_ttm_0 > 0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_left_data","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-30"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-30","OutputType":null},{"Name":"left_data","NodeId":"-30","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-35","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"pb_lf_0\npe_ttm_0\namount_0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-35"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-35","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-43","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n \n # 1. 按每个K线递增,记录策略运行天数\n context.extension['index'] += 1\n \n # 2. 每隔22个交易日进行换仓\n if context.extension['index'] % context.rebalance_days != 1:\n return \n \n # 3. 买入股票列表\n stock_to_buy = context.daily_stock_buy.ix[ata.current_dt.strftime('%Y-%m-%d')]\n \n # 4. 当前持仓列表 \n stock_hold_now = [equity.symbol for equity in context.portfolio.positions]\n\n # 5. 卖出股票列表 \n stock_to_sell = [i for i in stock_hold_now if i not in no_need_to_sell]\n \n # 6. 执行卖出\n for stock in stock_to_sell:\n if data.can_trade(context.symbol(stock)):\n context.order_target_percent(context.symbol(stock), 0)\n \n # 7. 执行买入\n if len(stock_to_buy)>0: \n weight = 1 / len(stock_to_buy) # 等权重\n for instrument in stock_to_buy:\n if data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument), weight)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n # 加载股票指标数据,数据继承自m4模块\n context.indicator_data = context.options['data'].read_df()\n\n # 设置股票数量\n context.stock_num = 30\n \n def open_pos_con(df):\n return list(df.instrument)[:context.stock_num]\n \n # 计算每日股票买入列表\n context.daily_stock_buy = context.indicator_data.groupby('date').apply(open_pos_con)\n \n # 调仓天数,22个交易日大概就是一个月。可以理解为一个月换仓一次\n context.rebalance_days = 22\n \n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"initialize","Value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n \n # 设置交易费用,买入是万三,卖出是千分之1.3,如果不足5元按5元算\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n \n # 如果策略运行中,需要将数据(比如运行天数)进行保存,可以借用extension这个对象,类型为dict\n if 'index' not in context.extension:\n context.extension['index'] = 0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"","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":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":1000000,"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":"-43"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-43"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-43"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-43"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-43"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-43","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-64","ModuleId":"BigQuantSpace.sort.sort-v4","ModuleParameters":[{"Name":"sort_by","Value":"pe_ttm_0,pb_lf_0","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":"-64"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"sort_by_ds","NodeId":"-64"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-64","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"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='-6' Position='197.74703979492188,108.72286987304688,200,200'/><NodePosition Node='-21' Position='7.024139404296875,22.698776245117188,200,200'/><NodePosition Node='-30' Position='202.10845947265625,251.40960693359375,200,200'/><NodePosition Node='-35' Position='329.6506652832031,19.144546508789062,200,200'/><NodePosition Node='-43' Position='118.91571044921875,334.2048034667969,200,200'/><NodePosition Node='-64' Position='197.65066528320312,177.7108154296875,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}
[2019-06-20 18:07:05.191215] INFO: bigquant: instruments.v2 开始运行..
[2019-06-20 18:07:05.276608] INFO: bigquant: 命中缓存
[2019-06-20 18:07:05.279447] INFO: bigquant: instruments.v2 运行完成[0.088224s].
[2019-06-20 18:07:05.283478] INFO: bigquant: input_features.v1 开始运行..
[2019-06-20 18:07:05.350128] INFO: bigquant: 命中缓存
[2019-06-20 18:07:05.354298] INFO: bigquant: input_features.v1 运行完成[0.070815s].
[2019-06-20 18:07:05.424673] INFO: bigquant: general_feature_extractor.v7 开始运行..
[2019-06-20 18:07:05.465420] INFO: bigquant: 命中缓存
[2019-06-20 18:07:05.467822] INFO: bigquant: general_feature_extractor.v7 运行完成[0.04315s].
[2019-06-20 18:07:05.472003] INFO: bigquant: sort.v4 开始运行..
[2019-06-20 18:07:05.542157] INFO: bigquant: 命中缓存
[2019-06-20 18:07:05.545135] INFO: bigquant: sort.v4 运行完成[0.073118s].
[2019-06-20 18:07:05.548176] INFO: bigquant: filter.v3 开始运行..
[2019-06-20 18:07:05.593775] INFO: bigquant: 命中缓存
[2019-06-20 18:07:05.596427] INFO: bigquant: filter.v3 运行完成[0.048231s].
[2019-06-20 18:07:05.641391] INFO: bigquant: backtest.v8 开始运行..
[2019-06-20 18:07:05.644802] INFO: bigquant: biglearning backtest:V8.2.2
[2019-06-20 18:07:05.835508] INFO: bigquant: product_type:stock by specified
[2019-06-20 18:07:06.119993] INFO: bigquant: cached.v2 开始运行..
[2019-06-20 18:07:06.182658] INFO: bigquant: 命中缓存
[2019-06-20 18:07:06.184680] INFO: bigquant: cached.v2 运行完成[0.064692s].
[2019-06-20 18:07:29.168738] INFO: algo: TradingAlgorithm V1.5.0
[2019-06-20 18:07:33.090069] INFO: algo: trading transform...
[2019-06-20 18:07:44.373614] INFO: Performance: Simulated 1049 trading days out of 1049.
[2019-06-20 18:07:44.378842] INFO: Performance: first open: 2015-01-05 09:30:00+00:00
[2019-06-20 18:07:44.380780] INFO: Performance: last close: 2019-04-23 15:00:00+00:00
[2019-06-20 18:07:52.685702] INFO: bigquant: backtest.v8 运行完成[47.044302s].
- 收益率86.33%
- 年化收益率16.13%
- 基准收益率13.73%
- 阿尔法0.12
- 贝塔0.84
- 夏普比率0.6
- 胜率0.45
- 盈亏比2.44
- 收益波动率25.28%
- 信息比率0.05
- 最大回撤30.73%
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-5f61ccbd3ede4c17bafaa4c9263c96b1"}/bigcharts-data-end