{"description":"实验创建于2022/10/21","graph":{"edges":[{"to_node_id":"-167:features","from_node_id":"-162:data"},{"to_node_id":"-383:features","from_node_id":"-162:data"},{"to_node_id":"-16:options_data","from_node_id":"-167:data"},{"to_node_id":"-16:instruments","from_node_id":"-374:data"},{"to_node_id":"-383:instruments","from_node_id":"-374:data"},{"to_node_id":"-167:input_data","from_node_id":"-383:data"}],"nodes":[{"node_id":"-162","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"rsrs = ta_beta(high_0, low_0, 18)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"-162"}],"output_ports":[{"name":"data","node_id":"-162"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-167","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":"-167"},{"name":"features","node_id":"-167"}],"output_ports":[{"name":"data","node_id":"-167"}],"cacheable":true,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-16","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 context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n context.factor_data = context.options['data'].read_df()","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # 按日期过滤得到今日的预测数据\n factor_data = context.factor_data[\n context.factor_data.date == data.current_dt.strftime('%Y-%m-%d')]\n for sid in context.instruments:\n factor = factor_data[factor_data.instrument==sid]\n # 标的为字符串格式\n sid = context.symbol(sid)# 标的为字符串格\n price = data.current(sid, 'price') # 最新价格\n rsrs = factor.rsrs.values\n cur_position = context.portfolio.positions[sid].amount # 持仓数量 \n weight = 1 / len(context.instruments) # 等权重\n\n #交易逻辑\n # 如果短期均线大于长期均线形成金叉,并且没有持仓,并且该股票可以交易\n if rsrs>0.6 and cur_position == 0: \n context.order_target_percent(sid, weight) # 买入\n print('{}全仓买入{}股票'.format(data.current_dt.strftime('%Y-%m-%d'),sid.symbol))\n # 如果短期均线小于长期均线形成死叉,并且有持仓,并且该股票可以交易\n elif rsrs<0.6 and cur_position > 0 : \n context.order_target_percent(sid, 0) # 全部卖出\n print('{}卖出{}股票'.format(data.current_dt.strftime('%Y-%m-%d'),sid.symbol))\n \n \n","type":"Literal","bound_global_parameter":null},{"name":"prepare","value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n pass\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","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":"open","type":"Literal","bound_global_parameter":null},{"name":"capital_base","value":1000000,"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":"-16"},{"name":"options_data","node_id":"-16"},{"name":"history_ds","node_id":"-16"},{"name":"benchmark_ds","node_id":"-16"},{"name":"trading_calendar","node_id":"-16"}],"output_ports":[{"name":"raw_perf","node_id":"-16"}],"cacheable":false,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-374","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2019-09-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2021-09-01","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"000001.SZA","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"-374"}],"output_ports":[{"name":"data","node_id":"-374"}],"cacheable":true,"seq_num":2,"comment":"预测数据,用于回测和模拟","comment_collapsed":true},{"node_id":"-383","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":90,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-383"},{"name":"features","node_id":"-383"}],"output_ports":[{"name":"data","node_id":"-383"}],"cacheable":true,"seq_num":3,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-162' Position='561.3375244140625,-39.03999471664429,200,200'/><node_position Node='-167' Position='362.5133056640625,156.81594848632812,200,200'/><node_position Node='-16' Position='257.125,259.5731201171875,200,200'/><node_position Node='-374' Position='150.04673767089844,-41.26599621772766,200,200'/><node_position Node='-383' Position='348.4064025878906,57.80524444580078,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2022-10-21 14:34:35.562307] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-10-21 14:34:35.571844] INFO: moduleinvoker: 命中缓存
[2022-10-21 14:34:35.573986] INFO: moduleinvoker: input_features.v1 运行完成[0.011693s].
[2022-10-21 14:34:35.580084] INFO: moduleinvoker: instruments.v2 开始运行..
[2022-10-21 14:34:35.587118] INFO: moduleinvoker: 命中缓存
[2022-10-21 14:34:35.588934] INFO: moduleinvoker: instruments.v2 运行完成[0.008849s].
[2022-10-21 14:34:35.604703] INFO: moduleinvoker: general_feature_extractor.v7 开始运行..
[2022-10-21 14:34:35.620774] INFO: moduleinvoker: 命中缓存
[2022-10-21 14:34:35.622546] INFO: moduleinvoker: general_feature_extractor.v7 运行完成[0.017869s].
[2022-10-21 14:34:35.629433] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2022-10-21 14:34:35.636877] INFO: moduleinvoker: 命中缓存
[2022-10-21 14:34:35.638343] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[0.008909s].
[2022-10-21 14:34:35.681274] INFO: moduleinvoker: backtest.v8 开始运行..
[2022-10-21 14:34:35.694782] INFO: moduleinvoker: 命中缓存
[2022-10-21 14:34:37.900192] INFO: moduleinvoker: backtest.v8 运行完成[2.218911s].
[2022-10-21 14:34:37.901899] INFO: moduleinvoker: trade.v4 运行完成[2.25724s].
- 收益率31.91%
- 年化收益率15.41%
- 基准收益率28.16%
- 阿尔法0.07
- 贝塔0.71
- 夏普比率0.54
- 胜率0.67
- 盈亏比0.72
- 收益波动率28.47%
- 信息比率0.01
- 最大回撤31.85%
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-885ede1393374b3c8b68f01f0579fdcb"}/bigcharts-data-end