MCPcopy Create free account
hub / github.com/Open-Quant/openquant / register

Function register

crates/pyopenquant/src/fast_ewma.rs:8–14  ·  view source on GitHub ↗
(py: Python<'_>, parent: &Bound<'_, PyModule>)

Source from the content-addressed store, hash-verified

6///
7/// Matches `mlfinlab.util.fast_ewma.ewma` and pandas' `ewm(span=window, adjust=True).mean()`:
8/// with `alpha = 2 / (window + 1)`, output `t` is the weighted mean of every value so far,
9/// with weight `(1 - alpha)^k` on the value `k` steps back. The first output equals the first
10/// input, and `window = 1` returns the input unchanged. `window` is a span, not a hard
11/// lookback. Values are not validated: a NaN makes that output and every later one NaN
12/// (pandas would skip it).
13///
14/// Parameters
15/// ----------
16/// arr : list[float]
17/// Input series, oldest first.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected