quantlab.factor.predefined.intraday.session_inputs#
- quantlab.factor.predefined.intraday.session_inputs(session, open_, close, auction_close)[source]#
Return the session inputs of
IntradayStatsfor[time, symbol]prices.- Parameters:
- sessionnp.ndarray
The session label of each bar,
[time], bars in time order.- open_, close, auction_closenp.ndarray
[time, symbol]bar open, bar close and closing-auction price; NaN where the bar has none.
- Returns:
- dict[str, np.ndarray]
SESSION_POSITION,SESSION_BARS_LEFT,LAST_PRICE,REFERENCE_PRICE,FIRST_PRICEandPRIOR_CLOSEas contiguous float32[time, symbol]arrays.
Examples
>>> s = np.array([0, 0, 0, 1, 1]) >>> c = np.array([[10.0], [np.nan], [11.0], [12.0], [np.nan]]) >>> out = session_inputs(s, c - 1, c, np.full_like(c, np.nan)) >>> out[LAST_PRICE][:, 0].tolist() [10.0, 10.0, 11.0, 12.0, 12.0] >>> out[REFERENCE_PRICE][:, 0].tolist() [9.0, 10.0, 10.0, 11.0, 12.0] >>> out[PRIOR_CLOSE][:, 0].tolist() [nan, nan, nan, 11.0, 11.0]