def test_bollinger_bands(): candles = np.array(bollinger_bands_candles) bb = ta.bollinger_bands(candles) u, m, l = bb assert type(bb).__name__ == 'BollingerBands' assert round(u, 1) == 145.8 assert round(m, 1) == 141.2 assert round(l, 1) == 136.7 seq_bb = ta.bollinger_bands(candles, sequential=True) assert seq_bb.upperband[-1] == u assert len(seq_bb.upperband) == len(candles) assert len(seq_bb.middleband) == len(candles) assert len(seq_bb.lowerband) == len(candles)
def bb(self): # Bollinger bands using default parameters and hl2 as source return ta.bollinger_bands(self.candles, source_type="hl2")