quantlab.utils.resample.clock_labels#
- quantlab.utils.resample.clock_labels(timestamps, freq)[source]#
Return each timestamp’s bar, floored on the UTC clock.
This is the default bucketing: a bar starts at a multiple of
freqcounted from midnight UTC and is labelled at its start, which matches bars labelled at their open time and daily stores stamped at midnight.Examples
>>> ts = pd.to_datetime(["2024-01-01 09:31", "2024-01-01 09:34", "2024-01-01 09:35"]) >>> clock_labels(ts, "5m").astype("datetime64[m]").tolist() [2024-01-01T09:30, 2024-01-01T09:30, 2024-01-01T09:35]