Better, faster EMAs | Deephaven

Better, faster EMAs | Deephaven


from deephaven import time_table
from deephaven.updateby import ema_time

t1 = time_table('PT00:00:00.1')
.update(["Label = ii%2 == 0 ? `cos` : `sin`", "X = ii%2 == 0 ? cos(0.05*ii)+0.7*random() : sin(0.01*ii)+0.7*random()"])

t2 = t1.update_by([ema_time("Timestamp", "PT00:00:01", "XEma=X")], by="Label")

from deephaven.plot import Figure

p = Figure()
.plot_xy("Value", t=t2, x="Timestamp", y="X", by=["Label"])
.plot_xy("EMA", t=t2, x="Timestamp", y="XEma", by=["Label"])
.show()



Source link
lol

By stp2y

Leave a Reply

Your email address will not be published. Required fields are marked *

No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.