2017-06-02 13:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
"cells": [
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2018-01-11 08:03:42 +00:00
|
|
|
|
"execution_count": 1,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"%matplotlib inline\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"from vnpy.trader.app.ctaStrategy.ctaBacktesting import BacktestingEngine, OptimizationSetting, MINUTE_DB_NAME\n",
|
2018-01-08 09:28:30 +00:00
|
|
|
|
"from vnpy.trader.app.ctaStrategy.strategy.strategyAtrRsi import AtrRsiStrategy\n",
|
2017-12-15 15:05:22 +00:00
|
|
|
|
"#from vnpy.trader.app.ctaStrategy.strategy.strategyMultiTimeframe import MultiTimeframeStrategy\n",
|
|
|
|
|
"from vnpy.trader.app.ctaStrategy.strategy.strategyMultiSignal import MultiSignalStrategy"
|
2017-06-02 13:44:28 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2017-12-04 07:37:15 +00:00
|
|
|
|
"execution_count": 2,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# 创建回测引擎对象\n",
|
|
|
|
|
"engine = BacktestingEngine()"
|
|
|
|
|
]
|
|
|
|
|
},
|
2018-08-06 07:04:24 +00:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# 使用历史数据缓存服务器,请先运行startHds.py\n",
|
|
|
|
|
"engine.initHdsClient() # 受限于机器内存,超出上限会报错"
|
|
|
|
|
]
|
|
|
|
|
},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2017-12-04 07:37:15 +00:00
|
|
|
|
"execution_count": 3,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"# 设置回测使用的数据 \n",
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"engine.setBacktestingMode(engine.BAR_MODE) # 设置引擎的回测模式为K线\n",
|
|
|
|
|
"engine.setDatabase(MINUTE_DB_NAME, 'IF0000') # 设置使用的历史数据库\n",
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"engine.setStartDate('20150101') # 设置回测用的数据起始日期"
|
2017-06-02 13:44:28 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2017-12-04 07:37:15 +00:00
|
|
|
|
"execution_count": 4,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# 配置回测引擎参数\n",
|
|
|
|
|
"engine.setSlippage(0.2) # 设置滑点为股指1跳\n",
|
|
|
|
|
"engine.setRate(0.3/10000) # 设置手续费万0.3\n",
|
|
|
|
|
"engine.setSize(300) # 设置股指合约大小 \n",
|
2017-07-14 12:12:42 +00:00
|
|
|
|
"engine.setPriceTick(0.2) # 设置股指最小价格变动 \n",
|
|
|
|
|
"engine.setCapital(1000000) # 设置回测本金"
|
2017-06-02 13:44:28 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"execution_count": 5,
|
|
|
|
|
"metadata": {},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"# 在引擎中创建策略对象\n",
|
|
|
|
|
"d = {'atrLength': 11} # 策略参数配置\n",
|
2018-01-11 08:03:42 +00:00
|
|
|
|
"engine.initStrategy(AtrRsiStrategy, d) # 创建策略对象\n",
|
2017-12-15 15:05:22 +00:00
|
|
|
|
"#ngine.initStrategy(MultiTimeframeStrategy, d) \n",
|
2018-01-11 08:03:42 +00:00
|
|
|
|
"#engine.initStrategy(MultiSignalStrategy, {}) "
|
2017-06-02 13:44:28 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"execution_count": 6,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
|
|
|
|
"2018-08-06 15:01:09.708000\t开始载入数据\n",
|
|
|
|
|
"2018-08-06 15:01:28.454000\t载入完成,数据量:155070\n",
|
|
|
|
|
"2018-08-06 15:01:28.454000\t开始回测\n",
|
|
|
|
|
"2018-08-06 15:01:28.504000\t策略初始化完成\n",
|
|
|
|
|
"2018-08-06 15:01:28.504000\t策略启动完成\n",
|
|
|
|
|
"2018-08-06 15:01:28.504000\t开始回放数据\n",
|
|
|
|
|
"2018-08-06 15:01:39.480000\t数据回放结束\n"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"source": [
|
|
|
|
|
"# 运行回测\n",
|
|
|
|
|
"engine.runBacktesting() # 运行回测"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"execution_count": 7,
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"metadata": {
|
2018-02-16 14:17:58 +00:00
|
|
|
|
"scrolled": false
|
2017-06-02 13:44:28 +00:00
|
|
|
|
},
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"outputs": [
|
|
|
|
|
{
|
|
|
|
|
"name": "stdout",
|
|
|
|
|
"output_type": "stream",
|
|
|
|
|
"text": [
|
|
|
|
|
"2018-08-06 15:02:11.279000\t计算按日统计结果\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t------------------------------\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t首个交易日:\t2015-01-12\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t最后交易日:\t2017-07-14\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t总交易日:\t612\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t盈利交易日\t297\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t亏损交易日:\t315\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t起始资金:\t1000000\n",
|
|
|
|
|
"2018-08-06 15:02:11.334000\t结束资金:\t1,133,650.64\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t总收益率:\t13.37%\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t年化收益:\t5.24%\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t总盈亏:\t133,650.64\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t最大回撤: \t-185,949.45\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t百分比最大回撤: -16.31%\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t总手续费:\t148,769.36\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t总滑点:\t267,420.0\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t总成交金额:\t4,958,978,520.0\n",
|
|
|
|
|
"2018-08-06 15:02:11.335000\t总成交笔数:\t4,457.0\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t日均盈亏:\t218.38\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t日均手续费:\t243.09\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t日均滑点:\t436.96\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t日均成交金额:\t8,102,906.08\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t日均成交笔数:\t7.28\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t日均收益率:\t0.02%\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\t收益标准差:\t1.72%\n",
|
|
|
|
|
"2018-08-06 15:02:11.336000\tSharpe Ratio:\t0.18\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAOOCAYAAACQsKPnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzsnXd8VeX9x9935mbvQRIgzEMYskVUEKzWWa1o1WqdrdW22qFW7a/O1lG1S+10VFpH3a0bFVTKUIEAYYUDgSRk731z9/39cUbuzZ4kuXnerxcv7jl57rnPc8c5n/OdBr/fj0AgEAgEAoFg/GAc6QkIBAKBQCAQCI4vQgAKBAKBQCAQjDOEABQIBAKBQCAYZwgBKBAIBAKBQDDOEAJQIBAIBAKBYJwhBKBAIBAIBALBOMM80hMQCASCoUKSpCzgCLBX3WUC7MCtsixv6eF5a4F9siz/drjnKBAIBKMBIQAFAkGo0SbL8gJtQ5KkS4G1wIwRm5FAIBCMMoQAFAgEoU4iUC5JkhH4A3ASEA0YgO91tAxKknQ9cCNgBRKA38iy/FdJkq4FLgJ8KGLSDlwjy3KeJElpwN+AWerf/ybL8pOSJMUCTwDzAAuwAfi5LMueYV6zQCAQ9IiIARQIBKFGuCRJu9V/RSgC7BFgGZAOLJdleTbwT+CuwCdKkhQF3ACcK8vyQuAy4LGAIacBt8iyPBf4KuD5fwEOybI8C1gOfF+SpOkogjNHluXFw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w+bDSjvxbYWKu9gXUCLG7/fz3OYCcorq6K2RUatTKTETYTURH2G
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"<matplotlib.figure.Figure at 0xcfee070>"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"output_type": "display_data"
|
|
|
|
|
}
|
|
|
|
|
],
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"source": [
|
2017-07-14 12:12:42 +00:00
|
|
|
|
"# 显示逐日回测结果\n",
|
2017-10-07 15:25:59 +00:00
|
|
|
|
"engine.showDailyResult()"
|
2017-06-02 13:44:28 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2017-10-07 14:36:23 +00:00
|
|
|
|
"execution_count": null,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-10-07 14:36:23 +00:00
|
|
|
|
"outputs": [],
|
2017-07-14 12:12:42 +00:00
|
|
|
|
"source": [
|
|
|
|
|
"# 显示逐笔回测结果\n",
|
|
|
|
|
"engine.showBacktestingResult()"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2017-10-07 14:36:23 +00:00
|
|
|
|
"execution_count": null,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-10-07 14:36:23 +00:00
|
|
|
|
"outputs": [],
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"source": [
|
|
|
|
|
"# 显示前10条成交记录\n",
|
|
|
|
|
"for i in range(10):\n",
|
2017-09-25 05:51:24 +00:00
|
|
|
|
" d = engine.tradeDict[str(i+1)].__dict__\n",
|
|
|
|
|
" print 'TradeID: %s, Time: %s, Direction: %s, Price: %s, Volume: %s' %(d['tradeID'], d['dt'], d['direction'], d['price'], d['volume'])"
|
2017-06-02 13:44:28 +00:00
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"execution_count": null,
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"source": [
|
|
|
|
|
"# 优化配置\n",
|
|
|
|
|
"setting = OptimizationSetting() # 新建一个优化任务设置对象\n",
|
2018-01-08 09:28:30 +00:00
|
|
|
|
"setting.setOptimizeTarget('totalNetPnl') # 设置优化排序的目标是策略净盈利\n",
|
|
|
|
|
"setting.addParameter('atrLength', 12, 16, 2) # 增加第一个优化参数atrLength,起始12,结束20,步进2\n",
|
2018-02-16 14:17:58 +00:00
|
|
|
|
"#setting.addParameter('atrMa', 20, 30, 5) # 增加第二个优化参数atrMa,起始20,结束30,步进5\n",
|
|
|
|
|
"#setting.addParameter('rsiLength', 5) # 增加一个固定数值的参数\n",
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"\n",
|
|
|
|
|
"# 执行多进程优化\n",
|
|
|
|
|
"import time\n",
|
2017-09-25 05:51:24 +00:00
|
|
|
|
"start = time.time()\n",
|
2018-02-16 14:17:58 +00:00
|
|
|
|
"#resultList = engine.runParallelOptimization(AtrRsiStrategy, setting)\n",
|
|
|
|
|
"resultList = engine.runOptimization(AtrRsiStrategy, setting)\n",
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"print u'耗时:%s' %(time.time()-start)"
|
|
|
|
|
]
|
|
|
|
|
},
|
2018-01-08 09:28:30 +00:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
2018-01-11 08:03:42 +00:00
|
|
|
|
"execution_count": null,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2018-01-11 08:03:42 +00:00
|
|
|
|
"outputs": [],
|
2018-01-08 09:28:30 +00:00
|
|
|
|
"source": [
|
|
|
|
|
"# 显示优化的所有统计数据\n",
|
|
|
|
|
"for result in resultList:\n",
|
|
|
|
|
" print '-' * 30\n",
|
|
|
|
|
" print u'参数:%s,目标:%s' %(result[0], result[1])\n",
|
|
|
|
|
" print u'统计数据:'\n",
|
|
|
|
|
" for k, v in result[2].items():\n",
|
|
|
|
|
" print u'%s:%s' %(k, v)"
|
|
|
|
|
]
|
|
|
|
|
},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
"execution_count": null,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"metadata": {},
|
2017-06-02 13:44:28 +00:00
|
|
|
|
"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",
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"version": "2.7.14"
|
2017-06-02 13:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"nbformat": 4,
|
2018-08-06 07:04:24 +00:00
|
|
|
|
"nbformat_minor": 1
|
2017-06-02 13:44:28 +00:00
|
|
|
|
}
|