{"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"-209:input_1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-145:data1","from_node_id":"-189:data"},{"to_node_id":"-189:input_data","from_node_id":"-209:data_1"},{"to_node_id":"-451:input_data","from_node_id":"-209:data_1"},{"to_node_id":"-151:input_data","from_node_id":"-145:data"},{"to_node_id":"-468:training_ds","from_node_id":"-151:data"},{"to_node_id":"-145:data2","from_node_id":"-451:data"},{"to_node_id":"-451:features","from_node_id":"-459:data"},{"to_node_id":"-468:features","from_node_id":"-459:data"},{"to_node_id":"-1086:features","from_node_id":"-459:data"},{"to_node_id":"-765:model","from_node_id":"-468:model"},{"to_node_id":"-284:options_data","from_node_id":"-765:predictions"},{"to_node_id":"-781:input_1","from_node_id":"-769:data"},{"to_node_id":"-284:instruments","from_node_id":"-769:data"},{"to_node_id":"-1086:input_data","from_node_id":"-781:data_1"},{"to_node_id":"-1398:input_data","from_node_id":"-1086:data"},{"to_node_id":"-765:data","from_node_id":"-1398:data"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","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-08-30","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_FUTURE","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"P0000.DCE\nY0000.DCE\nHC0000.SHF\nRB0000.SHF\nJM0000.DCE\nI0000.DCE\nA0000.DCE\nM0000.DCE\nTA0000.CZC\nC0000.DCE","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-189","module_id":"BigQuantSpace.auto_labeler_on_datasource.auto_labeler_on_datasource-v1","parameters":[{"name":"label_expr","value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/develop/datasource/deprecated/history_data.html\n# 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/develop/bigexpr/usage.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\nshift(close, -5) / 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","type":"Literal","bound_global_parameter":null},{"name":"drop_na_label","value":"True","type":"Literal","bound_global_parameter":null},{"name":"cast_label_int","value":"True","type":"Literal","bound_global_parameter":null},{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-189"}],"output_ports":[{"name":"data","node_id":"-189"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-209","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n instruments = input_1.read()['instruments']\n start_date = input_1.read()['start_date']\n end_date = input_1.read()['end_date']\n df = DataSource('bar1m_CN_FUTURE').read(instruments=instruments,start_date=start_date,end_date=end_date)\n df60 = BarGenerator.aggregate_df(df, \"60m\"),\n df60 = df60[0]\n\n data_1 = DataSource.write_df(df60)\n return Outputs(data_1=data_1)\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-209"},{"name":"input_2","node_id":"-209"},{"name":"input_3","node_id":"-209"}],"output_ports":[{"name":"data_1","node_id":"-209"},{"name":"data_2","node_id":"-209"},{"name":"data_3","node_id":"-209"}],"cacheable":true,"seq_num":11,"comment":"","comment_collapsed":true},{"node_id":"-145","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"how","value":"inner","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"-145"},{"name":"data2","node_id":"-145"}],"output_ports":[{"name":"data","node_id":"-145"}],"cacheable":true,"seq_num":12,"comment":"","comment_collapsed":true},{"node_id":"-151","module_id":"BigQuantSpace.dropnan.dropnan-v1","parameters":[],"input_ports":[{"name":"input_data","node_id":"-151"}],"output_ports":[{"name":"data","node_id":"-151"}],"cacheable":true,"seq_num":19,"comment":"","comment_collapsed":true},{"node_id":"-451","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":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-451"},{"name":"features","node_id":"-451"}],"output_ports":[{"name":"data","node_id":"-451"}],"cacheable":true,"seq_num":22,"comment":"","comment_collapsed":true},{"node_id":"-459","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nclose/shift(close, 20)-1 \nvolume/mean(volume,20)\n\n","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-459"}],"output_ports":[{"name":"data","node_id":"-459"}],"cacheable":true,"seq_num":23,"comment":"","comment_collapsed":true},{"node_id":"-468","module_id":"BigQuantSpace.stock_ranker_train.stock_ranker_train-v5","parameters":[{"name":"learning_algorithm","value":"排序","type":"Literal","bound_global_parameter":null},{"name":"number_of_leaves","value":"30","type":"Literal","bound_global_parameter":null},{"name":"minimum_docs_per_leaf","value":"100","type":"Literal","bound_global_parameter":null},{"name":"number_of_trees","value":20,"type":"Literal","bound_global_parameter":null},{"name":"learning_rate","value":0.1,"type":"Literal","bound_global_parameter":null},{"name":"max_bins","value":1023,"type":"Literal","bound_global_parameter":null},{"name":"feature_fraction","value":1,"type":"Literal","bound_global_parameter":null},{"name":"m_lazy_run","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"training_ds","node_id":"-468"},{"name":"features","node_id":"-468"},{"name":"test_ds","node_id":"-468"},{"name":"base_model","node_id":"-468"}],"output_ports":[{"name":"model","node_id":"-468"},{"name":"feature_gains","node_id":"-468"},{"name":"m_lazy_run","node_id":"-468"}],"cacheable":true,"seq_num":21,"comment":"","comment_collapsed":true},{"node_id":"-765","module_id":"BigQuantSpace.stock_ranker_predict.stock_ranker_predict-v5","parameters":[{"name":"m_lazy_run","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"model","node_id":"-765"},{"name":"data","node_id":"-765"}],"output_ports":[{"name":"predictions","node_id":"-765"},{"name":"m_lazy_run","node_id":"-765"}],"cacheable":true,"seq_num":20,"comment":"","comment_collapsed":true},{"node_id":"-769","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2021-09-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-11-19","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_FUTURE","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"P0000.DCE\nY0000.DCE\nHC0000.SHF\nRB0000.SHF\nJM0000.DCE\nI0000.DCE\nA0000.DCE\nM0000.DCE\nTA0000.CZC\nC0000.DCE","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-769"}],"output_ports":[{"name":"data","node_id":"-769"}],"cacheable":true,"seq_num":10,"comment":"","comment_collapsed":true},{"node_id":"-781","module_id":"BigQuantSpace.cached.cached-v3","parameters":[{"name":"run","value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n # 示例代码如下。在这里编写您的代码\n instruments = input_1.read()['instruments']\n start_date = input_1.read()['start_date']\n end_date = input_1.read()['end_date']\n df = DataSource('bar1m_CN_FUTURE').read(instruments=instruments,start_date=start_date,end_date=end_date)\n df60 = BarGenerator.aggregate_df(df, \"60m\"),\n df60 = df60[0]\n\n data_1 = DataSource.write_df(df60)\n return Outputs(data_1=data_1)\n","type":"Literal","bound_global_parameter":null},{"name":"post_run","value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","type":"Literal","bound_global_parameter":null},{"name":"input_ports","value":"","type":"Literal","bound_global_parameter":null},{"name":"params","value":"{}","type":"Literal","bound_global_parameter":null},{"name":"output_ports","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-781"},{"name":"input_2","node_id":"-781"},{"name":"input_3","node_id":"-781"}],"output_ports":[{"name":"data_1","node_id":"-781"},{"name":"data_2","node_id":"-781"},{"name":"data_3","node_id":"-781"}],"cacheable":true,"seq_num":24,"comment":"","comment_collapsed":true},{"node_id":"-1086","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":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"{}","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-1086"},{"name":"features","node_id":"-1086"}],"output_ports":[{"name":"data","node_id":"-1086"}],"cacheable":true,"seq_num":25,"comment":"","comment_collapsed":true},{"node_id":"-1398","module_id":"BigQuantSpace.dropnan.dropnan-v1","parameters":[],"input_ports":[{"name":"input_data","node_id":"-1398"}],"output_ports":[{"name":"data","node_id":"-1398"}],"cacheable":true,"seq_num":26,"comment":"","comment_collapsed":true},{"node_id":"-284","module_id":"BigQuantSpace.hftrade.hftrade-v1","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 context.ranker_prediction = context.options['data'].read_df()\n #设置尾盘可以下单\n context.set_enable_auto_planed_order(1)\n #用于换仓周期\n context.index = 0\n #控制打印\n context.PRINT = 0\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":"handle_tick","value":"# 交易引擎:tick数据处理函数,每个tick执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 交易引擎:bar数据处理函数,每个时间单位执行一次\ndef bigquant_run(context, data):\n # 获取当日指标数据\n now = data.current_dt.strftime('%Y-%m-%d %H:%M:%S')\n now_data = context.ranker_prediction[context.ranker_prediction.date==now]\n if len(now_data)==0:\n return\n context.index += 1\n #每5根K线处理一次\n if context.index % 5 !=0:\n return\n #平仓\n for symbol,position in context.portfolio.positions.items():\n if position.long.avail_qty>0:\n rv = context.sell_close(symbol, position.long.avail_qty, None,order_type=OrderType.MARKET)\n msg = \"{} {} 平多 下单函数返回 {}\".format(now,symbol,context.get_error_msg(rv))\n context.write_log(msg, stdout=context.PRINT)\n if position.short.avail_qty>0:\n rv = context.buy_close(symbol, position.short.avail_qty, None, order_type=OrderType.MARKET)\n msg = \"{} {} 平空 下单函数返回 {}\".format(now,symbol,context.get_error_msg(rv))\n context.write_log(msg, stdout=context.PRINT)\n #开仓\n instruments = now_data.instrument.unique()\n rv = context.buy_open(instruments[0], 1, None, order_type=OrderType.MARKET)\n msg = \"{} {} 开多 下单函数返回 {}\".format(now,instruments[0],context.get_error_msg(rv))\n context.write_log(msg, stdout=context.PRINT) \n rv = context.sell_open(instruments[-1], 1, None, order_type=OrderType.MARKET)\n msg = \"{} {} 开空 下单函数返回 {}\".format(now,instruments[-1],context.get_error_msg(rv))\n context.write_log(msg, stdout=context.PRINT)","type":"Literal","bound_global_parameter":null},{"name":"handle_trade","value":"# 交易引擎:成交回报处理函数,每个成交发生时执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"handle_order","value":"# 交易引擎:委托回报处理函数,每个委托变化时执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"after_trading","value":"# 交易引擎:盘后处理函数,每日盘后执行一次\ndef bigquant_run(context, data):\n pass\n","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":1000000,"type":"Literal","bound_global_parameter":null},{"name":"frequency","value":"minute","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":"before_start_days","value":"","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.HIX","type":"Literal","bound_global_parameter":null},{"name":"plot_charts","value":"True","type":"Literal","bound_global_parameter":null},{"name":"disable_cache","value":"False","type":"Literal","bound_global_parameter":null},{"name":"show_debug_info","value":"False","type":"Literal","bound_global_parameter":null},{"name":"backtest_only","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-284"},{"name":"history_ds","node_id":"-284"},{"name":"benchmark_ds","node_id":"-284"},{"name":"options_data","node_id":"-284"}],"output_ports":[{"name":"raw_perf","node_id":"-284"}],"cacheable":false,"seq_num":2,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='242,-608,200,200'/><node_position Node='-189' Position='130,-392,200,200'/><node_position Node='-209' Position='234,-498,200,200'/><node_position Node='-145' Position='285,-318,200,200'/><node_position Node='-151' Position='291,-254,200,200'/><node_position Node='-451' Position='451,-399,200,200'/><node_position Node='-459' Position='678,-585,200,200'/><node_position Node='-468' Position='537,-179,200,200'/><node_position Node='-765' Position='736.3434448242188,-93.87676429748535,200,200'/><node_position Node='-769' Position='1110,-552,200,200'/><node_position Node='-781' Position='1048,-433,200,200'/><node_position Node='-1086' Position='1048,-351,200,200'/><node_position Node='-1398' Position='1056,-263,200,200'/><node_position Node='-284' Position='686.25048828125,-8.941411972045898,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2021-11-20 12:05:13.409132] INFO: moduleinvoker: instruments.v2 开始运行..
[2021-11-20 12:05:13.426596] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.428575] INFO: moduleinvoker: instruments.v2 运行完成[0.019447s].
[2021-11-20 12:05:13.441506] INFO: moduleinvoker: cached.v3 开始运行..
[2021-11-20 12:05:13.454224] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.457782] INFO: moduleinvoker: cached.v3 运行完成[0.016258s].
[2021-11-20 12:05:13.467156] INFO: moduleinvoker: auto_labeler_on_datasource.v1 开始运行..
[2021-11-20 12:05:13.477005] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.478807] INFO: moduleinvoker: auto_labeler_on_datasource.v1 运行完成[0.011654s].
[2021-11-20 12:05:13.482961] INFO: moduleinvoker: input_features.v1 开始运行..
[2021-11-20 12:05:13.491980] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.494120] INFO: moduleinvoker: input_features.v1 运行完成[0.011151s].
[2021-11-20 12:05:13.502320] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2021-11-20 12:05:13.506897] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.508151] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[0.005832s].
[2021-11-20 12:05:13.516330] INFO: moduleinvoker: join.v3 开始运行..
[2021-11-20 12:05:13.524885] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.526290] INFO: moduleinvoker: join.v3 运行完成[0.009964s].
[2021-11-20 12:05:13.534799] INFO: moduleinvoker: dropnan.v1 开始运行..
[2021-11-20 12:05:13.542800] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.544342] INFO: moduleinvoker: dropnan.v1 运行完成[0.009542s].
[2021-11-20 12:05:13.552891] INFO: moduleinvoker: stock_ranker_train.v5 开始运行..
[2021-11-20 12:05:13.566484] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.687678] INFO: moduleinvoker: stock_ranker_train.v5 运行完成[0.134787s].
[2021-11-20 12:05:13.694236] INFO: moduleinvoker: instruments.v2 开始运行..
[2021-11-20 12:05:13.705926] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.707933] INFO: moduleinvoker: instruments.v2 运行完成[0.013695s].
[2021-11-20 12:05:13.721905] INFO: moduleinvoker: cached.v3 开始运行..
[2021-11-20 12:05:13.731689] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.733548] INFO: moduleinvoker: cached.v3 运行完成[0.011655s].
[2021-11-20 12:05:13.742946] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2021-11-20 12:05:13.756261] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.758915] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[0.015946s].
[2021-11-20 12:05:13.769361] INFO: moduleinvoker: dropnan.v1 开始运行..
[2021-11-20 12:05:13.778757] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.781325] INFO: moduleinvoker: dropnan.v1 运行完成[0.011964s].
[2021-11-20 12:05:13.790687] INFO: moduleinvoker: stock_ranker_predict.v5 开始运行..
[2021-11-20 12:05:13.797265] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:13.798803] INFO: moduleinvoker: stock_ranker_predict.v5 运行完成[0.008119s].
[2021-11-20 12:05:13.818889] INFO: moduleinvoker: hfbacktest.v1 开始运行..
[2021-11-20 12:05:13.845227] INFO: moduleinvoker: 命中缓存
[2021-11-20 12:05:14.409960] INFO: moduleinvoker: hfbacktest.v1 运行完成[0.591068s].
[2021-11-20 12:05:14.411469] INFO: moduleinvoker: hftrade.v1 运行完成[0.607199s].
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-79615ea113404b9692c550f608223925"}/bigcharts-data-end
- 收益率4.18%
- 年化收益率22.4%
- 基准收益率0.42%
- 阿尔法0.2
- 贝塔-0.06
- 夏普比率2.48
- 胜率0.25
- 盈亏比1.56
- 收益波动率7.07%
- 最大回撤1.49%
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-4af90ec799284242800a7ed7848af82d"}/bigcharts-data-end