{"Description":"实验创建于2017/8/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-250:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"}],"ModuleNodes":[{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2019-01-03","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2021-01-27","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"000333.SZA","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":"-250","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 context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n # 最低底仓\n context.min_amount = 500\n # 每次交易股数\n context.per_order_amount = 1000\n # 建仓标志\n context.first_order_flag = True\n # 今日已发单标志\n context.today_order_flag = False\n # 已发买单标志\n context.buy_flag = False\n # 已发卖单标志\n context.sell_flag = False\n # 通道上轨、下轨\n context.up_track, context.down_track = 0.0, 0.0\n ","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n if context.first_order_flag:\n print(\"建立底仓\")\n # 第一天买入, 设置底仓\n context.order(context.symbol(\"000333.SZA\"), 2000)\n context.last_order_price = data.current(context.symbol(\"000333.SZA\"), \"close\")\n context.first_order_flag = False\n return\n if context.trading_day_index < 1:\n # 首日除了建仓,不进行其他发单操作\n return\n \n # 当天第一根分钟行情到来时,打开交易标志位\n if data.current_dt.strftime(\"%H%M%S\") == \"093100\":\n # 计算今天交易的上轨和下轨\n sid = context.symbol(\"000333.SZA\")\n pre_close = data.history(sid, fields=\"close\", bar_count=1, frequency=\"1d\").values[0]\n context.up_track, context.down_track = pre_close * (1+0.03), pre_close * (1-0.03)\n \n context.today_order_flag = True\n context.buy_flag = False\n context.sell_flag = False\n # 产生下单信号\n sid = context.symbol(\"000333.SZA\")\n close = data.current(sid, \"close\")\n sell_signal = close > context.up_track\n buy_signal = close < context.down_track\n # 买入信号\n if buy_signal and context.today_order_flag:\n context.order(sid, context.per_order_amount)\n context.today_order_flag = False\n context.buy_flag = True\n # 卖出信号\n if sell_signal and context.today_order_flag:\n if context.portfolio.positions[sid].amount > context.min_amount:\n context.order(sid, (-1) * context.per_order_amount)\n context.today_order_flag = False\n context.sell_flag = True\n \n # 收盘时卖出或买入平仓\n if data.current_dt.strftime(\"%H%M%S\") == \"145900\" and context.buy_flag:\n context.order(sid, (-1) * context.per_order_amount)\n if data.current_dt.strftime(\"%H%M%S\") == \"145900\" and context.sell_flag:\n context.order(sid, context.per_order_amount)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass\n","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":"close","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":"100000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"minute","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":"000300.SHA","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-250"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-250"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-250"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-250"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-250"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-250","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":19,"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='348,233,200,200'/><NodePosition Node='-250' Position='309,420,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}
[2021-01-28 16:16:03.803760] INFO: moduleinvoker: instruments.v2 开始运行..
[2021-01-28 16:16:03.816834] INFO: moduleinvoker: 命中缓存
[2021-01-28 16:16:03.818485] INFO: moduleinvoker: instruments.v2 运行完成[0.014741s].
[2021-01-28 16:16:03.938751] INFO: moduleinvoker: backtest.v8 开始运行..
[2021-01-28 16:16:03.952753] INFO: moduleinvoker: 命中缓存
[2021-01-28 16:16:05.363647] INFO: moduleinvoker: backtest.v8 运行完成[1.424927s].
[2021-01-28 16:16:05.364936] INFO: moduleinvoker: trade.v4 运行完成[1.538938s].
- 收益率79.8%
- 年化收益率34.09%
- 基准收益率86.16%
- 阿尔法0.11
- 贝塔0.57
- 夏普比率1.61
- 胜率0.86
- 盈亏比4.82
- 收益波动率17.32%
- 信息比率-0.01
- 最大回撤10.6%
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-6c001348781845c890c48e78601c879c"}/bigcharts-data-end