Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_sma():
"""test TA.ma"""
ma = TA.SMA(ohlc, 14)
assert isinstance(ma, series.Series)
assert ma.values[-1] == 6922.3392206307135
def test_tema():
"""test TA.TEMA"""
ma = TA.TEMA(ohlc)
assert isinstance(ma, series.Series)
assert ma.values[-1] == 6307.4815184378531
def test_trending_up():
df = to_dataframe(data)
ma = TA.HMA(df)
assert isinstance(trending_up(ma, 10), Series)
assert not trending_up(ma, 10).values[-1]
def test_trending_down():
df = to_dataframe(data)
ma = TA.HMA(df)
assert isinstance(trending_down(ma, 10), Series)
assert trending_down(ma, 10).values[-1]
def test_adx():
"""test TA.ADX"""
adx = TA.ADX(ohlc)
assert isinstance(adx, series.Series)
assert adx.values[-1] == 54.781005617031234
def test_cci():
"""test TA.CCI"""
cci = TA.CCI(ohlc)
assert isinstance(cci, series.Series)
assert cci.values[-1] == -85.685463804097068
def test_chaikin():
"""test TA.CHAIKIN"""
c = TA.CHAIKIN(ohlc)
assert isinstance(c, series.Series)
assert c.values[-1] == 650594.74888467789
def test_er():
"""test TA.ER"""
er = TA.ER(ohlc)
assert isinstance(er, series.Series)
assert -100 < er.values[-1] < 100
def test_fish():
"""test TA.FISH"""
fish = TA.FISH(ohlc)
assert isinstance(fish, series.Series)
assert fish.values[-1] == -2.2918315334720125
def test_ppo():
"""test TA.PPO"""
ppo = TA.PPO(ohlc)
assert isinstance(ppo["PPO"], series.Series)
assert isinstance(ppo["SIGNAL"], series.Series)
assert isinstance(ppo["HISTO"], series.Series)
assert ppo["PPO"].values[-1] == -5.85551658018139331574047901085578
assert ppo["SIGNAL"].values[-1] == -5.05947256175217674467603501398116
assert ppo["HISTO"].values[-1] == -0.79604401842921657106444399687462