为什么方法更新中没有定义变量freq?我在 init 上调用方法蜡烛,这个方法包含频率?
class candle:
def __init__(self):
self.freq = None
self.open_price = None
self.high_price = None
self.low_price = None
self.last_price = None
self.volume = 0
def addTick(self,tick):
if self.open_price is None:
self.open_price = tick.price
if self.high_price is None or tick.price >self.high_price:
self.high_price = tick.price
if self.low_price is None or tick.price <self.low_price:
self.low_price = tick.price
self.last_price = tick.price
self.volume = self.volume +1
def update(self,tick):
self.candle.addTick(tick)
if keyfunc(current_time,freq) != reference_timestamp[freq]:
self.notify(self.candle)
self.candle = candle()