quantlab.factor.predefined.fundamental_alpha.fill_flows#

quantlab.factor.predefined.fundamental_alpha.fill_flows(arrays, columns, priced)[source]#

Make event or trade flows 0 where NaN on a priced bar, in place.

A flow is NaN on a bar without a price (priced False: a delisted or not yet listed stock) and on every bar before the first one on which any symbol has a non-zero value of any of columns, the source’s start.

Examples

>>> arrays = {"buy": np.array([[0.0, np.nan], [np.nan, 2.0], [np.nan, np.nan]])}
>>> fill_flows(arrays, ["buy"], np.array([[True, True], [True, True], [True, False]]))
>>> arrays["buy"].tolist()
[[nan, nan], [0.0, 2.0], [0.0, nan]]