def test_ema2(self): ret = ts.run(ts.EMA(ts.Foo(foo4), alpha=1 / 10, adjust=True)) comp = pd.Series([_ for _ in range(10)]).ewm(alpha=1 / 10, adjust=True).mean() for i, x in enumerate(ret): assert (x - comp[i]) < 0.001
def test_ema(self): ret = ts.run(ts.EMA(ts.Foo(foo4))) comp = pd.Series([_ for _ in range(10)]).ewm(span=10, adjust=False).mean() for i, x in enumerate(ret): assert (x - comp[i]) < 0.001