get_prior_timestamp#

API documentation for tradingstrategy.utils.time.get_prior_timestamp Python function.

get_prior_timestamp(series, ts)[source]#

Get the first timestamp in the index that is before the given timestamp.

Returns:

Any timestamp from the index that is before or at the same time of the given timestamp.

Return None if there are no earlier timestamps.

Parameters:
Return type:

pandas._libs.tslibs.timestamps.Timestamp | None