From 846e677bbc85caab009724f7cdca88b00febf912 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sun, 11 Nov 2018 15:25:59 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=B5=B7=E9=BE=9F=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.ipynb_checkpoints/run-checkpoint.ipynb | 62 ++++++++---- examples/TurtleStrategy/run.ipynb | 43 +++++++- examples/TurtleStrategy/turtleStrategy.py | 98 ++++++++++--------- 3 files changed, 132 insertions(+), 71 deletions(-) diff --git a/examples/TurtleStrategy/.ipynb_checkpoints/run-checkpoint.ipynb b/examples/TurtleStrategy/.ipynb_checkpoints/run-checkpoint.ipynb index b17f25a5..438216aa 100644 --- a/examples/TurtleStrategy/.ipynb_checkpoints/run-checkpoint.ipynb +++ b/examples/TurtleStrategy/.ipynb_checkpoints/run-checkpoint.ipynb @@ -20,33 +20,29 @@ "cell_type": "code", "execution_count": 2, "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "coercing to Unicode: need string or buffer, int found", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mengine\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mBacktestingEngine\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[0mengine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msetPeriod\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdatetime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m2015\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdatetime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m2018\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m11\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m9\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mengine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minitPortfolio\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m10000000\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'setting.csv'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;32mC:\\Github\\vnpy\\examples\\TurtleStrategy\\turtleEngine.py\u001b[0m in \u001b[0;36minitPortfolio\u001b[1;34m(self, filename, portfolioValue)\u001b[0m\n\u001b[0;32m 60\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0minitPortfolio\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mportfolioValue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10000000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 61\u001b[0m \u001b[1;34m\"\"\"\"\"\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 62\u001b[1;33m \u001b[1;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 63\u001b[0m \u001b[0mr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDictReader\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 64\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0md\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mr\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: coercing to Unicode: need string or buffer, int found" - ] - } - ], + "outputs": [], "source": [ "engine = BacktestingEngine()\n", "engine.setPeriod(datetime(2015, 1, 1), datetime(2018, 11, 9))\n", - "engine.initPortfolio('setting.csv')" + "engine.initPortfolio('setting.csv', 10000000)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "scrolled": false }, - "outputs": [], + "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", @@ -82,17 +78,45 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEDCAYAAAA849PJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJ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67ccBKwOfhf8F8hLpcwB8H3gfWAP8CUhJtM/AUG9aCkJEJEHFWxOQiIgMkAKAiEiCUgAQEUlQCgAiIglKAUBEJEEpAIiIJCgFABGRBPX/AaYCviKP8gmWAAAAAElFTkSuQmCC\n", + "text/plain": [ + "" + ] + }, + "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, diff --git a/examples/TurtleStrategy/run.ipynb b/examples/TurtleStrategy/run.ipynb index a1862ccf..2f34f25b 100644 --- a/examples/TurtleStrategy/run.ipynb +++ b/examples/TurtleStrategy/run.ipynb @@ -18,7 +18,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -29,11 +29,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "scrolled": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "15:23:05.294000:IF99数据加载完成,总数据量:940\n", + "15:23:05.323000:I99数据加载完成,总数据量:940\n", + "15:23:05.348000:CU99数据加载完成,总数据量:940\n", + "15:23:05.375000:TA99数据加载完成,总数据量:940\n", + "15:23:05.375000:全部数据加载完成\n" + ] + } + ], "source": [ "engine.loadData()\n", "engine.runBacktesting()\n", @@ -69,11 +81,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "scrolled": true }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[]" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEDCAYAAAAhsS8XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cG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DzwOvBDa23ZiQ5tZVuPfi7GmIuAAmvtyuabWznUdmBfTxUOnAQ8aa2dBFRytNmlNSH3DNzvDy4BBgH9gDhcTU7HCuXvQZf0pMCeD+Q0W88G9geoLD5ljInAFdT/aa2d6958yBiT5d6fBRS4t4ficzkVuNgYswt4GVdzzB+BZGNMUxqM5p/T8wzc+5OAYn8W2AfygXxr7TL3+mu4An1v+h6cBey01hZaa+uBucB0etf3oEt6UmD/HBjmfiMeieslytsBLpPXGWMM8Fdgo7X2D812vQ1c516+Dlfbe9P2a929Ik4BSq2PE7H5mrV2jrU221o7ENff80fW2m8CC4Er3Icd+wyans0V7uN7dE3NWnsQ2GuMGeHedCbwJb3oe4CrCeYUY0ys+99F0zPoNd+DLgt0I39nfoALgC3AduDuQJfHR5/xNFz/fVwLrHb/XICrrXABsNX9Z6r7eIOrt9B2YB2uHgQB/xxefB4zgXfcy4OB5cA24FUgyr092r2+zb1/cKDL7aXPPhFY4f4uvAmk9LbvAXAvsAlXSvB/AFG97XvQlR+lFBARCTE9qSlGREQ6QIFdRCTEKLCLiIQYBXYRkRCjwC4iEmIU2EVEQowCu4hIiPl/ug9zMY61xdEAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "l = [result.totalPnl for result in engine.resultList]\n", "equity = np.cumsum(l)\n", diff --git a/examples/TurtleStrategy/turtleStrategy.py b/examples/TurtleStrategy/turtleStrategy.py index 3d885eec..1b138a9c 100644 --- a/examples/TurtleStrategy/turtleStrategy.py +++ b/examples/TurtleStrategy/turtleStrategy.py @@ -18,7 +18,7 @@ class TurtleResult(object): #---------------------------------------------------------------------- def __init__(self): """Constructor""" - self.pos = 0 + self.unit = 0 self.entry = 0 # 开仓均价 self.exit = 0 # 平仓均价 self.pnl = 0 # 盈亏 @@ -26,16 +26,16 @@ class TurtleResult(object): #---------------------------------------------------------------------- def open(self, price, change): """开仓或者加仓""" - cost = self.pos * self.entry # 计算之前的开仓成本 + cost = self.unit * self.entry # 计算之前的开仓成本 cost += change * price # 加上新仓位的成本 - self.pos += change # 加上新仓位的数量 - self.entry = cost / self.pos # 计算新的平均开仓成本 + self.unit += change # 加上新仓位的数量 + self.entry = cost / self.unit # 计算新的平均开仓成本 #---------------------------------------------------------------------- def close(self, price): """平仓""" self.exit = price - self.pnl = self.pos * (self.exit - self.entry) + self.pnl = self.unit * (self.exit - self.entry) ######################################################################## @@ -75,7 +75,7 @@ class TurtleSignal(object): self.shortEntry4 = 0 self.shortStop = 0 # 空头止损位 - self.pos = 0 # 信号持仓 + self.unit = 0 # 信号持仓 self.result = None # 当前的交易 self.resultList = [] # 交易列表 self.bar = None # 最新K线 @@ -102,34 +102,34 @@ class TurtleSignal(object): return # 优先检查平仓 - if self.pos > 0: + if self.unit > 0: longExit = max(self.longStop, self.exitDown) if bar.low <= longExit: self.sell(longExit) return - elif self.pos < 0: + elif self.unit < 0: shortExit = min(self.shortStop, self.exitUp) if bar.high >= shortExit: self.cover(shortExit) return # 没有仓位或者持有多头仓位的时候,可以做多(加仓) - if self.pos >= 0: + if self.unit >= 0: trade = False - if bar.high >= self.longEntry1 and self.pos < 1: + if bar.high >= self.longEntry1 and self.unit < 1: self.buy(self.longEntry1, 1) trade = True - if bar.high >= self.longEntry2 and self.pos < 2: + if bar.high >= self.longEntry2 and self.unit < 2: self.buy(self.longEntry2, 1) trade = True - if bar.high >= self.longEntry3 and self.pos < 3: + if bar.high >= self.longEntry3 and self.unit < 3: self.buy(self.longEntry3, 1) trade = True - if bar.high >= self.longEntry4 and self.pos < 4: + if bar.high >= self.longEntry4 and self.unit < 4: self.buy(self.longEntry4, 1) trade = True @@ -137,17 +137,17 @@ class TurtleSignal(object): return # 没有仓位或者持有空头仓位的时候,可以做空(加仓) - if self.pos <= 0: - if bar.low <= self.shortEntry1 and self.pos > -1: + if self.unit <= 0: + if bar.low <= self.shortEntry1 and self.unit > -1: self.short(self.shortEntry1, 1) - if bar.low <= self.shortEntry2 and self.pos > -2: + if bar.low <= self.shortEntry2 and self.unit > -2: self.short(self.shortEntry2, 1) - if bar.low <= self.shortEntry3 and self.pos > -3: + if bar.low <= self.shortEntry3 and self.unit > -3: self.short(self.shortEntry3, 1) - if bar.low <= self.shortEntry4 and self.pos > -4: + if bar.low <= self.shortEntry4 and self.unit > -4: self.short(self.shortEntry4, 1) #---------------------------------------------------------------------- @@ -157,7 +157,7 @@ class TurtleSignal(object): self.exitUp, self.exitDown = self.am.donchian(self.exitWindow) # 有持仓后,ATR波动率和入场位等都不再变化 - if not self.pos: + if not self.unit: self.atrVolatility = self.am.atr(self.atrWindow) self.longEntry1 = self.entryUp @@ -190,7 +190,7 @@ class TurtleSignal(object): def sell(self, price): """卖出平仓""" price = self.calculateTradePrice(DIRECTION_SHORT, price) - volume = abs(self.pos) + volume = abs(self.unit) self.close(price) self.newSignal(DIRECTION_SHORT, OFFSET_CLOSE, price, volume) @@ -210,7 +210,7 @@ class TurtleSignal(object): def cover(self, price): """买入平仓""" price = self.calculateTradePrice(DIRECTION_LONG, price) - volume = abs(self.pos) + volume = abs(self.unit) self.close(price) self.newSignal(DIRECTION_LONG, OFFSET_CLOSE, price, volume) @@ -218,7 +218,7 @@ class TurtleSignal(object): #---------------------------------------------------------------------- def open(self, price, change): """开仓""" - self.pos += change + self.unit += change if not self.result: self.result = TurtleResult() @@ -227,7 +227,7 @@ class TurtleSignal(object): #---------------------------------------------------------------------- def close(self, price): """平仓""" - self.pos = 0 + self.unit = 0 self.result.close(price) self.resultList.append(self.result) @@ -266,14 +266,15 @@ class TurtlePortfolio(object): self.signalDict = defaultdict(list) - self.posDict = {} # 每个品种的持仓情况 + self.unitDict = {} # 每个品种的持仓情况 self.totalLong = 0 # 总的多头持仓 self.totalShort = 0 # 总的空头持仓 self.tradingDict = {} # 交易中的信号字典 self.sizeDict = {} # 合约大小字典 - self.unitDict = {} # 按照波动幅度计算的委托量单位字典 + self.multiplierDict = {} # 按照波动幅度计算的委托量单位字典 + self.posDict = {} # 真实持仓量字典 self.portfolioValue = 0 # 组合市值 @@ -291,6 +292,7 @@ class TurtlePortfolio(object): l.append(signal1) l.append(signal2) + self.unitDict[vtSymbol] = 0 self.posDict[vtSymbol] = 0 #---------------------------------------------------------------------- @@ -302,17 +304,17 @@ class TurtlePortfolio(object): #---------------------------------------------------------------------- def newSignal(self, signal, direction, offset, price, volume): """对交易信号进行过滤,符合条件的才发单执行""" - pos = self.posDict[signal.vtSymbol] + unit = self.unitDict[signal.vtSymbol] # 如果当前无仓位,则重新根据波动幅度计算委托量单位 - if not pos: + if not unit: size = self.sizeDict[signal.vtSymbol] riskValue = self.portfolioValue * 0.01 - unit = riskValue / (signal.atrVolatility * size) - unit = int(round(unit, 0)) - self.unitDict[signal.vtSymbol] = unit + multiplier = riskValue / (signal.atrVolatility * size) + multiplier = int(round(multiplier, 0)) + self.multiplierDict[signal.vtSymbol] = multiplier else: - unit = self.unitDict[signal.vtSymbol] + multiplier = self.multiplierDict[signal.vtSymbol] # 开仓 if offset == OFFSET_OPEN: @@ -329,29 +331,29 @@ class TurtlePortfolio(object): return # 单品种持仓不能超过上限 - if self.posDict[signal.vtSymbol] >= MAX_PRODUCT_POS: + if self.unitDict[signal.vtSymbol] >= MAX_PRODUCT_POS: return # 卖出 else: if self.totalShort <= -MAX_DIRECTION_POS: return - if self.posDict[signal.vtSymbol] <= -MAX_PRODUCT_POS: + if self.unitDict[signal.vtSymbol] <= -MAX_PRODUCT_POS: return # 平仓 else: if direction == DIRECTION_LONG: # 必须有空头持仓 - if pos >= 0: + if unit >= 0: return # 平仓数量不能超过空头持仓 - volume = min(volume, abs(pos)) + volume = min(volume, abs(unit)) else: - if pos <= 0: + if unit <= 0: return - volume = min(volume, abs(pos)) + volume = min(volume, abs(unit)) # 获取当前交易中的信号,如果不是本信号,则忽略 currentSignal = self.tradingDict.get(signal.vtSymbol, None) @@ -365,27 +367,29 @@ class TurtlePortfolio(object): else: self.tradingDict.pop(signal.vtSymbol) - self.sendOrder(signal.vtSymbol, direction, offset, price, volume, unit) + self.sendOrder(signal.vtSymbol, direction, offset, price, volume, multiplier) #---------------------------------------------------------------------- - def sendOrder(self, vtSymbol, direction, offset, price, volume, unit): + def sendOrder(self, vtSymbol, direction, offset, price, volume, multiplier): """""" # 计算合约持仓 if direction == DIRECTION_LONG: - self.posDict[vtSymbol] += volume + self.unitDict[vtSymbol] += volume + self.posDict[vtSymbol] += volume * multiplier else: - self.posDict[vtSymbol] -= volume + self.unitDict[vtSymbol] -= volume + self.posDict[vtSymbol] -= volume * multiplier # 计算总持仓 self.totalLong = 0 self.totalShort = 0 - for pos in self.posDict.values(): - if pos > 0: - self.totalLong += pos - elif pos < 0: - self.totalShort += pos + for unit in self.unitDict.values(): + if unit > 0: + self.totalLong += unit + elif unit < 0: + self.totalShort += unit # 向回测引擎中发单记录 - self.engine.sendOrder(vtSymbol, direction, offset, price, volume*unit) + self.engine.sendOrder(vtSymbol, direction, offset, price, volume*multiplier) \ No newline at end of file