quantlab.factor.kunquant_ts.EWAlpha#
- class quantlab.factor.kunquant_ts.EWAlpha(y, x, window, half_life)[source]#
Bases:
_EWWindowOpIntercept of the exponentially weighted least-squares fit of
yonx.alpha = m_y - beta * m_x, withbetaas inEWBetaand the EW means taken over the bars where both are valid.- Parameters:
- yOpBase
The regressand.
- xOpBase
The regressor.
- 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(EWAlpha(Input("excess"), Input("market_excess"), 252, 63), "alpha")