From 93ee7c35e9f131d1bba4fec645324a86bf4d58aa Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sat, 7 Oct 2017 13:01:10 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=E7=A7=BB=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/app/ctaStrategy/ctaTemplate.py | 43 ---------------------- 1 file changed, 43 deletions(-) diff --git a/vnpy/trader/app/ctaStrategy/ctaTemplate.py b/vnpy/trader/app/ctaStrategy/ctaTemplate.py index 0eb7957b..d691c270 100644 --- a/vnpy/trader/app/ctaStrategy/ctaTemplate.py +++ b/vnpy/trader/app/ctaStrategy/ctaTemplate.py @@ -372,49 +372,6 @@ class BarManager(object): # 缓存Tick self.lastTick = tick - - #---------------------------------------------------------------------- - def updateBar(self, bar): - """1分钟K线更新""" - newX = False # 默认不是新的X分钟 - - # 尚未创建对象 - if not self.xminBar: - self.xminBar = VtBarData() - newX = True - # X分钟已经走完 - elif not bar.datetime.minute % self.xmin: # 可以用X整除 - # 生成上一X分钟K线的时间戳 - self.xminBar.datetime = self.xminBar.datetime.replace(second=0, microsecond=0) # 将秒和微秒设为0 - self.xminBar.date = self.xminBar.datetime.strftime('%Y%m%d') - self.xminBar.time = self.xminBar.datetime.strftime('%H:%M:%S.%f') - - # 推送 - self.onXminBar(self.xminBar) - - # 创建新的K线 - self.xminBar = VtBarData() - newX = True - - # 初始化K线数据 - if newX: - self.xminBar.vtSymbol = bar.vtSymbol - self.xminBar.symbol = bar.symbol - self.xminBar.exchange = bar.exchange - - self.xminBar.open = bar.open - self.xminBar.high = bar.high - self.xminBar.low = bar.low - # 累加老K线 - else: - self.xminBar.high = max(self.xminBar.high, bar.high) - self.xminBar.low = min(self.xminBar.low, bar.low) - - # 通用部分 - self.xminBar.close = bar.close - self.xminBar.datetime = bar.datetime - self.xminBar.openInterest = bar.openInterest - self.xminBar.volume += int(bar.volume) #---------------------------------------------------------------------- def updateBar(self, bar):