quantlab.factor.predefined.fundamental_alpha.report_lags#
- quantlab.factor.predefined.fundamental_alpha.report_lags(values, key, lags, quarter_days, tolerance_days)[source]#
Return each column’s value
kreports ago, keyed by its period end.A report is a run of bars showing the same period end
key(days since 1970, NaN where nothing is shown). On a bar of reportr, the valuekreports ago is the last value shown during reportr - k, so it was public before the bar. It is NaN unless that report exists and its period endsk * quarter_days(withintolerance_days) before the current one.- Parameters:
- valuesdict of str to numpy.ndarray
Panels on
[time, symbol].- keynumpy.ndarray
The period end of each cell,
[time, symbol].- lagsdict of str to tuple of int
The lags wanted per column of
values.- quarter_days, tolerance_daysfloat
The spacing check.
- Returns:
- dict of str to numpy.ndarray
"<column>__q<k>"-> float32 panel, one per column and lag.
Examples
>>> key = np.array([[0.0], [0.0], [91.0], [182.0]]) >>> out = report_lags({"x": np.array([[1.0], [2.0], [3.0], [4.0]])}, key, {"x": (1,)}, 91.0, 10.0) >>> out["x__q1"].ravel().tolist() [nan, nan, 2.0, 3.0]