{"description":"实验创建于2020/10/29","graph":{"edges":[{"to_node_id":"-152:instruments","from_node_id":"-140:data"}],"nodes":[{"node_id":"-140","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2016-06-28","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2016-07-18","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"600000.SHA\n000002.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":"-140"}],"output_ports":[{"name":"data","node_id":"-140"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"-152","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 pass","type":"Literal","bound_global_parameter":null},{"name":"handle_data","value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n \n dt = data.current_dt.strftime('%Y-%m-%d')\n k = context.instruments[0] # 标的为字符串格式\n sid = context.symbol(k) # 将标的转化为equity格式\n \n if dt == '2016-07-13':\n order(sid, 100)\n print(dt,'生成一个买入100股的虚拟订单')\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 \n dt = data.current_dt.strftime('%Y-%m-%d')\n \n k = context.instruments[0] # 标的为字符串格式\n \n sid = context.symbol(k) # 将标的转化为equity格式\n \n print('撤单之前的委托:', context.get_open_orders().values())\n \n for open_orders in context.get_open_orders().values():\n\n \n for order in open_orders:\n \n sid = order.sid\n today_open = data.current(sid, 'open')\n \n if True: \n context.cancel_order(order)\n print(dt,'在before_trading_start取消订单:',sid)\n print('撤单之后的委托:',context.get_open_orders().values())\n \n # 买入另外一只\n from zipline.finance.order import Order\n from zipline.finance.execution import MarketOrder\n \n order = Order(\n dt = order['dt'],\n asset=context.symbol(context.instruments[1]),\n amount=100,\n stop=None,\n limit=None,\n price_field='open')\n \n try:\n context.blotter.open_orders[order.asset].append(order)\n except Exception:\n context.blotter.open_orders[order.asset] = [order]\n\n context.blotter.orders[order.id] = order\n context.blotter.new_orders.append(order)\n continue\n \n print('新提交订单后的委托:',context.get_open_orders().values())\n","type":"Literal","bound_global_parameter":null},{"name":"volume_limit","value":0.025,"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":"close","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":"-152"},{"name":"options_data","node_id":"-152"},{"name":"history_ds","node_id":"-152"},{"name":"benchmark_ds","node_id":"-152"},{"name":"trading_calendar","node_id":"-152"}],"output_ports":[{"name":"raw_perf","node_id":"-152"}],"cacheable":false,"seq_num":2,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='-140' Position='225,157,200,200'/><node_position Node='-152' Position='185,341,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
[2022-12-08 16:13:52.217666] INFO: moduleinvoker: instruments.v2 开始运行..
[2022-12-08 16:13:52.225464] INFO: moduleinvoker: 命中缓存
[2022-12-08 16:13:52.227757] INFO: moduleinvoker: instruments.v2 运行完成[0.010086s].
[2022-12-08 16:13:52.302469] INFO: moduleinvoker: backtest.v8 开始运行..
[2022-12-08 16:13:52.313061] INFO: moduleinvoker: 命中缓存
[2022-12-08 16:13:52.782138] INFO: moduleinvoker: backtest.v8 运行完成[0.479683s].
[2022-12-08 16:13:52.784358] INFO: moduleinvoker: trade.v4 运行完成[0.549012s].
- 收益率-0.0%
- 年化收益率-0.01%
- 基准收益率4.53%
- 阿尔法-0.03
- 贝塔0.0
- 夏普比率-521.75
- 胜率0.0
- 盈亏比0.0
- 收益波动率0.01%
- 信息比率-0.41
- 最大回撤0.0%
bigcharts-data-start/{"__type":"tabs","__id":"bigchart-46568f3e175e4b72b8ac4e269016259d"}/bigcharts-data-end