From c5ee08ae8284cb30739cff0ab55b22ef556ea3f7 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sun, 10 Nov 2019 16:34:39 +0800 Subject: [PATCH] [Add] load_bar/load_tick function for SpreadStrategyEngine --- examples/spread_backtesting/backtesting.ipynb | 518 ++++++++++++++++-- vnpy/app/cta_strategy/engine.py | 2 - vnpy/app/spread_trading/backtesting.py | 77 +-- vnpy/app/spread_trading/base.py | 80 ++- vnpy/app/spread_trading/engine.py | 30 +- 5 files changed, 587 insertions(+), 120 deletions(-) diff --git a/examples/spread_backtesting/backtesting.ipynb b/examples/spread_backtesting/backtesting.ipynb index c914ecc6..459ea279 100644 --- a/examples/spread_backtesting/backtesting.ipynb +++ b/examples/spread_backtesting/backtesting.ipynb @@ -65,48 +65,48 @@ "name": "stdout", "output_type": "stream", "text": [ - "2019-11-10 16:09:03.822440\t开始加载历史数据\n", - "2019-11-10 16:09:07.915724\t历史数据加载完成,数据量:7200\n", - "2019-11-10 16:09:07.993766\t策略初始化完成\n", - "2019-11-10 16:09:07.993766\t开始回放历史数据\n", - "2019-11-10 16:09:08.186919\t历史数据回放结束\n", - "2019-11-10 16:09:08.186919\t开始计算逐日盯市盈亏\n", - "2019-11-10 16:09:08.192772\t逐日盯市盈亏计算完成\n", - "2019-11-10 16:09:08.193748\t开始计算策略统计指标\n", - "2019-11-10 16:09:08.236670\t------------------------------\n", - "2019-11-10 16:09:08.236670\t首个交易日:\t2019-10-14\n", - "2019-11-10 16:09:08.236670\t最后交易日:\t2019-11-08\n", - "2019-11-10 16:09:08.236670\t总交易日:\t20\n", - "2019-11-10 16:09:08.236670\t盈利交易日:\t12\n", - "2019-11-10 16:09:08.236670\t亏损交易日:\t8\n", - "2019-11-10 16:09:08.236670\t起始资金:\t1,000,000.00\n", - "2019-11-10 16:09:08.236670\t结束资金:\t1,075,600.00\n", - "2019-11-10 16:09:08.236670\t总收益率:\t7.56%\n", - "2019-11-10 16:09:08.236670\t年化收益:\t90.72%\n", - "2019-11-10 16:09:08.236670\t最大回撤: \t-24,600.00\n", - "2019-11-10 16:09:08.236670\t百分比最大回撤: -2.29%\n", - "2019-11-10 16:09:08.236670\t最长回撤天数: \t9\n", - "2019-11-10 16:09:08.236670\t总盈亏:\t75,600.00\n", - "2019-11-10 16:09:08.236670\t总手续费:\t0.00\n", - "2019-11-10 16:09:08.236670\t总滑点:\t0.00\n", - "2019-11-10 16:09:08.236670\t总成交金额:\t3,603,600.00\n", - "2019-11-10 16:09:08.236670\t总成交笔数:\t435\n", - "2019-11-10 16:09:08.236670\t日均盈亏:\t3,780.00\n", - "2019-11-10 16:09:08.236670\t日均手续费:\t0.00\n", - "2019-11-10 16:09:08.236670\t日均滑点:\t0.00\n", - "2019-11-10 16:09:08.236670\t日均成交金额:\t180,180.00\n", - "2019-11-10 16:09:08.236670\t日均成交笔数:\t21.75\n", - "2019-11-10 16:09:08.236670\t日均收益率:\t0.27%\n", - "2019-11-10 16:09:08.236670\t收益标准差:\t0.81%\n", - "2019-11-10 16:09:08.236670\tSharpe Ratio:\t5.20\n", - "2019-11-10 16:09:08.236670\t收益回撤比:\t3.29\n" + "2019-11-10 16:33:53.249984\t开始加载历史数据\n", + "2019-11-10 16:33:56.769516\t历史数据加载完成,数据量:7200\n", + "2019-11-10 16:33:56.816391\t策略初始化完成\n", + "2019-11-10 16:33:56.816391\t开始回放历史数据\n", + "2019-11-10 16:33:56.957016\t历史数据回放结束\n", + "2019-11-10 16:33:56.957016\t开始计算逐日盯市盈亏\n", + "2019-11-10 16:33:56.957016\t逐日盯市盈亏计算完成\n", + "2019-11-10 16:33:56.957016\t开始计算策略统计指标\n", + "2019-11-10 16:33:56.990219\t------------------------------\n", + "2019-11-10 16:33:56.991195\t首个交易日:\t2019-10-14\n", + "2019-11-10 16:33:56.991195\t最后交易日:\t2019-11-08\n", + "2019-11-10 16:33:56.992172\t总交易日:\t20\n", + "2019-11-10 16:33:56.992172\t盈利交易日:\t12\n", + "2019-11-10 16:33:56.992172\t亏损交易日:\t8\n", + "2019-11-10 16:33:56.993148\t起始资金:\t1,000,000.00\n", + "2019-11-10 16:33:56.993148\t结束资金:\t1,075,600.00\n", + "2019-11-10 16:33:56.994125\t总收益率:\t7.56%\n", + "2019-11-10 16:33:56.994125\t年化收益:\t90.72%\n", + "2019-11-10 16:33:56.994125\t最大回撤: \t-24,600.00\n", + "2019-11-10 16:33:56.995102\t百分比最大回撤: -2.29%\n", + "2019-11-10 16:33:56.995102\t最长回撤天数: \t9\n", + "2019-11-10 16:33:56.996078\t总盈亏:\t75,600.00\n", + "2019-11-10 16:33:56.996078\t总手续费:\t0.00\n", + "2019-11-10 16:33:56.996078\t总滑点:\t0.00\n", + "2019-11-10 16:33:56.997055\t总成交金额:\t3,603,600.00\n", + "2019-11-10 16:33:56.997055\t总成交笔数:\t435\n", + "2019-11-10 16:33:56.997055\t日均盈亏:\t3,780.00\n", + "2019-11-10 16:33:56.998031\t日均手续费:\t0.00\n", + "2019-11-10 16:33:56.999008\t日均滑点:\t0.00\n", + "2019-11-10 16:33:56.999008\t日均成交金额:\t180,180.00\n", + "2019-11-10 16:33:56.999008\t日均成交笔数:\t21.75\n", + "2019-11-10 16:33:56.999008\t日均收益率:\t0.27%\n", + "2019-11-10 16:33:56.999008\t收益标准差:\t0.81%\n", + "2019-11-10 16:33:56.999008\tSharpe Ratio:\t5.20\n", + "2019-11-10 16:33:56.999008\t收益回撤比:\t3.29\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "C:\\Github\\vnpy\\vnpy\\app\\spread_trading\\backtesting.py:289: FutureWarning: \n", + "C:\\Github\\vnpy\\vnpy\\app\\spread_trading\\backtesting.py:286: FutureWarning: \n", "The current behaviour of 'Series.argmax' is deprecated, use 'idxmax'\n", "instead.\n", "The behavior of 'argmax' will be corrected to return the positional\n", @@ -140,9 +140,451 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='1', tradeid='1', direction=, offset=, price=5.0, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='2', tradeid='2', direction=, offset=, price=2.0, volume=10, time='09:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='3', tradeid='3', direction=, offset=, price=0.2, volume=10, time='09:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='4', tradeid='4', direction=, offset=, price=2.4, volume=10, time='10:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='5', tradeid='5', direction=, offset=, price=0.2, volume=10, time='10:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='6', tradeid='6', direction=, offset=, price=0.2, volume=10, time='10:06:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='7', tradeid='7', direction=, offset=, price=0.2, volume=10, time='10:06:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='8', tradeid='8', direction=, offset=, price=0.2, volume=10, time='10:06:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='9', tradeid='9', direction=, offset=, price=0.6, volume=20, time='10:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='10', tradeid='10', direction=, offset=, price=0.2, volume=10, time='10:29:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='11', tradeid='11', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='12', tradeid='12', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='13', tradeid='13', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='14', tradeid='14', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='15', tradeid='15', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='16', tradeid='16', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='17', tradeid='17', direction=, offset=, price=0.2, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='18', tradeid='18', direction=, offset=, price=0.8, volume=60, time='10:47:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='19', tradeid='19', direction=, offset=, price=0.8, volume=10, time='10:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='20', tradeid='20', direction=, offset=, price=0.6, volume=10, time='10:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='21', tradeid='21', direction=, offset=, price=0.6, volume=10, time='10:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='22', tradeid='22', direction=, offset=, price=0.4, volume=10, time='11:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='23', tradeid='23', direction=, offset=, price=0.4, volume=10, time='11:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='24', tradeid='24', direction=, offset=, price=0.4, volume=10, time='11:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='25', tradeid='25', direction=, offset=, price=1.8, volume=20, time='11:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='26', tradeid='26', direction=, offset=, price=0.4, volume=10, time='13:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='27', tradeid='27', direction=, offset=, price=0.2, volume=10, time='13:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='28', tradeid='28', direction=, offset=, price=0.4, volume=10, time='13:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='29', tradeid='29', direction=, offset=, price=0.6, volume=10, time='13:47:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='30', tradeid='30', direction=, offset=, price=1.6, volume=10, time='14:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='31', tradeid='31', direction=, offset=, price=0.6, volume=10, time='14:09:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='32', tradeid='32', direction=, offset=, price=1.2, volume=10, time='14:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='33', tradeid='33', direction=, offset=, price=1.0, volume=10, time='14:20:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='34', tradeid='34', direction=, offset=, price=1.0, volume=10, time='14:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='35', tradeid='35', direction=, offset=, price=0.8, volume=10, time='14:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='36', tradeid='36', direction=, offset=, price=3.0, volume=10, time='14:59:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='37', tradeid='37', direction=, offset=, price=0.2, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='38', tradeid='38', direction=, offset=, price=0.2, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='39', tradeid='39', direction=, offset=, price=0.2, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='40', tradeid='40', direction=, offset=, price=0.2, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='41', tradeid='41', direction=, offset=, price=0.2, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='42', tradeid='42', direction=, offset=, price=0.6, volume=40, time='09:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='43', tradeid='43', direction=, offset=, price=2.8, volume=10, time='09:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='44', tradeid='44', direction=, offset=, price=2.0, volume=10, time='10:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='45', tradeid='45', direction=, offset=, price=2.6, volume=10, time='10:06:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='46', tradeid='46', direction=, offset=, price=2.2, volume=10, time='10:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='47', tradeid='47', direction=, offset=, price=0.8, volume=10, time='10:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='48', tradeid='48', direction=, offset=, price=1.8, volume=10, time='10:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='49', tradeid='49', direction=, offset=, price=1.2, volume=10, time='10:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='50', tradeid='50', direction=, offset=, price=2.6, volume=10, time='10:48:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='51', tradeid='51', direction=, offset=, price=0.4, volume=10, time='11:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='52', tradeid='52', direction=, offset=, price=1.2, volume=10, time='11:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='53', tradeid='53', direction=, offset=, price=1.4, volume=10, time='11:11:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='54', tradeid='54', direction=, offset=, price=0.4, volume=10, time='11:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='55', tradeid='55', direction=, offset=, price=0.4, volume=10, time='11:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='56', tradeid='56', direction=, offset=, price=1.2, volume=10, time='11:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='57', tradeid='57', direction=, offset=, price=0.8, volume=10, time='13:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='58', tradeid='58', direction=, offset=, price=1.4, volume=10, time='13:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='59', tradeid='59', direction=, offset=, price=0.2, volume=10, time='13:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='60', tradeid='60', direction=, offset=, price=0.6, volume=10, time='13:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='61', tradeid='61', direction=, offset=, price=0.8, volume=10, time='14:14:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='62', tradeid='62', direction=, offset=, price=1.6, volume=10, time='14:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='63', tradeid='63', direction=, offset=, price=2.2, volume=10, time='14:20:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='64', tradeid='64', direction=, offset=, price=1.2, volume=10, time='14:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='65', tradeid='65', direction=, offset=, price=0.8, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='66', tradeid='66', direction=, offset=, price=0.8, volume=10, time='09:45:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='67', tradeid='67', direction=, offset=, price=1.8, volume=10, time='09:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='68', tradeid='68', direction=, offset=, price=0.2, volume=10, time='10:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='69', tradeid='69', direction=, offset=, price=2.8, volume=10, time='10:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='70', tradeid='70', direction=, offset=, price=0.8, volume=10, time='10:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='71', tradeid='71', direction=, offset=, price=0.6, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='72', tradeid='72', direction=, offset=, price=0.8, volume=10, time='10:44:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='73', tradeid='73', direction=, offset=, price=2.0, volume=10, time='11:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='74', tradeid='74', direction=, offset=, price=1.2, volume=10, time='11:05:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='75', tradeid='75', direction=, offset=, price=0.6, volume=10, time='13:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='76', tradeid='76', direction=, offset=, price=1.4, volume=10, time='13:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='77', tradeid='77', direction=, offset=, price=2.8, volume=10, time='13:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='78', tradeid='78', direction=, offset=, price=0.8, volume=10, time='13:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='79', tradeid='79', direction=, offset=, price=0.8, volume=10, time='13:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='80', tradeid='80', direction=, offset=, price=2.4, volume=10, time='13:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='81', tradeid='81', direction=, offset=, price=3.6, volume=10, time='14:22:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='82', tradeid='82', direction=, offset=, price=4.4, volume=10, time='14:34:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='83', tradeid='83', direction=, offset=, price=3.0, volume=10, time='14:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='84', tradeid='84', direction=, offset=, price=2.8, volume=10, time='14:48:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='85', tradeid='85', direction=, offset=, price=3.6, volume=10, time='14:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='86', tradeid='86', direction=, offset=, price=2.8, volume=10, time='09:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='87', tradeid='87', direction=, offset=, price=3.2, volume=10, time='10:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='88', tradeid='88', direction=, offset=, price=4.0, volume=10, time='10:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='89', tradeid='89', direction=, offset=, price=5.0, volume=10, time='10:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='90', tradeid='90', direction=, offset=, price=5.2, volume=10, time='10:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='91', tradeid='91', direction=, offset=, price=4.6, volume=10, time='11:12:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='92', tradeid='92', direction=, offset=, price=5.6, volume=10, time='11:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='93', tradeid='93', direction=, offset=, price=5.6, volume=10, time='13:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='94', tradeid='94', direction=, offset=, price=6.2, volume=10, time='13:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='95', tradeid='95', direction=, offset=, price=5.0, volume=10, time='13:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='96', tradeid='96', direction=, offset=, price=4.8, volume=10, time='13:29:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='97', tradeid='97', direction=, offset=, price=4.2, volume=10, time='13:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='98', tradeid='98', direction=, offset=, price=5.6, volume=10, time='13:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='99', tradeid='99', direction=, offset=, price=5.8, volume=10, time='13:59:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='100', tradeid='100', direction=, offset=, price=6.0, volume=10, time='14:05:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='101', tradeid='101', direction=, offset=, price=4.6, volume=10, time='14:14:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='102', tradeid='102', direction=, offset=, price=5.0, volume=10, time='14:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='103', tradeid='103', direction=, offset=, price=7.0, volume=10, time='14:22:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='104', tradeid='104', direction=, offset=, price=6.6, volume=10, time='14:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='105', tradeid='105', direction=, offset=, price=5.6, volume=10, time='14:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='106', tradeid='106', direction=, offset=, price=4.0, volume=10, time='09:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='107', tradeid='107', direction=, offset=, price=3.8, volume=10, time='09:46:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='108', tradeid='108', direction=, offset=, price=3.6, volume=10, time='09:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='109', tradeid='109', direction=, offset=, price=3.4, volume=10, time='10:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='110', tradeid='110', direction=, offset=, price=3.8, volume=10, time='10:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='111', tradeid='111', direction=, offset=, price=2.6, volume=10, time='10:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='112', tradeid='112', direction=, offset=, price=4.0, volume=10, time='10:48:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='113', tradeid='113', direction=, offset=, price=3.4, volume=10, time='11:11:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='114', tradeid='114', direction=, offset=, price=3.4, volume=10, time='11:17:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='115', tradeid='115', direction=, offset=, price=4.0, volume=10, time='11:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='116', tradeid='116', direction=, offset=, price=5.2, volume=10, time='13:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='117', tradeid='117', direction=, offset=, price=4.6, volume=10, time='13:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='118', tradeid='118', direction=, offset=, price=5.0, volume=10, time='13:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='119', tradeid='119', direction=, offset=, price=6.0, volume=10, time='13:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='120', tradeid='120', direction=, offset=, price=5.8, volume=10, time='13:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='121', tradeid='121', direction=, offset=, price=5.4, volume=10, time='13:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='122', tradeid='122', direction=, offset=, price=4.8, volume=10, time='13:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='123', tradeid='123', direction=, offset=, price=4.8, volume=10, time='14:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='124', tradeid='124', direction=, offset=, price=4.2, volume=10, time='14:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='125', tradeid='125', direction=, offset=, price=6.6, volume=10, time='09:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='126', tradeid='126', direction=, offset=, price=5.8, volume=10, time='09:34:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='127', tradeid='127', direction=, offset=, price=4.8, volume=10, time='09:46:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='128', tradeid='128', direction=, offset=, price=5.6, volume=10, time='09:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='129', tradeid='129', direction=, offset=, price=5.2, volume=10, time='10:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='130', tradeid='130', direction=, offset=, price=5.0, volume=10, time='10:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='131', tradeid='131', direction=, offset=, price=6.4, volume=10, time='10:11:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='132', tradeid='132', direction=, offset=, price=5.8, volume=10, time='10:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='133', tradeid='133', direction=, offset=, price=6.8, volume=10, time='11:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='134', tradeid='134', direction=, offset=, price=5.8, volume=10, time='11:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='135', tradeid='135', direction=, offset=, price=6.4, volume=10, time='13:10:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='136', tradeid='136', direction=, offset=, price=5.6, volume=10, time='13:14:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='137', tradeid='137', direction=, offset=, price=6.0, volume=10, time='13:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='138', tradeid='138', direction=, offset=, price=6.6, volume=10, time='13:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='139', tradeid='139', direction=, offset=, price=4.8, volume=10, time='14:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='140', tradeid='140', direction=, offset=, price=5.2, volume=10, time='14:10:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='141', tradeid='141', direction=, offset=, price=5.6, volume=10, time='14:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='142', tradeid='142', direction=, offset=, price=5.6, volume=10, time='14:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='143', tradeid='143', direction=, offset=, price=5.2, volume=10, time='14:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='144', tradeid='144', direction=, offset=, price=4.8, volume=10, time='14:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='145', tradeid='145', direction=, offset=, price=5.6, volume=10, time='14:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='146', tradeid='146', direction=, offset=, price=5.6, volume=10, time='14:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='147', tradeid='147', direction=, offset=, price=5.4, volume=10, time='14:59:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='148', tradeid='148', direction=, offset=, price=5.2, volume=10, time='09:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='149', tradeid='149', direction=, offset=, price=6.2, volume=10, time='09:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='150', tradeid='150', direction=, offset=, price=4.4, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='151', tradeid='151', direction=, offset=, price=4.6, volume=10, time='09:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='152', tradeid='152', direction=, offset=, price=4.6, volume=10, time='09:51:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='153', tradeid='153', direction=, offset=, price=4.8, volume=10, time='10:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='154', tradeid='154', direction=, offset=, price=4.2, volume=10, time='10:10:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='155', tradeid='155', direction=, offset=, price=4.4, volume=10, time='10:39:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='156', tradeid='156', direction=, offset=, price=4.4, volume=10, time='10:42:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='157', tradeid='157', direction=, offset=, price=5.4, volume=10, time='10:45:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='158', tradeid='158', direction=, offset=, price=4.4, volume=10, time='10:46:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='159', tradeid='159', direction=, offset=, price=5.0, volume=10, time='11:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='160', tradeid='160', direction=, offset=, price=5.2, volume=10, time='11:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='161', tradeid='161', direction=, offset=, price=5.2, volume=10, time='13:42:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='162', tradeid='162', direction=, offset=, price=4.8, volume=10, time='13:44:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='163', tradeid='163', direction=, offset=, price=4.8, volume=10, time='13:47:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='164', tradeid='164', direction=, offset=, price=4.8, volume=10, time='13:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='165', tradeid='165', direction=, offset=, price=2.2, volume=10, time='14:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='166', tradeid='166', direction=, offset=, price=4.6, volume=10, time='14:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='167', tradeid='167', direction=, offset=, price=3.4, volume=10, time='14:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='168', tradeid='168', direction=, offset=, price=4.2, volume=10, time='14:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='169', tradeid='169', direction=, offset=, price=3.2, volume=10, time='10:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='170', tradeid='170', direction=, offset=, price=3.6, volume=10, time='10:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='171', tradeid='171', direction=, offset=, price=3.6, volume=10, time='11:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='172', tradeid='172', direction=, offset=, price=3.6, volume=10, time='11:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='173', tradeid='173', direction=, offset=, price=3.4, volume=10, time='11:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='174', tradeid='174', direction=, offset=, price=4.0, volume=10, time='11:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='175', tradeid='175', direction=, offset=, price=4.0, volume=10, time='13:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='176', tradeid='176', direction=, offset=, price=3.8, volume=10, time='13:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='177', tradeid='177', direction=, offset=, price=4.4, volume=10, time='13:20:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='178', tradeid='178', direction=, offset=, price=4.8, volume=10, time='13:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='179', tradeid='179', direction=, offset=, price=4.6, volume=10, time='13:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='180', tradeid='180', direction=, offset=, price=3.4, volume=10, time='13:37:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='181', tradeid='181', direction=, offset=, price=3.6, volume=10, time='13:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='182', tradeid='182', direction=, offset=, price=3.4, volume=10, time='13:51:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='183', tradeid='183', direction=, offset=, price=5.0, volume=10, time='13:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='184', tradeid='184', direction=, offset=, price=3.6, volume=10, time='13:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='185', tradeid='185', direction=, offset=, price=3.4, volume=10, time='14:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='186', tradeid='186', direction=, offset=, price=4.4, volume=10, time='14:06:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='187', tradeid='187', direction=, offset=, price=3.6, volume=10, time='14:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='188', tradeid='188', direction=, offset=, price=4.2, volume=10, time='14:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='189', tradeid='189', direction=, offset=, price=4.2, volume=10, time='09:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='190', tradeid='190', direction=, offset=, price=3.4, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='191', tradeid='191', direction=, offset=, price=4.8, volume=10, time='10:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='192', tradeid='192', direction=, offset=, price=4.0, volume=10, time='10:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='193', tradeid='193', direction=, offset=, price=4.6, volume=10, time='10:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='194', tradeid='194', direction=, offset=, price=4.2, volume=10, time='10:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='195', tradeid='195', direction=, offset=, price=3.6, volume=10, time='10:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='196', tradeid='196', direction=, offset=, price=3.4, volume=10, time='10:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='197', tradeid='197', direction=, offset=, price=3.6, volume=10, time='11:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='198', tradeid='198', direction=, offset=, price=4.2, volume=10, time='11:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='199', tradeid='199', direction=, offset=, price=4.6, volume=10, time='11:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='200', tradeid='200', direction=, offset=, price=3.8, volume=10, time='11:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='201', tradeid='201', direction=, offset=, price=3.8, volume=10, time='13:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='202', tradeid='202', direction=, offset=, price=3.4, volume=10, time='13:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='203', tradeid='203', direction=, offset=, price=4.0, volume=10, time='13:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='204', tradeid='204', direction=, offset=, price=3.0, volume=10, time='13:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='205', tradeid='205', direction=, offset=, price=3.6, volume=10, time='09:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='206', tradeid='206', direction=, offset=, price=2.8, volume=10, time='09:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='207', tradeid='207', direction=, offset=, price=2.8, volume=10, time='09:44:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='208', tradeid='208', direction=, offset=, price=2.6, volume=10, time='09:47:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='209', tradeid='209', direction=, offset=, price=2.2, volume=10, time='10:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='210', tradeid='210', direction=, offset=, price=2.0, volume=10, time='10:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='211', tradeid='211', direction=, offset=, price=2.0, volume=10, time='10:12:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='212', tradeid='212', direction=, offset=, price=1.6, volume=10, time='10:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='213', tradeid='213', direction=, offset=, price=3.4, volume=10, time='10:22:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='214', tradeid='214', direction=, offset=, price=3.6, volume=10, time='10:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='215', tradeid='215', direction=, offset=, price=2.4, volume=10, time='10:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='216', tradeid='216', direction=, offset=, price=2.2, volume=10, time='10:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='217', tradeid='217', direction=, offset=, price=2.4, volume=10, time='10:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='218', tradeid='218', direction=, offset=, price=1.8, volume=10, time='10:48:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='219', tradeid='219', direction=, offset=, price=3.0, volume=10, time='11:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='220', tradeid='220', direction=, offset=, price=3.2, volume=10, time='11:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='221', tradeid='221', direction=, offset=, price=2.6, volume=10, time='13:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='222', tradeid='222', direction=, offset=, price=2.6, volume=10, time='13:12:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='223', tradeid='223', direction=, offset=, price=2.4, volume=10, time='13:20:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='224', tradeid='224', direction=, offset=, price=3.0, volume=10, time='13:22:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='225', tradeid='225', direction=, offset=, price=2.2, volume=10, time='13:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='226', tradeid='226', direction=, offset=, price=2.8, volume=10, time='13:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='227', tradeid='227', direction=, offset=, price=3.6, volume=10, time='13:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='228', tradeid='228', direction=, offset=, price=3.6, volume=10, time='13:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='229', tradeid='229', direction=, offset=, price=5.2, volume=10, time='14:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='230', tradeid='230', direction=, offset=, price=3.6, volume=10, time='14:09:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='231', tradeid='231', direction=, offset=, price=1.8, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='232', tradeid='232', direction=, offset=, price=1.8, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='233', tradeid='233', direction=, offset=, price=0.8, volume=20, time='09:44:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='234', tradeid='234', direction=, offset=, price=0.4, volume=10, time='09:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='235', tradeid='235', direction=, offset=, price=0.6, volume=10, time='10:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='236', tradeid='236', direction=, offset=, price=0.4, volume=10, time='10:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='237', tradeid='237', direction=, offset=, price=1.2, volume=10, time='10:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='238', tradeid='238', direction=, offset=, price=2.0, volume=10, time='10:39:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='239', tradeid='239', direction=, offset=, price=1.0, volume=10, time='10:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='240', tradeid='240', direction=, offset=, price=2.8, volume=10, time='10:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='241', tradeid='241', direction=, offset=, price=1.6, volume=10, time='10:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='242', tradeid='242', direction=, offset=, price=3.0, volume=10, time='11:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='243', tradeid='243', direction=, offset=, price=3.2, volume=10, time='11:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='244', tradeid='244', direction=, offset=, price=1.4, volume=10, time='13:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='245', tradeid='245', direction=, offset=, price=2.8, volume=10, time='13:09:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='246', tradeid='246', direction=, offset=, price=2.6, volume=10, time='13:40:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='247', tradeid='247', direction=, offset=, price=1.6, volume=10, time='13:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='248', tradeid='248', direction=, offset=, price=1.4, volume=10, time='13:46:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='249', tradeid='249', direction=, offset=, price=2.6, volume=10, time='13:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='250', tradeid='250', direction=, offset=, price=3.0, volume=10, time='13:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='251', tradeid='251', direction=, offset=, price=3.4, volume=10, time='13:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='252', tradeid='252', direction=, offset=, price=1.8, volume=10, time='14:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='253', tradeid='253', direction=, offset=, price=2.6, volume=10, time='14:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='254', tradeid='254', direction=, offset=, price=1.0, volume=10, time='09:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='255', tradeid='255', direction=, offset=, price=2.2, volume=10, time='09:37:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='256', tradeid='256', direction=, offset=, price=2.2, volume=10, time='09:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='257', tradeid='257', direction=, offset=, price=1.8, volume=10, time='09:59:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='258', tradeid='258', direction=, offset=, price=2.4, volume=10, time='10:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='259', tradeid='259', direction=, offset=, price=2.6, volume=10, time='10:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='260', tradeid='260', direction=, offset=, price=3.0, volume=10, time='10:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='261', tradeid='261', direction=, offset=, price=2.8, volume=10, time='10:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='262', tradeid='262', direction=, offset=, price=2.0, volume=10, time='11:11:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='263', tradeid='263', direction=, offset=, price=1.6, volume=10, time='11:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='264', tradeid='264', direction=, offset=, price=2.4, volume=10, time='11:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='265', tradeid='265', direction=, offset=, price=2.8, volume=10, time='11:17:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='266', tradeid='266', direction=, offset=, price=2.8, volume=10, time='11:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='267', tradeid='267', direction=, offset=, price=2.0, volume=10, time='11:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='268', tradeid='268', direction=, offset=, price=2.8, volume=10, time='13:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='269', tradeid='269', direction=, offset=, price=3.0, volume=10, time='13:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='270', tradeid='270', direction=, offset=, price=2.4, volume=10, time='14:12:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='271', tradeid='271', direction=, offset=, price=2.0, volume=10, time='14:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='272', tradeid='272', direction=, offset=, price=2.8, volume=10, time='14:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='273', tradeid='273', direction=, offset=, price=2.6, volume=10, time='14:43:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='274', tradeid='274', direction=, offset=, price=2.6, volume=10, time='09:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='275', tradeid='275', direction=, offset=, price=2.0, volume=10, time='09:34:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='276', tradeid='276', direction=, offset=, price=3.8, volume=10, time='09:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='277', tradeid='277', direction=, offset=, price=3.6, volume=10, time='09:51:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='278', tradeid='278', direction=, offset=, price=3.4, volume=10, time='10:06:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='279', tradeid='279', direction=, offset=, price=2.8, volume=10, time='10:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='280', tradeid='280', direction=, offset=, price=3.6, volume=10, time='10:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='281', tradeid='281', direction=, offset=, price=3.2, volume=10, time='10:20:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='282', tradeid='282', direction=, offset=, price=4.6, volume=10, time='10:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='283', tradeid='283', direction=, offset=, price=4.2, volume=10, time='10:42:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='284', tradeid='284', direction=, offset=, price=3.4, volume=10, time='10:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='285', tradeid='285', direction=, offset=, price=2.8, volume=10, time='11:09:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='286', tradeid='286', direction=, offset=, price=3.2, volume=10, time='11:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='287', tradeid='287', direction=, offset=, price=4.6, volume=10, time='11:26:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='288', tradeid='288', direction=, offset=, price=3.8, volume=10, time='11:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='289', tradeid='289', direction=, offset=, price=3.4, volume=10, time='13:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='290', tradeid='290', direction=, offset=, price=4.0, volume=10, time='13:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='291', tradeid='291', direction=, offset=, price=3.6, volume=10, time='13:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='292', tradeid='292', direction=, offset=, price=4.2, volume=10, time='13:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='293', tradeid='293', direction=, offset=, price=4.2, volume=10, time='13:48:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='294', tradeid='294', direction=, offset=, price=4.6, volume=10, time='14:47:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='295', tradeid='295', direction=, offset=, price=4.4, volume=10, time='14:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='296', tradeid='296', direction=, offset=, price=3.6, volume=10, time='10:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='297', tradeid='297', direction=, offset=, price=4.2, volume=10, time='10:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='298', tradeid='298', direction=, offset=, price=4.2, volume=10, time='11:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='299', tradeid='299', direction=, offset=, price=4.2, volume=10, time='11:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='300', tradeid='300', direction=, offset=, price=4.0, volume=10, time='13:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='301', tradeid='301', direction=, offset=, price=3.6, volume=10, time='13:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='302', tradeid='302', direction=, offset=, price=3.6, volume=10, time='13:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='303', tradeid='303', direction=, offset=, price=4.4, volume=10, time='13:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='304', tradeid='304', direction=, offset=, price=3.8, volume=10, time='13:47:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='305', tradeid='305', direction=, offset=, price=3.2, volume=10, time='13:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='306', tradeid='306', direction=, offset=, price=2.8, volume=10, time='14:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='307', tradeid='307', direction=, offset=, price=2.8, volume=10, time='14:34:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='308', tradeid='308', direction=, offset=, price=4.6, volume=10, time='14:40:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='309', tradeid='309', direction=, offset=, price=4.2, volume=10, time='14:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='310', tradeid='310', direction=, offset=, price=3.0, volume=10, time='09:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='311', tradeid='311', direction=, offset=, price=4.0, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='312', tradeid='312', direction=, offset=, price=3.6, volume=10, time='09:40:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='313', tradeid='313', direction=, offset=, price=4.2, volume=10, time='09:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='314', tradeid='314', direction=, offset=, price=4.2, volume=10, time='10:09:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='315', tradeid='315', direction=, offset=, price=2.2, volume=10, time='10:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='316', tradeid='316', direction=, offset=, price=3.6, volume=10, time='10:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='317', tradeid='317', direction=, offset=, price=4.2, volume=10, time='10:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='318', tradeid='318', direction=, offset=, price=4.2, volume=10, time='11:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='319', tradeid='319', direction=, offset=, price=4.2, volume=10, time='11:17:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='320', tradeid='320', direction=, offset=, price=4.0, volume=10, time='11:21:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='321', tradeid='321', direction=, offset=, price=3.6, volume=10, time='11:22:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='322', tradeid='322', direction=, offset=, price=4.0, volume=10, time='11:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='323', tradeid='323', direction=, offset=, price=3.6, volume=10, time='11:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='324', tradeid='324', direction=, offset=, price=2.8, volume=10, time='13:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='325', tradeid='325', direction=, offset=, price=2.4, volume=10, time='13:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='326', tradeid='326', direction=, offset=, price=2.2, volume=10, time='13:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='327', tradeid='327', direction=, offset=, price=3.0, volume=10, time='13:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='328', tradeid='328', direction=, offset=, price=2.2, volume=10, time='14:14:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='329', tradeid='329', direction=, offset=, price=3.2, volume=10, time='14:17:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='330', tradeid='330', direction=, offset=, price=3.2, volume=10, time='14:34:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='331', tradeid='331', direction=, offset=, price=1.6, volume=10, time='14:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='332', tradeid='332', direction=, offset=, price=3.2, volume=10, time='14:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='333', tradeid='333', direction=, offset=, price=1.4, volume=10, time='14:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='334', tradeid='334', direction=, offset=, price=2.6, volume=10, time='09:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='335', tradeid='335', direction=, offset=, price=1.6, volume=10, time='09:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='336', tradeid='336', direction=, offset=, price=2.6, volume=10, time='09:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='337', tradeid='337', direction=, offset=, price=2.2, volume=10, time='09:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='338', tradeid='338', direction=, offset=, price=2.0, volume=10, time='10:39:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='339', tradeid='339', direction=, offset=, price=1.6, volume=10, time='10:40:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='340', tradeid='340', direction=, offset=, price=3.0, volume=10, time='10:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='341', tradeid='341', direction=, offset=, price=3.2, volume=10, time='11:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='342', tradeid='342', direction=, offset=, price=2.0, volume=10, time='11:10:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='343', tradeid='343', direction=, offset=, price=2.8, volume=10, time='11:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='344', tradeid='344', direction=, offset=, price=2.6, volume=10, time='11:29:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='345', tradeid='345', direction=, offset=, price=2.6, volume=10, time='13:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='346', tradeid='346', direction=, offset=, price=2.8, volume=10, time='13:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='347', tradeid='347', direction=, offset=, price=3.2, volume=10, time='13:05:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='348', tradeid='348', direction=, offset=, price=1.8, volume=10, time='13:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='349', tradeid='349', direction=, offset=, price=2.6, volume=10, time='13:36:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='350', tradeid='350', direction=, offset=, price=1.8, volume=10, time='13:40:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='351', tradeid='351', direction=, offset=, price=2.4, volume=10, time='13:41:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='352', tradeid='352', direction=, offset=, price=2.2, volume=10, time='13:44:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='353', tradeid='353', direction=, offset=, price=2.4, volume=10, time='13:46:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='354', tradeid='354', direction=, offset=, price=3.6, volume=10, time='13:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='355', tradeid='355', direction=, offset=, price=2.6, volume=10, time='13:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='356', tradeid='356', direction=, offset=, price=2.8, volume=10, time='14:23:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='357', tradeid='357', direction=, offset=, price=3.0, volume=10, time='14:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='358', tradeid='358', direction=, offset=, price=2.8, volume=10, time='14:39:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='359', tradeid='359', direction=, offset=, price=2.6, volume=10, time='14:40:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='360', tradeid='360', direction=, offset=, price=2.4, volume=10, time='09:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='361', tradeid='361', direction=, offset=, price=2.4, volume=10, time='09:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='362', tradeid='362', direction=, offset=, price=1.2, volume=10, time='10:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='363', tradeid='363', direction=, offset=, price=2.6, volume=10, time='10:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='364', tradeid='364', direction=, offset=, price=1.8, volume=10, time='10:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='365', tradeid='365', direction=, offset=, price=1.8, volume=10, time='10:11:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='366', tradeid='366', direction=, offset=, price=1.8, volume=10, time='10:16:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='367', tradeid='367', direction=, offset=, price=1.8, volume=10, time='10:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='368', tradeid='368', direction=, offset=, price=2.2, volume=10, time='10:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='369', tradeid='369', direction=, offset=, price=1.2, volume=10, time='10:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='370', tradeid='370', direction=, offset=, price=0.8, volume=10, time='11:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='371', tradeid='371', direction=, offset=, price=1.2, volume=10, time='11:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='372', tradeid='372', direction=, offset=, price=0.6, volume=10, time='14:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='373', tradeid='373', direction=, offset=, price=0.6, volume=10, time='14:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='374', tradeid='374', direction=, offset=, price=0.2, volume=10, time='14:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='375', tradeid='375', direction=, offset=, price=0.2, volume=10, time='14:14:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='376', tradeid='376', direction=, offset=, price=0.4, volume=10, time='14:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='377', tradeid='377', direction=, offset=, price=1.4, volume=10, time='14:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='378', tradeid='378', direction=, offset=, price=0.8, volume=10, time='10:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='379', tradeid='379', direction=, offset=, price=0.8, volume=10, time='10:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='380', tradeid='380', direction=, offset=, price=1.6, volume=10, time='10:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='381', tradeid='381', direction=, offset=, price=0.8, volume=10, time='10:35:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='382', tradeid='382', direction=, offset=, price=0.2, volume=10, time='11:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='383', tradeid='383', direction=, offset=, price=1.0, volume=10, time='11:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='384', tradeid='384', direction=, offset=, price=1.2, volume=10, time='11:15:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='385', tradeid='385', direction=, offset=, price=1.2, volume=10, time='11:17:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='386', tradeid='386', direction=, offset=, price=0.4, volume=10, time='13:07:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='387', tradeid='387', direction=, offset=, price=0.4, volume=10, time='13:09:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='388', tradeid='388', direction=, offset=, price=1.2, volume=10, time='13:49:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='389', tradeid='389', direction=, offset=, price=0.6, volume=10, time='13:51:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='390', tradeid='390', direction=, offset=, price=1.6, volume=10, time='14:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='391', tradeid='391', direction=, offset=, price=0.6, volume=10, time='14:29:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='392', tradeid='392', direction=, offset=, price=1.8, volume=10, time='14:54:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='393', tradeid='393', direction=, offset=, price=2.8, volume=10, time='14:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='394', tradeid='394', direction=, offset=, price=2.6, volume=10, time='14:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='395', tradeid='395', direction=, offset=, price=1.6, volume=10, time='09:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='396', tradeid='396', direction=, offset=, price=1.2, volume=10, time='10:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='397', tradeid='397', direction=, offset=, price=1.4, volume=10, time='10:03:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='398', tradeid='398', direction=, offset=, price=1.6, volume=10, time='10:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='399', tradeid='399', direction=, offset=, price=0.4, volume=10, time='10:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='400', tradeid='400', direction=, offset=, price=0.2, volume=10, time='10:20:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='401', tradeid='401', direction=, offset=, price=2.2, volume=10, time='10:27:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='402', tradeid='402', direction=, offset=, price=1.6, volume=10, time='10:28:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='403', tradeid='403', direction=, offset=, price=1.0, volume=10, time='10:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='404', tradeid='404', direction=, offset=, price=1.4, volume=10, time='10:58:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='405', tradeid='405', direction=, offset=, price=1.0, volume=10, time='11:08:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='406', tradeid='406', direction=, offset=, price=0.8, volume=10, time='11:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='407', tradeid='407', direction=, offset=, price=0.4, volume=10, time='11:19:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='408', tradeid='408', direction=, offset=, price=2.0, volume=10, time='13:10:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='409', tradeid='409', direction=, offset=, price=1.2, volume=10, time='13:13:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='410', tradeid='410', direction=, offset=, price=2.4, volume=10, time='14:00:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='411', tradeid='411', direction=, offset=, price=0.8, volume=10, time='14:02:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='412', tradeid='412', direction=, offset=, price=1.4, volume=10, time='14:24:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='413', tradeid='413', direction=, offset=, price=1.4, volume=10, time='14:25:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='414', tradeid='414', direction=, offset=, price=1.0, volume=10, time='14:38:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='415', tradeid='415', direction=, offset=, price=1.0, volume=10, time='14:44:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='416', tradeid='416', direction=, offset=, price=1.6, volume=10, time='14:50:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='417', tradeid='417', direction=, offset=, price=2.2, volume=10, time='14:55:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='418', tradeid='418', direction=, offset=, price=2.2, volume=10, time='14:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='419', tradeid='419', direction=, offset=, price=1.0, volume=10, time='09:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='420', tradeid='420', direction=, offset=, price=2.2, volume=10, time='10:17:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='421', tradeid='421', direction=, offset=, price=1.0, volume=10, time='10:18:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='422', tradeid='422', direction=, offset=, price=2.4, volume=10, time='10:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='423', tradeid='423', direction=, offset=, price=0.6, volume=10, time='10:32:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='424', tradeid='424', direction=, offset=, price=2.0, volume=10, time='10:52:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='425', tradeid='425', direction=, offset=, price=1.0, volume=10, time='10:56:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='426', tradeid='426', direction=, offset=, price=0.8, volume=10, time='13:01:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='427', tradeid='427', direction=, offset=, price=1.4, volume=10, time='13:04:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='428', tradeid='428', direction=, offset=, price=1.8, volume=10, time='13:31:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='429', tradeid='429', direction=, offset=, price=0.8, volume=10, time='13:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='430', tradeid='430', direction=, offset=, price=1.4, volume=10, time='13:45:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='431', tradeid='431', direction=, offset=, price=1.0, volume=10, time='13:46:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='432', tradeid='432', direction=, offset=, price=2.2, volume=10, time='14:30:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='433', tradeid='433', direction=, offset=, price=1.8, volume=10, time='14:33:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='434', tradeid='434', direction=, offset=, price=2.0, volume=10, time='14:53:00')\n", + "TradeData(gateway_name='BACKTESTING', symbol='IF-Spread', exchange=, orderid='435', tradeid='435', direction=, offset=, price=2.0, volume=10, time='14:54:00')\n" + ] + } + ], "source": [ "for trade in engine.trades.values():\n", " print(trade)" diff --git a/vnpy/app/cta_strategy/engine.py b/vnpy/app/cta_strategy/engine.py index fbd64f04..01f16c05 100644 --- a/vnpy/app/cta_strategy/engine.py +++ b/vnpy/app/cta_strategy/engine.py @@ -628,8 +628,6 @@ class CtaEngine(BaseEngine): """ strategy = self.strategies[strategy_name] - print(datetime.now(), strategy_name, strategy.vt_symbol) - if strategy.inited: self.write_log(f"{strategy_name}已经完成初始化,禁止重复操作") return diff --git a/vnpy/app/spread_trading/backtesting.py b/vnpy/app/spread_trading/backtesting.py index b87f53c9..50d55d73 100644 --- a/vnpy/app/spread_trading/backtesting.py +++ b/vnpy/app/spread_trading/backtesting.py @@ -1,7 +1,6 @@ from collections import defaultdict from datetime import date, datetime -from typing import Callable, Type, Dict, List -from functools import lru_cache +from typing import Callable, Type import numpy as np import matplotlib.pyplot as plt @@ -10,12 +9,10 @@ from pandas import DataFrame from vnpy.trader.constant import (Direction, Offset, Exchange, Interval, Status) -from vnpy.trader.database import database_manager from vnpy.trader.object import TradeData, BarData, TickData -from vnpy.trader.utility import round_to from .template import SpreadStrategyTemplate, SpreadAlgoTemplate -from .base import SpreadData, BacktestingMode +from .base import SpreadData, BacktestingMode, load_bar_data, load_tick_data sns.set_style("whitegrid") @@ -686,73 +683,3 @@ class DailyResult: # Net pnl takes account of commission and slippage cost self.total_pnl = self.trading_pnl + self.holding_pnl self.net_pnl = self.total_pnl - self.commission - self.slippage - - -@lru_cache(maxsize=999) -def load_bar_data( - spread: SpreadData, - interval: Interval, - start: datetime, - end: datetime, - pricetick: float -): - """""" - # Load bar data of each spread leg - leg_bars: Dict[str, Dict] = {} - - for vt_symbol in spread.legs.keys(): - symbol, exchange_str = vt_symbol.split(".") - exchange = Exchange(exchange_str) - - bar_data: List[BarData] = database_manager.load_bar_data( - symbol, exchange, interval, start, end - ) - - bars: Dict[datetime, BarData] = {bar.datetime: bar for bar in bar_data} - leg_bars[vt_symbol] = bars - - # Calculate spread bar data - spread_bars: List[BarData] = [] - - for dt in bars.keys(): - spread_price = 0 - spread_available = True - - for leg in spread.legs.values(): - leg_bar = leg_bars[leg.vt_symbol].get(dt, None) - - if leg_bar: - price_multiplier = spread.price_multipliers[leg.vt_symbol] - spread_price += price_multiplier * leg_bar.close_price - else: - spread_available = False - - if spread_available: - spread_price = round_to(spread_price, pricetick) - - spread_bar = BarData( - symbol=spread.name, - exchange=exchange.LOCAL, - datetime=dt, - interval=interval, - open_price=spread_price, - high_price=spread_price, - low_price=spread_price, - close_price=spread_price, - gateway_name=BacktestingEngine.gateway_name, - ) - spread_bars.append(spread_bar) - - return spread_bars - - -@lru_cache(maxsize=999) -def load_tick_data( - spread: SpreadData, - start: datetime, - end: datetime -): - """""" - return database_manager.load_tick_data( - spread.name, Exchange.LOCAL, start, end - ) diff --git a/vnpy/app/spread_trading/base.py b/vnpy/app/spread_trading/base.py index cace98f3..1b84f89d 100644 --- a/vnpy/app/spread_trading/base.py +++ b/vnpy/app/spread_trading/base.py @@ -1,10 +1,14 @@ from typing import Dict, List from datetime import datetime from enum import Enum +from functools import lru_cache -from vnpy.trader.object import TickData, PositionData, TradeData, ContractData -from vnpy.trader.constant import Direction, Offset, Exchange -from vnpy.trader.utility import floor_to, ceil_to +from vnpy.trader.object import ( + TickData, PositionData, TradeData, ContractData, BarData +) +from vnpy.trader.constant import Direction, Offset, Exchange, Interval +from vnpy.trader.utility import floor_to, ceil_to, round_to, extract_vt_symbol +from vnpy.trader.database import database_manager EVENT_SPREAD_DATA = "eSpreadData" @@ -353,3 +357,73 @@ def calculate_inverse_volume( class BacktestingMode(Enum): BAR = 1 TICK = 2 + + +@lru_cache(maxsize=999) +def load_bar_data( + spread: SpreadData, + interval: Interval, + start: datetime, + end: datetime, + pricetick: float = 0 +): + """""" + # Load bar data of each spread leg + leg_bars: Dict[str, Dict] = {} + + for vt_symbol in spread.legs.keys(): + symbol, exchange = extract_vt_symbol(vt_symbol) + + bar_data: List[BarData] = database_manager.load_bar_data( + symbol, exchange, interval, start, end + ) + + bars: Dict[datetime, BarData] = {bar.datetime: bar for bar in bar_data} + leg_bars[vt_symbol] = bars + + # Calculate spread bar data + spread_bars: List[BarData] = [] + + for dt in bars.keys(): + spread_price = 0 + spread_available = True + + for leg in spread.legs.values(): + leg_bar = leg_bars[leg.vt_symbol].get(dt, None) + + if leg_bar: + price_multiplier = spread.price_multipliers[leg.vt_symbol] + spread_price += price_multiplier * leg_bar.close_price + else: + spread_available = False + + if spread_available: + if pricetick: + spread_price = round_to(spread_price, pricetick) + + spread_bar = BarData( + symbol=spread.name, + exchange=exchange.LOCAL, + datetime=dt, + interval=interval, + open_price=spread_price, + high_price=spread_price, + low_price=spread_price, + close_price=spread_price, + gateway_name="SPREAD", + ) + spread_bars.append(spread_bar) + + return spread_bars + + +@lru_cache(maxsize=999) +def load_tick_data( + spread: SpreadData, + start: datetime, + end: datetime +): + """""" + return database_manager.load_tick_data( + spread.name, Exchange.LOCAL, start, end + ) diff --git a/vnpy/app/spread_trading/engine.py b/vnpy/app/spread_trading/engine.py index 8550e0de..65902642 100644 --- a/vnpy/app/spread_trading/engine.py +++ b/vnpy/app/spread_trading/engine.py @@ -5,6 +5,7 @@ from typing import List, Dict, Set, Callable, Any, Type from collections import defaultdict from copy import copy from pathlib import Path +from datetime import datetime, timedelta from vnpy.event import EventEngine, Event from vnpy.trader.engine import BaseEngine, MainEngine @@ -17,14 +18,17 @@ from vnpy.trader.object import ( TickData, ContractData, LogData, SubscribeRequest, OrderRequest ) -from vnpy.trader.constant import Direction, Offset, OrderType +from vnpy.trader.constant import ( + Direction, Offset, OrderType, Interval +) from vnpy.trader.converter import OffsetConverter from .base import ( LegData, SpreadData, EVENT_SPREAD_DATA, EVENT_SPREAD_POS, EVENT_SPREAD_ALGO, EVENT_SPREAD_LOG, - EVENT_SPREAD_STRATEGY + EVENT_SPREAD_STRATEGY, + load_bar_data, load_tick_data ) from .template import SpreadAlgoTemplate, SpreadStrategyTemplate from .algo import SpreadTakerAlgo @@ -1024,3 +1028,25 @@ class SpreadStrategyEngine: subject = "价差策略引擎" self.main_engine.send_email(subject, msg) + + def load_bar( + self, spread: SpreadData, days: int, interval: Interval, callback: Callable + ): + """""" + end = datetime.now() + start = end - timedelta(days) + + bars = load_bar_data(spread, interval, start, end) + + for bar in bars: + callback(bar) + + def load_tick(self, spread: SpreadData, days: int, callback: Callable): + """""" + end = datetime.now() + start = end - timedelta(days) + + ticks = load_tick_data(spread, start, end) + + for tick in ticks: + callback(tick)