From f12445f88b67fb9fdf98674134563c3b9d9e6814 Mon Sep 17 00:00:00 2001 From: hackerwei Date: Fri, 7 Apr 2017 20:30:44 +0800 Subject: [PATCH] typo & error in kk strategy --- vn.trader/ctaStrategy/ctaEngine.py | 4 ++-- vn.trader/ctaStrategy/strategy/strategyKingKeltner.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vn.trader/ctaStrategy/ctaEngine.py b/vn.trader/ctaStrategy/ctaEngine.py index 79968410..65f136aa 100644 --- a/vn.trader/ctaStrategy/ctaEngine.py +++ b/vn.trader/ctaStrategy/ctaEngine.py @@ -91,7 +91,7 @@ class CtaEngine(object): req = VtOrderReq() req.symbol = contract.symbol req.exchange = contract.exchange - req.price = self.roundToPrickTick(contract.priceTick, price) + req.price = self.roundToPriceTick(contract.priceTick, price) req.volume = volume req.productClass = strategy.productClass @@ -574,7 +574,7 @@ class CtaEngine(object): strategy.pos = d['pos'] #---------------------------------------------------------------------- - def roundToPrickTick(self, priceTick, price): + def roundToPriceTick(self, priceTick, price): """取整价格到合约最小价格变动""" if not priceTick: return price diff --git a/vn.trader/ctaStrategy/strategy/strategyKingKeltner.py b/vn.trader/ctaStrategy/strategy/strategyKingKeltner.py index 27bb87cc..6c1e64aa 100644 --- a/vn.trader/ctaStrategy/strategy/strategyKingKeltner.py +++ b/vn.trader/ctaStrategy/strategy/strategyKingKeltner.py @@ -228,7 +228,7 @@ class KkStrategy(CtaTemplate): self.intraTradeHigh = bar.high self.intraTradeLow = min(self.intraTradeLow, bar.low) - orderID = self.buy(self.intraTradeLow*(1+self.trailingPrcnt/100), + orderID = self.cover(self.intraTradeLow*(1+self.trailingPrcnt/100), abs(self.pos), True) self.orderList.append(orderID)