vnpy/examples/TurtleStrategy/.ipynb_checkpoints/run-checkpoint.ipynb
2018-11-11 15:25:59 +08:00

150 lines
17 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"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",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"engine = BacktestingEngine()\n",
"engine.setPeriod(datetime(2015, 1, 1), datetime(2018, 11, 9))\n",
"engine.initPortfolio('setting.csv', 10000000)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"15:22:46.074000:000300.XSHG数据加载完成总数据量940\n",
"15:22:46.074000:全部数据加载完成\n"
]
}
],
"source": [
"engine.loadData()\n",
"engine.runBacktesting()\n",
"engine.calculateResult()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"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": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"for result in engine.resultList:\n",
" if result.totalPnl:\n",
" print result.date, result.totalPnl"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x8190eb0>]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEDCAYAAAA849PJAAAABH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BrCNxPgc7gJPNLD3wN9H5+hPmMxCSaHdChPuGfyOaDcBm/BvXR71Mw/Q6P4i/6voOsDpwOxd/e+YzwMbAv/mB/IZ/hNRm4F38oyai/jrC+H4sAB4LHE8GXgc2AX8HUgLpqYHzTYH7J0e73GF67ccBKwOfhf8F8hLpcwB8H3gfWAP8CUhJtM/AUG9aCkJEJEHFWxOQiIgMkAKAiEiCUgAQEUlQCgAiIglKAUBEJEEpAIiIJCgFABGRBPX/AaYCviKP8gmWAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x8127530>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"l = [result.totalPnl for result in engine.resultList]\n",
"equity = np.cumsum(l)\n",
"plt.plot(equity)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"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
}