quantlab.factor.predefined.fundamental_alpha.value_on_dates#

quantlab.factor.predefined.fundamental_alpha.value_on_dates(values, dates, timestamps)[source]#

Return, per cell, values of its symbol on the last bar on or before the cell’s date.

Parameters:
valuesnumpy.ndarray

A [time, symbol] panel on the bars timestamps.

datesnumpy.ndarray

A [time, symbol] datetime64 panel (NaT where none).

timestampsnumpy.ndarray

The bars, sorted.

Returns:
numpy.ndarray

float32, NaN where the date is NaT or before the first bar.

Examples

>>> bars = np.array(["2024-01-02", "2024-01-03"], dtype="datetime64[ns]")
>>> dates = np.array([["NaT"], ["2024-01-02"]], dtype="datetime64[ns]")
>>> value_on_dates(np.array([[1.0], [2.0]]), dates, bars).ravel().tolist()
[nan, 1.0]