quantlab.factor.kunquant_ts.EWMean#
- class quantlab.factor.kunquant_ts.EWMean(v, window, half_life)[source]#
Bases:
_EWWindowOpExponentially weighted window mean,
sum(w * x) / sum(w)over valid bars.The weights are those of
EWSum; dividing by the sum of the weights of the valid bars normalizes them. The result is NaN for the firstwindow - 1bars and for a window with no valid value.- Parameters:
- vOpBase
The input series.
- windowint
Number of trailing bars, the current one included.
- half_lifefloat
Age in bars at which the weight is one half.
- Raises:
- ValueError
If
window < 1orhalf_life <= 0.
Examples
>>> Output(EWMean(Input("ret"), 252, 63), "ret_ew_mean")