vnpy/examples/TurtleStrategy/run.ipynb

1318 lines
62 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"\n",
"from datetime import datetime\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from turtleEngine import BacktestingEngine"
]
},
{
"cell_type": "code",
2018-11-11 07:25:59 +00:00
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16:03:53.281000:\t投资组合的合约代码['000300', '000905']\n",
"16:03:53.281000:\t投资组合的初始价值10000000\n"
]
}
],
"source": [
"engine = BacktestingEngine()\n",
"engine.setPeriod(datetime(2015, 1, 1), datetime(2018, 11, 9))\n",
"engine.initPortfolio('test.csv', 10000000)"
]
},
{
"cell_type": "code",
2018-11-11 07:25:59 +00:00
"execution_count": 3,
"metadata": {
"scrolled": false
},
2018-11-11 07:25:59 +00:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"16:03:53.421000:\t000300数据加载完成总数据量2820\n",
"16:03:53.455000:\t000905数据加载完成总数据量940\n",
"16:03:53.455000:\t全部数据加载完成\n",
"16:03:53.457000:\t开始回放K线数据\n",
"16:03:53.575000:\tK线数据回放结束\n",
"16:03:53.576000:\t开始统计回测结果\n",
"16:03:53.582000:\t回测结果统计结束\n"
2018-11-11 07:25:59 +00:00
]
}
],
"source": [
"engine.loadData()\n",
"engine.runBacktesting()\n",
"engine.calculateResult()"
]
},
{
"cell_type": "code",
2018-11-11 07:25:59 +00:00
"execution_count": 4,
"metadata": {},
2018-11-11 07:25:59 +00:00
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x9a6e290>]"
2018-11-11 07:25:59 +00:00
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEDCAYAAAAhsS8XAAAABHN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9uEwxgiHAaHw/3njJxU5o7uPBZ/R0l1F0dzKyyvZUhKLMbooqpIqFGwh4n5kwdx7xubefKD3bS4LC3WepfqMwZ+e+V0Lp4yqENQt46THxAfxaGaRibcupjVt5zLwcp6zrx3OT85fyzfOWtUQN6PiPScgj1MXDMnl2vm5HbYZ62lsq6Z0+5Zxvf/sYaYCAfntZtWuNazrusdn5/E9U99Qm1jC3vLa9l32D2z5ZMf7Gbh6SMo2F/FoJSYDgt5i0jw0nDHMGaMITkukuc90xvsOlTT4fnWdV1PGpbK4GT3aJrS6gZu+89GAA5U1jN60etc/NBK8u5YwurdGkEjEgoU7P3AyIx4YiIdndZibW2xx0dH8JevzwSgrKbRu8jIkTQ0UiQ0KNj7gdZVoQ5WtgV7i8vy2rr9AMRGOhmQ4J5F8kBFPRFOB1Oz22a0/OG80QB8tte/N0uJiG+oj72fGJkR712/df2+Cm59aT2fFVYA7lE1A+KjyEqK5o5XNwFw5pgMXvpO2wyVuw/VsnJbKdZajDHsLaslPSGaDUUVNDa7jjkDpoj0LQV7P3HSsFTe3lxCcVU9F/1uZafnjTHcf8U0vvynj4C2Zf9azchJ4YU1+7jvrS1MHpLMwidXd3j+40XnkJmoycpEgoG6YvqJGcNSAVj0wvqjlpkzKp17vjCF4enxnDUus8NzraNpfrdsW6dQB8jfVe7D2opIbyjY+4nWqYI3FlV22L/sxjM6bF+Rl83bN53JyIyEDvuzkmI6lL3
2018-11-11 07:25:59 +00:00
"text/plain": [
"<matplotlib.figure.Figure at 0x9a1c790>"
2018-11-11 07:25:59 +00:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# 汇总每日盈亏,绘制简单资金曲线\n",
"l = [result.totalPnl for result in engine.resultList]\n",
"equity = np.cumsum(l)\n",
"plt.plot(equity)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2015-04-07 00:00:00\n",
"000300 多 开仓 4213.8 1216\n",
"000300 多 开仓 4213.8 1216\n",
"000300 多 开仓 4252.8 1216\n",
"000905 多 开仓 7728.9 831\n",
"000905 多 开仓 7742.9 831\n",
"000905 多 开仓 7803.1 831\n",
"000905 多 开仓 7863.3 831\n",
"2015-04-08 00:00:00\n",
"000300 多 开仓 4294.0 1216\n",
"2015-04-09 00:00:00\n",
"000905 空 平仓 7622.5 3324\n",
"2015-04-10 00:00:00\n",
"000905 多 开仓 7921.0 712\n",
"2015-04-13 00:00:00\n",
"000905 多 开仓 7994.3 712\n",
"000905 多 开仓 8061.4 712\n",
"000905 多 开仓 8131.6 712\n",
"2015-04-15 00:00:00\n",
"000905 空 平仓 7850.8 2848\n",
"2015-04-22 00:00:00\n",
"000905 多 开仓 8192.2 570\n",
"000905 多 开仓 8280.0 570\n",
"2015-04-23 00:00:00\n",
"000905 多 开仓 8371.9 570\n",
"2015-04-27 00:00:00\n",
"000905 多 开仓 8503.6 570\n",
"2015-05-06 00:00:00\n",
"000905 空 平仓 8152.6 2280\n",
"2015-05-07 00:00:00\n",
"000300 空 平仓 4511.8 4864\n",
"2015-05-12 00:00:00\n",
"000905 多 开仓 8595.1 472\n",
"000905 多 开仓 8682.4 472\n",
"2015-05-13 00:00:00\n",
"000905 多 开仓 8788.3 472\n",
"000905 多 开仓 8894.2 472\n",
"2015-06-05 00:00:00\n",
"000300 多 开仓 5255.0 691\n",
"2015-06-08 00:00:00\n",
"000300 多 开仓 5299.2 691\n",
"2015-06-09 00:00:00\n",
"000300 多 开仓 5379.4 691\n",
"2015-06-16 00:00:00\n",
"000300 空 平仓 5090.0 2073\n",
"2015-06-19 00:00:00\n",
"000300 空 开仓 4665.6 657\n",
"000905 空 平仓 10475.9 1888\n",
"2015-06-23 00:00:00\n",
"000300 空 开仓 4589.4 657\n",
"000300 空 开仓 4513.2 657\n",
"2015-06-24 00:00:00\n",
"000300 多 平仓 4817.8 1971\n",
"2015-06-26 00:00:00\n",
"000300 空 开仓 4455.4 585\n",
"000300 空 开仓 4369.8 585\n",
"000300 空 开仓 4284.2 585\n",
"000905 空 开仓 9333.9 246\n",
"000905 空 开仓 9130.6 246\n",
"2015-06-29 00:00:00\n",
"000300 空 开仓 4198.8 585\n",
"000905 空 开仓 8927.2 246\n",
"000905 空 开仓 8723.9 246\n",
"2015-07-20 00:00:00\n",
"000905 多 平仓 8076.2 984\n",
"2015-07-24 00:00:00\n",
"000300 多 平仓 4278.2 2340\n",
"2015-08-24 00:00:00\n",
"000300 空 开仓 3454.6 583\n",
"000300 空 开仓 3452.2 583\n",
"000300 空 开仓 3366.4 583\n",
"000300 空 开仓 3280.6 583\n",
"000905 空 开仓 7255.3 238\n",
"000905 空 开仓 7051.4 238\n",
"2015-08-25 00:00:00\n",
"000905 空 开仓 6496.1 238\n",
"000905 空 开仓 6496.1 238\n",
"2015-10-08 00:00:00\n",
"000905 多 平仓 6362.0 952\n",
"2015-10-12 00:00:00\n",
"000300 多 平仓 3426.6 2332\n",
"2015-11-20 00:00:00\n",
"000905 多 开仓 7820.0 440\n",
"2015-11-26 00:00:00\n",
"000905 多 开仓 7962.2 440\n",
"2015-11-27 00:00:00\n",
"000905 空 平仓 7507.3 880\n",
"2015-12-23 00:00:00\n",
"000300 多 开仓 3891.8 1293\n",
"2015-12-28 00:00:00\n",
"000300 空 平仓 3737.2 1293\n",
"2016-01-04 00:00:00\n",
"000300 空 开仓 3571.0 1369\n",
"000300 空 开仓 3534.4 1369\n",
"000300 空 开仓 3498.0 1369\n",
"2016-01-05 00:00:00\n",
"000300 空 开仓 3382.2 1369\n",
"000905 空 开仓 6663.7 540\n",
"2016-01-06 00:00:00\n",
"000300 多 平仓 3528.2 5476\n",
"000905 多 平仓 7034.2 540\n",
"2016-01-07 00:00:00\n",
"000300 空 开仓 3377.2 1175\n",
"000300 空 开仓 3334.8 1175\n",
"000300 空 开仓 3292.2 1175\n",
"000905 空 开仓 6627.6 510\n",
"000905 空 开仓 6529.6 510\n",
"2016-01-08 00:00:00\n",
"000300 空 开仓 3249.6 1175\n",
"000905 空 开仓 6431.5 510\n",
"000905 空 开仓 6333.5 510\n",
"2016-02-17 00:00:00\n",
"000300 多 平仓 3042.0 4700\n",
"2016-03-07 00:00:00\n",
"000300 多 开仓 3128.2 1169\n",
"2016-03-18 00:00:00\n",
"000300 多 开仓 3171.0 1169\n",
"2016-03-21 00:00:00\n",
"000300 多 开仓 3213.8 1169\n",
"000300 多 开仓 3256.6 1169\n",
"2016-03-22 00:00:00\n",
"000905 多 平仓 6118.6 2040\n",
"2016-04-06 00:00:00\n",
"000905 多 开仓 6293.5 551\n",
"2016-04-13 00:00:00\n",
"000905 多 开仓 6384.2 551\n",
"2016-04-20 00:00:00\n",
"000300 空 平仓 3163.4 4676\n",
"000905 空 平仓 6021.3 1102\n",
"2016-04-28 00:00:00\n",
"000905 空 开仓 5897.7 682\n",
"2016-05-04 00:00:00\n",
"000905 多 平仓 6191.1 682\n",
"2016-05-09 00:00:00\n",
"000300 空 开仓 3107.4 1914\n",
"000300 空 开仓 3081.2 1914\n",
"000300 空 开仓 3055.2 1914\n",
"000905 空 开仓 5888.1 689\n",
"000905 空 开仓 5815.5 689\n",
"000905 空 开仓 5743.0 689\n",
"2016-05-12 00:00:00\n",
"000905 空 开仓 5647.1 689\n",
"2016-05-26 00:00:00\n",
"000300 空 开仓 3029.0 1914\n",
"2016-05-31 00:00:00\n",
"000300 多 平仓 3105.2 7656\n",
"000905 多 平仓 5853.6 2756\n",
"2016-06-06 00:00:00\n",
"000905 多 开仓 6062.1 802\n",
"2016-06-13 00:00:00\n",
"000905 空 平仓 5812.8 802\n",
"2016-06-28 00:00:00\n",
"000905 多 开仓 6067.5 765\n",
"2016-06-29 00:00:00\n",
"000905 多 开仓 6132.8 765\n",
"2016-07-04 00:00:00\n",
"000300 多 开仓 3201.8 2407\n",
"000905 多 开仓 6198.1 765\n",
"2016-07-05 00:00:00\n",
"000905 多 开仓 6263.5 765\n",
"2016-07-11 00:00:00\n",
"000300 多 开仓 3222.6 2407\n",
"2016-07-12 00:00:00\n",
"000300 多 开仓 3243.2 2407\n",
"000300 多 开仓 3264.0 2407\n",
"2016-07-27 00:00:00\n",
"000300 空 平仓 3218.2 9628\n",
"000905 空 平仓 6355.5 3060\n",
"2016-08-12 00:00:00\n",
"000300 多 开仓 3285.0 2688\n",
"2016-08-15 00:00:00\n",
"000300 多 开仓 3303.6 2688\n",
"000300 多 开仓 3322.2 2688\n",
"000300 多 开仓 3340.8 2688\n",
"2016-08-18 00:00:00\n",
"000905 多 开仓 6515.9 1048\n",
"2016-08-25 00:00:00\n",
"000905 空 平仓 6325.1 1048\n",
"2016-09-07 00:00:00\n",
"000905 多 开仓 6527.2 1183\n",
"2016-09-12 00:00:00\n",
"000300 空 平仓 3271.8 10752\n",
"000905 空 平仓 6358.1 1183\n",
"2016-09-14 00:00:00\n",
"000300 空 开仓 3234.6 2753\n",
"000905 空 开仓 6283.8 1196\n",
"2016-09-26 00:00:00\n",
"000905 空 开仓 6242.0 1196\n",
"2016-09-27 00:00:00\n",
"000300 空 开仓 3214.8 2753\n",
"2016-10-10 00:00:00\n",
"000300 多 平仓 3287.6 5506\n",
"000905 多 平仓 6409.3 2392\n",
"2016-10-19 00:00:00\n",
"000300 多 开仓 3323.4 3238\n",
"000905 多 开仓 6518.7 1396\n",
"2016-10-21 00:00:00\n",
"000300 多 开仓 3336.8 3238\n",
"2016-10-24 00:00:00\n",
"000300 多 开仓 3352.2 3238\n",
"000300 多 开仓 3367.6 3238\n",
"000905 多 开仓 6545.1 1396\n",
"2016-11-09 00:00:00\n",
"000905 空 平仓 6408.3 2792\n",
"2016-11-11 00:00:00\n",
"000905 多 开仓 6563.5 1494\n",
"2016-11-14 00:00:00\n",
"000905 多 开仓 6597.0 1494\n",
"2016-11-15 00:00:00\n",
"000905 多 开仓 6630.5 1494\n",
"2016-11-23 00:00:00\n",
"000905 多 开仓 6668.2 1494\n",
"2016-11-25 00:00:00\n",
"000905 空 平仓 6534.4 5976\n",
"2016-11-28 00:00:00\n",
"000905 多 开仓 6676.7 1609\n",
"2016-12-02 00:00:00\n",
"000905 空 平仓 6552.3 1609\n",
"2016-12-07 00:00:00\n",
"000300 空 平仓 3456.8 12952\n",
"2016-12-12 00:00:00\n",
"000905 空 开仓 6451.1 1691\n",
"000905 空 开仓 6421.5 1691\n",
"000905 空 开仓 6391.9 1691\n",
"000905 空 开仓 6362.4 1691\n",
"2017-01-04 00:00:00\n",
"000905 多 平仓 6350.3 6764\n",
"2017-01-13 00:00:00\n",
"000905 空 开仓 6190.4 1667\n",
"2017-01-16 00:00:00\n",
"000300 空 开仓 3267.0 3205\n",
"000905 空 开仓 6160.4 1667\n",
"000905 空 开仓 6130.4 1667\n",
"000905 空 开仓 6100.4 1667\n",
"2017-01-18 00:00:00\n",
"000300 多 平仓 3329.4 3205\n",
"2017-01-23 00:00:00\n",
"000300 多 开仓 3373.4 3109\n",
"2017-01-26 00:00:00\n",
"000300 多 开仓 3389.4 3109\n",
"000905 多 平仓 6220.4 6668\n",
"2017-02-09 00:00:00\n",
"000300 多 开仓 3405.6 3109\n",
"2017-02-10 00:00:00\n",
"000300 多 开仓 3421.6 3109\n",
"2017-02-20 00:00:00\n",
"000905 多 开仓 6379.8 1604\n",
"2017-02-21 00:00:00\n",
"000905 多 开仓 6411.0 1604\n",
"2017-02-22 00:00:00\n",
"000905 多 开仓 6442.1 1604\n",
"000905 多 开仓 6473.3 1604\n",
"2017-03-03 00:00:00\n",
"000300 空 平仓 3419.6 12436\n",
"2017-03-24 00:00:00\n",
"000300 多 开仓 3492.2 3692\n",
"2017-03-27 00:00:00\n",
"000300 多 开仓 3505.6 3692\n",
"2017-03-30 00:00:00\n",
"000300 空 平仓 3451.6 7384\n",
"000905 空 平仓 6445.8 6416\n",
"2017-04-06 00:00:00\n",
"000300 多 开仓 3508.0 3433\n",
"000905 多 开仓 6555.8 1628\n",
"2017-04-07 00:00:00\n",
"000300 多 开仓 3520.6 3433\n",
"000905 多 开仓 6586.5 1628\n",
"2017-04-11 00:00:00\n",
"000905 多 开仓 6617.2 1628\n",
"2017-04-17 00:00:00\n",
"000300 空 平仓 3462.2 6866\n",
"000905 空 平仓 6494.4 4884\n",
"2017-04-19 00:00:00\n",
"000300 空 开仓 3422.4 3420\n",
"000905 空 开仓 6365.4 1564\n",
"000905 空 开仓 6333.5 1564\n",
"000905 空 开仓 6301.5 1564\n",
"2017-04-24 00:00:00\n",
"000300 空 开仓 3407.8 3420\n",
"000905 空 开仓 6269.6 1564\n",
"2017-04-26 00:00:00\n",
"000300 多 平仓 3466.2 6840\n",
"2017-04-27 00:00:00\n",
"000300 空 开仓 3404.0 3243\n",
"2017-05-05 00:00:00\n",
"000300 空 开仓 3388.6 3243\n",
"000300 空 开仓 3373.2 3243\n",
"2017-05-08 00:00:00\n",
"000300 空 开仓 3357.8 3243\n",
"2017-05-16 00:00:00\n",
"000300 多 平仓 3419.4 12972\n",
"2017-05-25 00:00:00\n",
"000300 多 开仓 3466.6 3098\n",
"000300 多 开仓 3482.8 3098\n",
"2017-05-31 00:00:00\n",
"000300 多 开仓 3498.8 3098\n",
"000300 多 开仓 3515.0 3098\n",
"2017-06-08 00:00:00\n",
"000905 多 平仓 5955.0 6256\n",
"2017-07-17 00:00:00\n",
"000905 空 开仓 5923.6 1512\n",
"000905 空 开仓 5890.5 1512\n",
"2017-07-18 00:00:00\n",
"000905 空 开仓 5854.1 1512\n",
"2017-07-19 00:00:00\n",
"000905 多 平仓 5986.4 4536\n",
"2017-07-31 00:00:00\n",
"000905 多 开仓 6236.3 1311\n",
"000905 多 开仓 6274.4 1311\n",
"2017-08-02 00:00:00\n",
"000905 多 开仓 6312.5 1311\n",
"2017-08-11 00:00:00\n",
"000300 空 平仓 3688.0 12392\n",
"000905 空 平仓 6166.0 3933\n",
"2017-08-17 00:00:00\n",
"000905 多 开仓 6341.5 1345\n",
"2017-08-21 00:00:00\n",
"000905 多 开仓 6378.7 1345\n",
"2017-08-28 00:00:00\n",
"000905 多 开仓 6415.8 1345\n",
"2017-08-30 00:00:00\n",
"000905 多 开仓 6453.0 1345\n",
"2017-09-25 00:00:00\n",
"000905 空 平仓 6547.3 5380\n",
"2017-11-17 00:00:00\n",
"000905 空 开仓 6395.5 1453\n",
"000905 空 开仓 6361.1 1453\n",
"2017-11-20 00:00:00\n",
"000905 空 开仓 6326.7 1453\n",
"000905 空 开仓 6292.2 1453\n",
"2017-11-21 00:00:00\n",
"000905 多 平仓 6429.9 5812\n",
"2017-11-27 00:00:00\n",
"000905 空 开仓 6239.3 1184\n",
"000905 空 开仓 6197.1 1184\n",
"2017-12-05 00:00:00\n",
"000905 空 开仓 6154.8 1184\n",
"000905 空 开仓 6112.6 1184\n",
"2017-12-11 00:00:00\n",
"000905 多 平仓 6281.6 4736\n",
"2018-01-02 00:00:00\n",
"000300 多 开仓 4087.0 2000\n",
"2018-01-03 00:00:00\n",
"000300 多 开仓 4112.0 2000\n",
"000300 多 开仓 4137.0 2000\n",
"000905 多 开仓 6332.6 1317\n",
"000905 多 开仓 6370.6 1317\n",
"2018-01-04 00:00:00\n",
"000905 多 开仓 6408.6 1317\n",
"2018-01-08 00:00:00\n",
"000300 多 开仓 4162.0 2000\n",
"000905 多 开仓 6446.5 1317\n",
"2018-01-15 00:00:00\n",
"000905 空 平仓 6294.6 5268\n",
"2018-01-31 00:00:00\n",
"000905 空 开仓 6202.3 1466\n",
"2018-02-01 00:00:00\n",
"000300 空 平仓 4232.8 8000\n",
"000905 空 开仓 6168.2 1466\n",
"000905 空 开仓 6134.1 1466\n",
"000905 空 开仓 6100.0 1466\n",
"2018-02-09 00:00:00\n",
"000300 空 开仓 3896.2 1475\n",
"000300 空 开仓 3896.2 1475\n",
"000300 空 开仓 3887.6 1475\n",
"000300 空 开仓 3853.8 1475\n",
"2018-02-22 00:00:00\n",
"000300 多 平仓 4021.0 5900\n",
"2018-02-26 00:00:00\n",
"000905 多 平仓 6016.2 5864\n",
"2018-03-23 00:00:00\n",
"000300 空 开仓 3896.8 1674\n",
"000300 空 开仓 3896.8 1674\n",
"000300 空 开仓 3896.8 1674\n",
"000300 空 开仓 3896.8 1674\n",
"000905 空 开仓 5848.5 1154\n",
"000905 空 开仓 5805.2 1154\n",
"000905 空 开仓 5761.9 1154\n",
"2018-03-26 00:00:00\n",
"000905 空 开仓 5715.4 1154\n",
"2018-03-27 00:00:00\n",
"000905 多 平仓 5956.2 4616\n",
"2018-04-11 00:00:00\n",
"000300 多 平仓 3937.0 6696\n",
"2018-04-16 00:00:00\n",
"000300 空 开仓 3794.2 1598\n",
"2018-04-17 00:00:00\n",
"000300 空 开仓 3763.0 1598\n",
"2018-04-18 00:00:00\n",
"000300 空 开仓 3731.6 1598\n",
"2018-05-08 00:00:00\n",
"000300 多 平仓 3854.4 4794\n",
"2018-05-21 00:00:00\n",
"000300 多 开仓 3925.6 1903\n",
"000905 多 开仓 6052.7 1216\n",
"2018-05-24 00:00:00\n",
"000300 空 平仓 3841.8 1903\n",
"2018-05-25 00:00:00\n",
"000905 空 平仓 5932.1 1216\n",
"2018-05-30 00:00:00\n",
"000300 空 开仓 3732.4 2058\n",
"000905 空 开仓 5759.4 1262\n",
"000905 空 开仓 5740.1 1262\n",
"000905 空 开仓 5700.5 1262\n",
"2018-06-01 00:00:00\n",
"000905 空 开仓 5660.9 1262\n",
"2018-06-05 00:00:00\n",
"000300 多 平仓 3829.6 2058\n",
"2018-06-19 00:00:00\n",
"000300 空 开仓 3702.6 1988\n",
"000300 空 开仓 3697.0 1988\n",
"000300 空 开仓 3671.8 1988\n",
"000300 空 开仓 3646.6 1988\n",
"2018-07-18 00:00:00\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"000905 多 平仓 5216.6 5048\n",
"2018-07-23 00:00:00\n",
"000300 多 平仓 3506.2 7952\n",
"2018-08-02 00:00:00\n",
"000905 空 开仓 4897.3 1066\n",
"2018-08-06 00:00:00\n",
"000300 空 开仓 3312.8 1510\n",
"000300 空 开仓 3282.0 1510\n",
"000905 空 开仓 4850.4 1066\n",
"000905 空 开仓 4803.5 1066\n",
"2018-08-09 00:00:00\n",
"000905 多 平仓 4991.0 3198\n",
"2018-08-10 00:00:00\n",
"000300 多 平仓 3414.6 3020\n",
"2018-08-16 00:00:00\n",
"000300 空 开仓 3251.8 1458\n",
"2018-08-17 00:00:00\n",
"000905 空 开仓 4797.5 973\n",
"2018-08-20 00:00:00\n",
"000300 空 开仓 3223.4 1458\n",
"000905 空 开仓 4746.1 973\n",
"2018-08-27 00:00:00\n",
"000300 多 平仓 3360.6 2916\n",
"000905 多 平仓 4951.6 1946\n",
"2018-09-10 00:00:00\n",
"000905 空 开仓 4736.6 1087\n",
"2018-09-11 00:00:00\n",
"000905 空 开仓 4690.5 1087\n",
"2018-09-12 00:00:00\n",
"000300 空 开仓 3209.0 1654\n",
"2018-09-17 00:00:00\n",
"000905 空 开仓 4644.5 1087\n",
"000905 空 开仓 4598.5 1087\n",
"2018-09-19 00:00:00\n",
"000300 多 平仓 3330.0 1654\n",
"2018-09-21 00:00:00\n",
"000905 多 平仓 4782.6 4348\n",
"2018-09-26 00:00:00\n",
"000300 多 开仓 3416.6 1733\n",
"000300 多 开仓 3445.4 1733\n",
"2018-10-08 00:00:00\n",
"000300 空 平仓 3330.0 3466\n",
"2018-10-11 00:00:00\n",
"000300 空 开仓 3179.6 1692\n",
"000300 空 开仓 3161.8 1692\n",
"000300 空 开仓 3132.2 1692\n",
"000300 空 开仓 3102.8 1692\n",
"000905 空 开仓 4483.3 1237\n",
"000905 空 开仓 4483.3 1237\n",
"000905 空 开仓 4483.3 1237\n",
"000905 空 开仓 4463.1 1237\n",
"2018-10-22 00:00:00\n",
"000300 多 平仓 3221.0 6768\n",
"2018-11-02 00:00:00\n",
"000905 多 平仓 4375.6 4948\n"
]
}
],
"source": [
"# 查看逐笔的交易记录\n",
"for dt, l in engine.tradeDict.items():\n",
" print dt\n",
" for trade in l:\n",
" print trade.vtSymbol, trade.direction, trade.offset, trade.price, trade.volume"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2015-04-03 00:00:00 -556058.736\n",
"2015-04-07 00:00:00 -41290.496\n",
"2015-04-08 00:00:00 -669917.184\n",
"2015-04-09 00:00:00 -493815.152\n",
"2015-04-10 00:00:00 164718.296\n",
"2015-04-13 00:00:00 494400.896\n",
"2015-04-14 00:00:00 -691692.96\n",
"2015-04-15 00:00:00 -1183931.52\n",
"2015-04-16 00:00:00 647072.512\n",
"2015-04-17 00:00:00 401717.76\n",
"2015-04-20 00:00:00 -360991.488\n",
"2015-04-21 00:00:00 332308.86\n",
"2015-04-22 00:00:00 559211.99\n",
"2015-04-23 00:00:00 104738.032\n",
"2015-04-24 00:00:00 -219870.394\n",
"2015-04-27 00:00:00 671086.574\n",
"2015-04-28 00:00:00 -881810.824\n",
"2015-04-29 00:00:00 526747.64\n",
"2015-04-30 00:00:00 -24440.84\n",
"2015-05-04 00:00:00 277168.96\n",
"2015-05-05 00:00:00 -1744525.736\n",
"2015-05-06 00:00:00 -678886.568\n",
"2015-05-07 00:00:00 -404869.632\n",
"2015-05-11 00:00:00 -76022.208\n",
"2015-05-12 00:00:00 -90219.968\n",
"2015-05-13 00:00:00 74812.944\n",
"2015-05-14 00:00:00 -21779.968\n",
"2015-05-15 00:00:00 -133119.104\n",
"2015-05-18 00:00:00 303420.48\n",
"2015-05-19 00:00:00 417697.344\n",
"2015-05-20 00:00:00 287916.224\n",
"2015-05-21 00:00:00 645492.096\n",
"2015-05-22 00:00:00 300093.824\n",
"2015-05-25 00:00:00 494503.072\n",
"2015-05-26 00:00:00 629629.12\n",
"2015-05-27 00:00:00 233658.88\n",
"2015-05-28 00:00:00 -1187393.408\n",
"2015-05-29 00:00:00 185818.848\n",
"2015-06-01 00:00:00 984525.92\n",
"2015-06-02 00:00:00 751593.92\n",
"2015-06-03 00:00:00 176697.92\n",
"2015-06-04 00:00:00 -78373.584\n",
"2015-06-05 00:00:00 290723.912\n",
"2015-06-08 00:00:00 -147075.994\n",
"2015-06-09 00:00:00 -82588.984\n",
"2015-06-10 00:00:00 349570.9486\n",
"2015-06-11 00:00:00 293520.3292\n",
"2015-06-12 00:00:00 398212.6123\n",
"2015-06-15 00:00:00 -910264.9591\n",
"2015-06-16 00:00:00 -1179473.9125\n",
"2015-06-17 00:00:00 416700.1024\n",
"2015-06-18 00:00:00 -1353402.4515\n",
"2015-06-19 00:00:00 -1517295.5482\n",
"2015-06-23 00:00:00 -160417.7847\n",
"2015-06-24 00:00:00 -185343.9705\n",
"2015-06-25 00:00:00 -922472.4249\n",
"2015-06-26 00:00:00 -204613.1811\n",
"2015-06-29 00:00:00 545817.2343\n",
"2015-06-30 00:00:00 -1073225.4312\n",
"2015-07-01 00:00:00 1000949.976\n",
"2015-07-02 00:00:00 906935.5668\n",
"2015-07-03 00:00:00 991604.028\n",
"2015-07-06 00:00:00 -145950.906\n",
"2015-07-07 00:00:00 629963.8668\n",
"2015-07-08 00:00:00 778592.4552\n",
"2015-07-09 00:00:00 -838212.2424\n",
"2015-07-10 00:00:00 -831753.4104\n",
"2015-07-13 00:00:00 -689935.1556\n",
"2015-07-14 00:00:00 72403.4088\n",
"2015-07-15 00:00:00 786715.9956\n",
"2015-07-16 00:00:00 -242285.556\n",
"2015-07-17 00:00:00 -850170.27\n",
"2015-07-20 00:00:00 -141182.1\n",
"2015-07-21 00:00:00 -12621.258\n",
"2015-07-22 00:00:00 20698.002\n",
"2015-07-23 00:00:00 -283232.664\n",
"2015-07-24 00:00:00 174391.542\n",
"2015-08-21 00:00:00 -687679.028\n",
"2015-08-24 00:00:00 -242802.126\n",
"2015-08-25 00:00:00 792234.68\n",
"2015-08-26 00:00:00 271418.6544\n",
"2015-08-27 00:00:00 -626720.7044\n",
"2015-08-28 00:00:00 -686935.7296\n",
"2015-08-31 00:00:00 192475.14\n",
"2015-09-01 00:00:00 402709.2984\n",
"2015-09-02 00:00:00 35671.6116\n",
"2015-09-07 00:00:00 248993.596\n",
"2015-09-08 00:00:00 -415007.4876\n",
"2015-09-09 00:00:00 -319934.6564\n",
"2015-09-10 00:00:00 202732.3416\n",
"2015-09-11 00:00:00 -26275.0272\n",
"2015-09-14 00:00:00 576282.1476\n",
"2015-09-15 00:00:00 625950.3296\n",
"2015-09-16 00:00:00 -724882.5516\n",
"2015-09-17 00:00:00 282181.704\n",
"2015-09-18 00:00:00 -101330.092\n",
"2015-09-21 00:00:00 -336169.3228\n",
"2015-09-22 00:00:00 -115089.8036\n",
"2015-09-23 00:00:00 245139.4204\n",
"2015-09-24 00:00:00 -137402.8152\n",
"2015-09-25 00:00:00 320517.7188\n",
"2015-09-28 00:00:00 -131160.0976\n",
"2015-09-29 00:00:00 259523.9128\n",
"2015-09-30 00:00:00 -302176.3876\n",
"2015-10-08 00:00:00 -454946.734\n",
"2015-10-09 00:00:00 -303435.176\n",
"2015-10-12 00:00:00 -250870.73\n",
"2015-11-19 00:00:00 -44606.452\n",
"2015-11-23 00:00:00 -27316.652\n",
"2015-11-24 00:00:00 23898.732\n",
"2015-11-25 00:00:00 36991.108\n",
"2015-11-26 00:00:00 -344020.072\n",
"2015-11-27 00:00:00 -438200.752\n",
"2015-12-22 00:00:00 -19482.2775\n",
"2015-12-24 00:00:00 -47814.1056\n",
"2015-12-25 00:00:00 -119217.4446\n",
"2015-12-28 00:00:00 -142966.2342\n",
"2015-12-31 00:00:00 -807181.7029\n",
"2016-01-04 00:00:00 -291560.2038\n",
"2016-01-05 00:00:00 -388526.5513\n",
"2016-01-06 00:00:00 -1648795.223\n",
"2016-01-07 00:00:00 -133958.7385\n",
"2016-01-08 00:00:00 -347159.6085\n",
"2016-01-11 00:00:00 1696055.142\n",
"2016-01-12 00:00:00 -125657.096\n",
"2016-01-13 00:00:00 714949.808\n",
"2016-01-14 00:00:00 -718339.138\n",
"2016-01-15 00:00:00 954877.058\n",
"2016-01-18 00:00:00 -230255.604\n",
"2016-01-19 00:00:00 -879363.824\n",
"2016-01-20 00:00:00 348637.764\n",
"2016-01-21 00:00:00 950557.674\n",
"2016-01-22 00:00:00 -342155.144\n",
"2016-01-25 00:00:00 -196348.58\n",
"2016-01-26 00:00:00 1807493.418\n",
"2016-01-27 00:00:00 200977.352\n",
"2016-01-28 00:00:00 855630.234\n",
"2016-01-29 00:00:00 -837671.316\n",
"2016-02-01 00:00:00 353782.282\n",
"2016-02-02 00:00:00 -665129.18\n",
"2016-02-03 00:00:00 11631.498\n",
"2016-02-04 00:00:00 -396845.916\n",
"2016-02-05 00:00:00 215428.808\n",
"2016-02-15 00:00:00 72450.052\n",
"2016-02-16 00:00:00 -926247.352\n",
"2016-02-17 00:00:00 -264049.148\n",
"2016-02-18 00:00:00 29134.872\n",
"2016-02-19 00:00:00 -45667.236\n",
"2016-02-22 00:00:00 -253380.444\n",
"2016-02-23 00:00:00 67774.308\n",
"2016-02-24 00:00:00 -82707.516\n",
"2016-02-25 00:00:00 989380.62\n",
"2016-02-26 00:00:00 -46686.216\n",
"2016-02-29 00:00:00 608947.956\n",
"2016-03-01 00:00:00 -251330.448\n",
"2016-03-02 00:00:00 -570207.132\n",
"2016-03-03 00:00:00 -48610.752\n",
"2016-03-04 00:00:00 276938.8495\n",
"2016-03-07 00:00:00 -267213.072\n",
"2016-03-08 00:00:00 -20713.507\n",
"2016-03-09 00:00:00 258656.8047\n",
"2016-03-10 00:00:00 125290.8243\n",
"2016-03-11 00:00:00 32458.1883\n",
"2016-03-14 00:00:00 -315063.93\n",
"2016-03-15 00:00:00 114235.2428\n",
"2016-03-16 00:00:00 174905.8908\n",
"2016-03-17 00:00:00 -388428.077\n",
"2016-03-18 00:00:00 -506724.6261\n",
"2016-03-21 00:00:00 -164313.4124\n",
"2016-03-22 00:00:00 -61636.7724\n",
"2016-03-23 00:00:00 48172.6196\n",
"2016-03-24 00:00:00 -253634.1892\n",
"2016-03-25 00:00:00 74657.9512\n",
"2016-03-28 00:00:00 -131342.2936\n",
"2016-03-29 00:00:00 -160473.306\n",
"2016-03-30 00:00:00 378127.078\n",
"2016-03-31 00:00:00 8475.7176\n",
"2016-04-01 00:00:00 17801.0644\n",
"2016-04-05 00:00:00 195344.0286\n",
"2016-04-06 00:00:00 -32536.5432\n",
"2016-04-07 00:00:00 -277605.8179\n",
"2016-04-08 00:00:00 -143374.8562\n",
"2016-04-11 00:00:00 282166.3859\n",
"2016-04-12 00:00:00 -155264.6806\n",
"2016-04-13 00:00:00 251146.961\n",
"2016-04-14 00:00:00 131070.682\n",
"2016-04-15 00:00:00 -36249.3166\n",
"2016-04-18 00:00:00 -318253.5016\n",
"2016-04-19 00:00:00 -590600.7404\n",
"2016-04-20 00:00:00 -583014.9868\n",
"2016-04-27 00:00:00 -81157.318\n",
"2016-04-29 00:00:00 3228.929\n",
"2016-05-03 00:00:00 -140155.092\n",
"2016-05-04 00:00:00 -1588.3098\n",
"2016-05-06 00:00:00 -583552.1278\n",
"2016-05-10 00:00:00 -10259.0436\n",
"2016-05-11 00:00:00 -99212.5041\n",
"2016-05-12 00:00:00 -48375.0429\n",
"2016-05-13 00:00:00 120761.527\n",
"2016-05-16 00:00:00 -387710.3524\n",
"2016-05-17 00:00:00 114491.5604\n",
"2016-05-18 00:00:00 541907.7806\n",
"2016-05-19 00:00:00 -66163.9272\n",
"2016-05-20 00:00:00 -272614.2674\n",
"2016-05-23 00:00:00 -262740.8872\n",
"2016-05-24 00:00:00 318612.3522\n",
"2016-05-25 00:00:00 44162.4336\n",
"2016-05-26 00:00:00 -109111.7936\n",
"2016-05-27 00:00:00 26328.5532\n",
"2016-05-30 00:00:00 -641128.946\n",
"2016-05-31 00:00:00 -1437857.74\n",
"2016-06-03 00:00:00 -23656.594\n",
"2016-06-07 00:00:00 -5214.9248\n",
"2016-06-08 00:00:00 -186510.7942\n",
"2016-06-13 00:00:00 -222501.9076\n",
"2016-06-27 00:00:00 -17809.8885\n",
"2016-06-28 00:00:00 -19346.4675\n",
"2016-06-29 00:00:00 9709.074\n",
"2016-06-30 00:00:00 5036.454\n",
"2016-07-01 00:00:00 -199083.7874\n",
"2016-07-04 00:00:00 159935.7195\n",
"2016-07-05 00:00:00 92812.338\n",
"2016-07-06 00:00:00 108026.3036\n",
"2016-07-07 00:00:00 52044.5769\n",
"2016-07-08 00:00:00 -176534.3718\n",
"2016-07-11 00:00:00 -176709.607\n",
"2016-07-12 00:00:00 589166.695\n",
"2016-07-13 00:00:00 250595.7984\n",
"2016-07-14 00:00:00 -31174.1052\n",
"2016-07-15 00:00:00 -49255.5416\n",
"2016-07-18 00:00:00 -225814.9964\n",
"2016-07-19 00:00:00 -71964.3148\n",
"2016-07-20 00:00:00 -145224.972\n",
"2016-07-21 00:00:00 219474.8728\n",
"2016-07-22 00:00:00 -421886.5908\n",
"2016-07-25 00:00:00 109744.6432\n",
"2016-07-26 00:00:00 -285177.466\n",
"2016-07-27 00:00:00 -1305820.1336\n",
"2016-08-11 00:00:00 -138807.2448\n",
"2016-08-12 00:00:00 -225520.2432\n",
"2016-08-15 00:00:00 266623.2576\n",
"2016-08-16 00:00:00 -163202.4576\n",
"2016-08-17 00:00:00 -84740.4096\n",
"2016-08-18 00:00:00 -92064.0\n",
"2016-08-19 00:00:00 15333.8656\n",
"2016-08-22 00:00:00 -386475.0688\n",
"2016-08-23 00:00:00 62879.128\n",
"2016-08-24 00:00:00 -237236.4528\n",
"2016-08-25 00:00:00 -279627.6656\n",
"2016-08-26 00:00:00 -20234.1888\n",
"2016-08-29 00:00:00 7429.632\n",
"2016-08-30 00:00:00 45222.912\n",
"2016-08-31 00:00:00 169952.5632\n",
"2016-09-01 00:00:00 -281886.2592\n",
"2016-09-02 00:00:00 134803.2\n",
"2016-09-05 00:00:00 59846.7072\n",
"2016-09-06 00:00:00 206219.6038\n",
"2016-09-07 00:00:00 -19447.1424\n",
"2016-09-08 00:00:00 14524.3644\n",
"2016-09-09 00:00:00 -917740.7085\n",
"2016-09-12 00:00:00 -808337.4922\n",
"2016-09-13 00:00:00 -114175.823\n",
"2016-09-19 00:00:00 -146121.0159\n",
"2016-09-20 00:00:00 18318.6096\n",
"2016-09-21 00:00:00 -27476.8485\n",
"2016-09-22 00:00:00 -117496.5696\n",
"2016-09-23 00:00:00 -93237.1602\n",
"2016-09-26 00:00:00 291736.6409\n",
"2016-09-27 00:00:00 -164937.6036\n",
"2016-09-28 00:00:00 67768.4812\n",
"2016-09-29 00:00:00 -116191.9436\n",
"2016-09-30 00:00:00 -502265.8644\n",
"2016-10-10 00:00:00 -509557.9122\n",
"2016-10-18 00:00:00 -19842.2772\n",
"2016-10-20 00:00:00 -47103.4726\n",
"2016-10-21 00:00:00 -308202.5228\n",
"2016-10-24 00:00:00 347592.4112\n",
"2016-10-25 00:00:00 65100.3464\n",
"2016-10-26 00:00:00 -255935.556\n",
"2016-10-27 00:00:00 -154312.7224\n",
"2016-10-28 00:00:00 -243903.5016\n",
"2016-10-31 00:00:00 -59976.924\n",
"2016-11-01 00:00:00 450602.7688\n",
"2016-11-02 00:00:00 -480329.5792\n",
"2016-11-03 00:00:00 490859.3736\n",
"2016-11-04 00:00:00 -200328.82\n",
"2016-11-07 00:00:00 48679.344\n",
"2016-11-08 00:00:00 19178.304\n",
"2016-11-09 00:00:00 -372452.7656\n",
"2016-11-10 00:00:00 446797.7138\n",
"2016-11-11 00:00:00 325050.64\n",
"2016-11-14 00:00:00 192074.9324\n",
"2016-11-15 00:00:00 71155.714\n",
"2016-11-16 00:00:00 13105.3532\n",
"2016-11-17 00:00:00 55328.7792\n",
"2016-11-18 00:00:00 -400145.6642\n",
"2016-11-21 00:00:00 347676.6092\n",
"2016-11-22 00:00:00 565375.6154\n",
"2016-11-23 00:00:00 -52343.771\n",
"2016-11-24 00:00:00 -396842.8832\n",
"2016-11-25 00:00:00 561165.5345\n",
"2016-11-28 00:00:00 178508.3496\n",
"2016-11-29 00:00:00 294622.197\n",
"2016-11-30 00:00:00 -393926.9445\n",
"2016-12-01 00:00:00 296613.6616\n",
"2016-12-02 00:00:00 -633842.3384\n",
"2016-12-05 00:00:00 -771257.9248\n",
"2016-12-06 00:00:00 -163289.7496\n",
"2016-12-07 00:00:00 214925.488\n",
"2016-12-09 00:00:00 -725036.542\n",
"2016-12-13 00:00:00 -196838.4876\n",
"2016-12-14 00:00:00 261634.2256\n",
"2016-12-15 00:00:00 -276642.1888\n",
"2016-12-16 00:00:00 -257882.9112\n",
"2016-12-19 00:00:00 -14938.294\n",
"2016-12-20 00:00:00 135916.4924\n",
"2016-12-21 00:00:00 -317688.17\n",
"2016-12-22 00:00:00 39352.2756\n",
"2016-12-23 00:00:00 404428.3532\n",
"2016-12-26 00:00:00 -86295.112\n",
"2016-12-27 00:00:00 39875.1328\n",
"2016-12-28 00:00:00 125945.0036\n",
"2016-12-29 00:00:00 119262.1716\n",
"2016-12-30 00:00:00 -74525.752\n",
"2017-01-03 00:00:00 -586265.6416\n",
"2017-01-04 00:00:00 -499905.5952\n",
"2017-01-12 00:00:00 -137445.817\n",
"2017-01-13 00:00:00 -490935.3585\n",
"2017-01-16 00:00:00 272414.6387\n",
"2017-01-17 00:00:00 -370800.6049\n",
"2017-01-18 00:00:00 48142.1186\n",
"2017-01-19 00:00:00 166153.224\n",
"2017-01-20 00:00:00 -579810.1525\n",
"2017-01-23 00:00:00 -334525.5584\n",
"2017-01-24 00:00:00 47179.1781\n",
"2017-01-25 00:00:00 -373995.6469\n",
"2017-01-26 00:00:00 -256828.8364\n",
"2017-02-03 00:00:00 -145925.8894\n",
"2017-02-06 00:00:00 54176.1904\n",
"2017-02-07 00:00:00 -46760.6036\n",
"2017-02-08 00:00:00 40086.2024\n",
"2017-02-09 00:00:00 2181.2744\n",
"2017-02-10 00:00:00 160372.1688\n",
"2017-02-13 00:00:00 283394.0552\n",
"2017-02-14 00:00:00 -5854.8688\n",
"2017-02-15 00:00:00 -175236.9196\n",
"2017-02-16 00:00:00 239019.92\n",
"2017-02-17 00:00:00 -358902.7924\n",
"2017-02-20 00:00:00 579583.1552\n",
"2017-02-21 00:00:00 146723.704\n",
"2017-02-22 00:00:00 213863.2268\n",
"2017-02-23 00:00:00 -205850.5436\n",
"2017-02-24 00:00:00 20506.2116\n",
"2017-02-27 00:00:00 -676651.41\n",
"2017-02-28 00:00:00 253326.8732\n",
"2017-03-01 00:00:00 176925.5572\n",
"2017-03-02 00:00:00 -694791.3104\n",
"2017-03-03 00:00:00 26897.5188\n",
"2017-03-06 00:00:00 413732.552\n",
"2017-03-07 00:00:00 37618.9328\n",
"2017-03-08 00:00:00 -167451.184\n",
"2017-03-09 00:00:00 -370239.1296\n",
"2017-03-10 00:00:00 54756.0688\n",
"2017-03-13 00:00:00 384831.0384\n",
"2017-03-14 00:00:00 -92466.1088\n",
"2017-03-15 00:00:00 -47625.968\n",
"2017-03-16 00:00:00 367502.7056\n",
"2017-03-17 00:00:00 -385565.6704\n",
"2017-03-20 00:00:00 96851.4448\n",
"2017-03-21 00:00:00 112948.5472\n",
"2017-03-22 00:00:00 -103637.648\n",
"2017-03-23 00:00:00 -32055.132\n",
"2017-03-24 00:00:00 161814.374\n",
"2017-03-27 00:00:00 -238900.6288\n",
"2017-03-28 00:00:00 -172033.2512\n",
"2017-03-29 00:00:00 -473800.9944\n",
"2017-03-30 00:00:00 -882358.564\n",
"2017-04-05 00:00:00 -39875.5824\n",
"2017-04-06 00:00:00 -66204.3595\n",
"2017-04-07 00:00:00 42780.3397\n",
"2017-04-10 00:00:00 -206750.0288\n",
"2017-04-11 00:00:00 287585.5328\n",
"2017-04-12 00:00:00 -311505.8938\n",
"2017-04-13 00:00:00 226795.4554\n",
"2017-04-14 00:00:00 -951996.042\n",
"2017-04-17 00:00:00 -394580.7144\n",
"2017-04-18 00:00:00 -535595.0068\n",
"2017-04-20 00:00:00 -40116.7164\n",
"2017-04-21 00:00:00 -47502.1804\n",
"2017-04-24 00:00:00 882584.5428\n",
"2017-04-25 00:00:00 -376357.1048\n",
"2017-04-26 00:00:00 -262047.24\n",
"2017-04-27 00:00:00 -99509.8128\n",
"2017-04-28 00:00:00 -99760.2184\n",
"2017-05-02 00:00:00 16126.7996\n",
"2017-05-03 00:00:00 160206.8588\n",
"2017-05-04 00:00:00 8472.6526\n",
"2017-05-05 00:00:00 532460.258\n",
"2017-05-08 00:00:00 945024.5681\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"2017-05-09 00:00:00 -146641.4404\n",
"2017-05-10 00:00:00 981657.526\n",
"2017-05-11 00:00:00 -163166.048\n",
"2017-05-12 00:00:00 -317319.3712\n",
"2017-05-15 00:00:00 -627279.5244\n",
"2017-05-16 00:00:00 -1140490.9352\n",
"2017-05-17 00:00:00 -80802.496\n",
"2017-05-18 00:00:00 321249.3536\n",
"2017-05-19 00:00:00 8274.1856\n",
"2017-05-22 00:00:00 539045.112\n",
"2017-05-23 00:00:00 775348.6208\n",
"2017-05-24 00:00:00 -528146.8316\n",
"2017-05-25 00:00:00 -322501.1792\n",
"2017-05-26 00:00:00 -109594.9628\n",
"2017-05-31 00:00:00 157402.1776\n",
"2017-06-01 00:00:00 773986.6792\n",
"2017-06-02 00:00:00 -530284.6816\n",
"2017-06-05 00:00:00 -490792.32\n",
"2017-06-06 00:00:00 138081.1216\n",
"2017-06-07 00:00:00 -201960.3024\n",
"2017-06-08 00:00:00 311123.0704\n",
"2017-06-09 00:00:00 188255.5464\n",
"2017-06-12 00:00:00 -22068.9128\n",
"2017-06-13 00:00:00 97624.176\n",
"2017-06-14 00:00:00 -582036.1304\n",
"2017-06-15 00:00:00 -80623.5912\n",
"2017-06-16 00:00:00 -124310.348\n",
"2017-06-19 00:00:00 432532.8464\n",
"2017-06-20 00:00:00 -88866.7496\n",
"2017-06-21 00:00:00 513784.712\n",
"2017-06-22 00:00:00 29585.9\n",
"2017-06-23 00:00:00 403243.1152\n",
"2017-06-26 00:00:00 560227.4496\n",
"2017-06-27 00:00:00 82075.9336\n",
"2017-06-28 00:00:00 -353774.2512\n",
"2017-06-29 00:00:00 280818.8296\n",
"2017-06-30 00:00:00 -25158.2384\n",
"2017-07-03 00:00:00 -197669.7488\n",
"2017-07-04 00:00:00 -382444.3824\n",
"2017-07-05 00:00:00 491905.3968\n",
"2017-07-06 00:00:00 5169.9424\n",
"2017-07-07 00:00:00 -51642.4208\n",
"2017-07-10 00:00:00 -27789.06\n",
"2017-07-11 00:00:00 212173.3456\n",
"2017-07-12 00:00:00 -148518.12\n",
"2017-07-13 00:00:00 348176.7848\n",
"2017-07-14 00:00:00 -469967.6408\n",
"2017-07-17 00:00:00 -523743.4184\n",
"2017-07-18 00:00:00 -360086.5744\n",
"2017-07-19 00:00:00 226805.3688\n",
"2017-07-20 00:00:00 224762.3784\n",
"2017-07-21 00:00:00 -239000.7864\n",
"2017-07-24 00:00:00 184281.432\n",
"2017-07-25 00:00:00 -296287.7632\n",
"2017-07-26 00:00:00 -175602.0752\n",
"2017-07-27 00:00:00 84343.6696\n",
"2017-07-28 00:00:00 15578.579\n",
"2017-07-31 00:00:00 198046.4656\n",
"2017-08-01 00:00:00 338761.289\n",
"2017-08-02 00:00:00 -209013.3946\n",
"2017-08-03 00:00:00 -369516.8595\n",
"2017-08-04 00:00:00 -395839.2281\n",
"2017-08-07 00:00:00 546091.4698\n",
"2017-08-08 00:00:00 68301.7235\n",
"2017-08-09 00:00:00 128306.4892\n",
"2017-08-10 00:00:00 -1217829.774\n",
"2017-08-11 00:00:00 -1353256.2203\n",
"2017-08-16 00:00:00 -30533.383\n",
"2017-08-18 00:00:00 -66204.397\n",
"2017-08-21 00:00:00 75353.087\n",
"2017-08-22 00:00:00 -74779.041\n",
"2017-08-23 00:00:00 -143106.655\n",
"2017-08-24 00:00:00 -118876.211\n",
"2017-08-25 00:00:00 89592.4675\n",
"2017-08-28 00:00:00 209964.184\n",
"2017-08-29 00:00:00 -126598.7975\n",
"2017-08-30 00:00:00 182813.3415\n",
"2017-08-31 00:00:00 91257.174\n",
"2017-09-01 00:00:00 301703.406\n",
"2017-09-04 00:00:00 205385.804\n",
"2017-09-05 00:00:00 38621.406\n",
"2017-09-06 00:00:00 189690.73\n",
"2017-09-07 00:00:00 -261044.594\n",
"2017-09-08 00:00:00 83854.294\n",
"2017-09-11 00:00:00 405894.1\n",
"2017-09-12 00:00:00 -30213.004\n",
"2017-09-13 00:00:00 217179.84\n",
"2017-09-14 00:00:00 -65608.562\n",
"2017-09-15 00:00:00 -269759.118\n",
"2017-09-18 00:00:00 255071.18\n",
"2017-09-19 00:00:00 -179878.686\n",
"2017-09-20 00:00:00 303713.374\n",
"2017-09-21 00:00:00 -432696.184\n",
"2017-09-22 00:00:00 -348331.328\n",
"2017-09-25 00:00:00 -442050.39\n",
"2017-11-16 00:00:00 -523104.701\n",
"2017-11-17 00:00:00 -152540.299\n",
"2017-11-20 00:00:00 -187984.1998\n",
"2017-11-21 00:00:00 -134732.6216\n",
"2017-11-24 00:00:00 -141674.3616\n",
"2017-11-28 00:00:00 -248071.68\n",
"2017-11-29 00:00:00 -45125.0816\n",
"2017-11-30 00:00:00 130115.4432\n",
"2017-12-01 00:00:00 -125471.3216\n",
"2017-12-04 00:00:00 -258429.312\n",
"2017-12-05 00:00:00 347405.9648\n",
"2017-12-06 00:00:00 -188924.2496\n",
"2017-12-07 00:00:00 176808.6144\n",
"2017-12-08 00:00:00 -692070.7328\n",
"2017-12-11 00:00:00 -393193.6128\n",
"2017-12-29 00:00:00 -112290.2\n",
"2018-01-02 00:00:00 -199423.9454\n",
"2018-01-03 00:00:00 21185.9961\n",
"2018-01-04 00:00:00 181644.3978\n",
"2018-01-05 00:00:00 -26496.1934\n",
"2018-01-08 00:00:00 242748.9231\n",
"2018-01-09 00:00:00 230810.8592\n",
"2018-01-10 00:00:00 -61577.6956\n",
"2018-01-11 00:00:00 87547.9608\n",
"2018-01-12 00:00:00 -536582.0468\n",
"2018-01-15 00:00:00 -767210.0104\n",
"2018-01-16 00:00:00 265869.6\n",
"2018-01-17 00:00:00 -82852.8\n",
"2018-01-18 00:00:00 186403.2\n",
"2018-01-19 00:00:00 111825.6\n",
"2018-01-22 00:00:00 409619.2\n",
"2018-01-23 00:00:00 368124.0\n",
"2018-01-24 00:00:00 58179.2\n",
"2018-01-25 00:00:00 -198447.2\n",
"2018-01-26 00:00:00 129761.6\n",
"2018-01-29 00:00:00 -634252.0\n",
"2018-01-30 00:00:00 -530262.172\n",
"2018-01-31 00:00:00 -429368.0374\n",
"2018-02-01 00:00:00 59935.001\n",
"2018-02-02 00:00:00 -117905.1024\n",
"2018-02-05 00:00:00 38853.6912\n",
"2018-02-06 00:00:00 1723778.508\n",
"2018-02-07 00:00:00 -41447.3384\n",
"2018-02-08 00:00:00 -1082108.42\n",
"2018-02-09 00:00:00 1240718.6072\n",
"2018-02-12 00:00:00 -1137357.942\n",
"2018-02-13 00:00:00 -490581.6664\n",
"2018-02-14 00:00:00 -608540.0296\n",
"2018-02-22 00:00:00 -1214968.9992\n",
"2018-02-23 00:00:00 -823732.4992\n",
"2018-02-26 00:00:00 -774065.592\n",
"2018-03-22 00:00:00 -1852131.6552\n",
"2018-03-23 00:00:00 -82802.1542\n",
"2018-03-26 00:00:00 -478998.9022\n",
"2018-03-27 00:00:00 -831948.6056\n",
"2018-03-28 00:00:00 472425.5664\n",
"2018-03-29 00:00:00 -343734.4728\n",
"2018-03-30 00:00:00 -29783.1384\n",
"2018-04-02 00:00:00 77531.6448\n",
"2018-04-03 00:00:00 163645.5528\n",
"2018-04-04 00:00:00 51004.1016\n",
"2018-04-09 00:00:00 12945.3768\n",
"2018-04-10 00:00:00 -562938.0768\n",
"2018-04-11 00:00:00 -74797.668\n",
"2018-04-13 00:00:00 -122956.9914\n",
"2018-04-16 00:00:00 -73289.074\n",
"2018-04-17 00:00:00 69002.5988\n",
"2018-04-18 00:00:00 -56379.9968\n",
"2018-04-19 00:00:00 -218419.434\n",
"2018-04-20 00:00:00 244439.8278\n",
"2018-04-23 00:00:00 -26229.8916\n",
"2018-04-24 00:00:00 -369918.9426\n",
"2018-04-25 00:00:00 70889.3574\n",
"2018-04-26 00:00:00 350956.2756\n",
"2018-04-27 00:00:00 -6627.2256\n",
"2018-05-02 00:00:00 -32453.4624\n",
"2018-05-03 00:00:00 -140723.076\n",
"2018-05-04 00:00:00 88219.188\n",
"2018-05-07 00:00:00 -382570.3086\n",
"2018-05-08 00:00:00 -213280.266\n",
"2018-05-18 00:00:00 -112867.7437\n",
"2018-05-22 00:00:00 -3429.0172\n",
"2018-05-23 00:00:00 -218705.2095\n",
"2018-05-24 00:00:00 -151481.1417\n",
"2018-05-25 00:00:00 -90984.8896\n",
"2018-05-29 00:00:00 -533968.981\n",
"2018-05-31 00:00:00 -552842.6372\n",
"2018-06-01 00:00:00 328010.787\n",
"2018-06-04 00:00:00 -111515.521\n",
"2018-06-05 00:00:00 -561916.023\n",
"2018-06-06 00:00:00 24332.8744\n",
"2018-06-07 00:00:00 182939.0152\n",
"2018-06-08 00:00:00 346870.796\n",
"2018-06-11 00:00:00 186505.932\n",
"2018-06-12 00:00:00 -307874.996\n",
"2018-06-13 00:00:00 435787.7824\n",
"2018-06-14 00:00:00 101393.6232\n",
"2018-06-15 00:00:00 -68044.2112\n",
"2018-06-19 00:00:00 1727602.7848\n",
"2018-06-20 00:00:00 -400069.136\n",
"2018-06-21 00:00:00 888735.1096\n",
"2018-06-22 00:00:00 -484506.488\n",
"2018-06-25 00:00:00 562222.5048\n",
"2018-06-26 00:00:00 55582.4272\n",
"2018-06-27 00:00:00 827708.7424\n",
"2018-06-28 00:00:00 558729.0768\n",
"2018-06-29 00:00:00 -1516556.408\n",
"2018-07-02 00:00:00 1217920.228\n",
"2018-07-03 00:00:00 -305011.4552\n",
"2018-07-04 00:00:00 744653.1352\n",
"2018-07-05 00:00:00 869008.732\n",
"2018-07-06 00:00:00 -250391.1552\n",
"2018-07-09 00:00:00 -1307901.2704\n",
"2018-07-10 00:00:00 -212555.1048\n",
"2018-07-11 00:00:00 983705.6344\n",
"2018-07-12 00:00:00 -1272958.484\n",
"2018-07-13 00:00:00 -252444.228\n",
"2018-07-16 00:00:00 209199.212\n",
"2018-07-17 00:00:00 72552.5968\n",
"2018-07-18 00:00:00 343272.088\n",
"2018-07-19 00:00:00 23694.5744\n",
"2018-07-20 00:00:00 -619118.864\n",
"2018-07-23 00:00:00 -261274.888\n",
"2018-08-01 00:00:00 -221806.9906\n",
"2018-08-03 00:00:00 -202543.686\n",
"2018-08-06 00:00:00 111396.1472\n",
"2018-08-07 00:00:00 -709625.992\n",
"2018-08-08 00:00:00 55031.2564\n",
"2018-08-09 00:00:00 -699483.4222\n",
"2018-08-10 00:00:00 -22617.686\n",
"2018-08-15 00:00:00 -58576.608\n",
"2018-08-16 00:00:00 -88417.6776\n",
"2018-08-17 00:00:00 4223.2735\n",
"2018-08-20 00:00:00 -83687.4271\n",
"2018-08-21 00:00:00 -288661.815\n",
"2018-08-22 00:00:00 161468.5332\n",
"2018-08-23 00:00:00 -87054.292\n",
"2018-08-24 00:00:00 -289435.9742\n",
"2018-08-27 00:00:00 -446625.9936\n",
"2018-09-07 00:00:00 -59978.3773\n",
"2018-09-10 00:00:00 -15629.1034\n",
"2018-09-11 00:00:00 -23013.1614\n",
"2018-09-12 00:00:00 19411.4286\n",
"2018-09-13 00:00:00 -116346.4528\n",
"2018-09-14 00:00:00 -3587.9958\n",
"2018-09-17 00:00:00 208633.1664\n",
"2018-09-18 00:00:00 -559568.5444\n",
"2018-09-19 00:00:00 -303335.516\n",
"2018-09-20 00:00:00 -198732.2968\n",
"2018-09-21 00:00:00 -311901.606\n",
"2018-09-25 00:00:00 -177444.2962\n",
"2018-09-27 00:00:00 -47314.7126\n",
"2018-09-28 00:00:00 -255063.6332\n",
"2018-10-08 00:00:00 -512850.5026\n",
"2018-10-10 00:00:00 -1680888.45\n",
"2018-10-12 00:00:00 -170072.5924\n",
"2018-10-15 00:00:00 689959.1236\n",
"2018-10-16 00:00:00 664611.8052\n",
"2018-10-17 00:00:00 -283648.3748\n",
"2018-10-18 00:00:00 1068480.3224\n",
"2018-10-19 00:00:00 -1737209.0496\n",
"2018-10-22 00:00:00 -1931025.1004\n",
"2018-10-23 00:00:00 393803.4032\n",
"2018-10-24 00:00:00 39918.9796\n",
"2018-10-25 00:00:00 54762.4848\n",
"2018-10-26 00:00:00 2287.4604\n",
"2018-10-29 00:00:00 353450.484\n",
"2018-10-30 00:00:00 -207899.6212\n",
"2018-10-31 00:00:00 -336510.5112\n",
"2018-11-01 00:00:00 -509882.4936\n",
"2018-11-02 00:00:00 -687583.4812\n"
]
}
],
"source": [
"# 查看每日的盈亏统计\n",
"for result in engine.resultList:\n",
" if result.totalPnl:\n",
" print result.date, result.totalPnl"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}