{"Description":"实验创建于2018/10/17","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-314:features","SourceOutputPortId":"-24:data"},{"DestinationInputPortId":"-432:input_data","SourceOutputPortId":"-314:data"},{"DestinationInputPortId":"-314:input_data","SourceOutputPortId":"-418:data_1"},{"DestinationInputPortId":"-112:options_data","SourceOutputPortId":"-432:data"},{"DestinationInputPortId":"-112:history_ds","SourceOutputPortId":"-432:data"},{"DestinationInputPortId":"-418:input_1","SourceOutputPortId":"-357:data"},{"DestinationInputPortId":"-112:instruments","SourceOutputPortId":"-357:data"}],"ModuleNodes":[{"Id":"-24","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\n\nmean(close,5)\nmean(close,10)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-24","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"定义指标","CommentCollapsed":false},{"Id":"-314","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":"-314"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-314"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-314","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-418","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, start_date,end_date):\n # 示例代码如下。在这里编写您的代码\n ins=input_1.read_pickle()['instruments']\n start_date=input_1.read_pickle()['start_date']\n end_date=input_1.read_pickle()['end_date']\n df=DataSource('bar1d_CN_FUND').read(ins,start_date=start_date,end_date=end_date)\n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"post_run","Value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"input_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{'start':'2018-08-29'}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-418"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-418"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-418"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-418","OutputType":null},{"Name":"data_2","NodeId":"-418","OutputType":null},{"Name":"data_3","NodeId":"-418","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-432","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-432"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-432","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-357","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2013-01-16","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2018-01-16","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_FUND","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"510330.HOF","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-357"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-357","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-112","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"2013-01-29","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":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","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # 获取今日的日期\n today = data.current_dt.strftime('%Y-%m-%d') \n data_today=context.data[context.data['date']==today]\n sid = context.symbol(context.instruments[0]) \n price = data.current(sid, 'price')\n cash = context.portfolio.cash \n #cur_position = context.portfolio.positions[sid].amount\n\n short_avg=np.array(data_today['mean(close,5)'])[0]\n long_avg=np.array(data_today['mean(close,10)'])[0]\n \n \n if short_avg>long_avg :\n context.order(sid,int(cash/price/100)*100)\n if short_avg<long_avg :\n context.order_target_percent(sid, 0)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n # 加载预测数据\n \n df = context.options['data'].read_df()\n context.data=df\n pass","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"# 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。\ndef bigquant_run(context, data):\n pass","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":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":"-112"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-112"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-112"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-112"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-112"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-112","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":4,"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='-24' Position='504,328,200,200'/><NodePosition Node='-314' Position='388,433,200,200'/><NodePosition Node='-418' Position='150,321,200,200'/><NodePosition Node='-432' Position='388,509,200,200'/><NodePosition Node='-357' Position='-87,188,200,200'/><NodePosition Node='-112' Position='203,653,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-09-04 11:52:11.439815] INFO: bigquant: input_features.v1 开始运行..
[2019-09-04 11:52:11.545276] INFO: bigquant: input_features.v1 运行完成[0.105445s].
[2019-09-04 11:52:11.557927] INFO: bigquant: instruments.v2 开始运行..
[2019-09-04 11:52:11.601795] INFO: bigquant: 命中缓存
[2019-09-04 11:52:11.605868] INFO: bigquant: instruments.v2 运行完成[0.047918s].
[2019-09-04 11:52:11.611738] INFO: bigquant: cached.v3 开始运行..
[2019-09-04 11:52:11.670001] INFO: bigquant: 命中缓存
[2019-09-04 11:52:11.672877] INFO: bigquant: cached.v3 运行完成[0.061133s].
[2019-09-04 11:52:11.676410] INFO: bigquant: derived_feature_extractor.v3 开始运行..
[2019-09-04 11:52:11.807049] INFO: derived_feature_extractor: 提取完成 mean(close,5), 0.006s
[2019-09-04 11:52:11.820061] INFO: derived_feature_extractor: 提取完成 mean(close,10), 0.010s
[2019-09-04 11:52:11.894950] INFO: derived_feature_extractor: /data, 1218
[2019-09-04 11:52:12.037040] INFO: bigquant: derived_feature_extractor.v3 运行完成[0.360615s].
[2019-09-04 11:52:12.040540] INFO: bigquant: dropnan.v1 开始运行..
[2019-09-04 11:52:12.124737] INFO: dropnan: /data, 1209/1218
[2019-09-04 11:52:12.232249] INFO: dropnan: 行数: 1209/1218
[2019-09-04 11:52:12.237123] INFO: bigquant: dropnan.v1 运行完成[0.196572s].
[2019-09-04 11:52:12.308856] INFO: bigquant: backtest.v8 开始运行..
[2019-09-04 11:52:12.314999] INFO: bigquant: biglearning backtest:V8.2.10
[2019-09-04 11:52:12.391268] INFO: bigquant: product_type:stock by specified
[2019-09-04 11:52:12.931570] INFO: algo: TradingAlgorithm V1.5.7
[2019-09-04 11:52:13.140278] INFO: algo: trading transform...
[2019-09-04 11:52:18.623442] INFO: Performance: Simulated 1209 trading days out of 1209.
[2019-09-04 11:52:18.625440] INFO: Performance: first open: 2013-01-29 09:30:00+00:00
[2019-09-04 11:52:18.626886] INFO: Performance: last close: 2018-01-16 15:00:00+00:00
[2019-09-04 11:52:22.221260] INFO: bigquant: backtest.v8 运行完成[9.912402s].
- 收益率63.87%
- 年化收益率10.84%
- 基准收益率60.58%
- 阿尔法0.04
- 贝塔0.51
- 夏普比率0.51
- 胜率0.56
- 盈亏比1.84
- 收益波动率17.13%
- 信息比率-0.0
- 最大回撤23.84%
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-a87e0cf644aa4e8885806313f352d3ee"}/bigcharts-data-end