[Fix]移除重复函数
This commit is contained in:
parent
3017f70172
commit
93ee7c35e9
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user