quantlab.factor.kunquant_ts.EWAlpha#

class quantlab.factor.kunquant_ts.EWAlpha(y, x, window, half_life)[source]#

Bases: _EWWindowOp

Intercept of the exponentially weighted least-squares fit of y on x.

alpha = m_y - beta * m_x, with beta as in EWBeta and 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 < 1 or half_life <= 0.

Examples

>>> Output(EWAlpha(Input("excess"), Input("market_excess"), 252, 63), "alpha")
decompose(options)[source]#

Expand into two window loops; KunQuant calls this while compiling.