time#

API documentation for tradingstrategy.utils.time Python module in Trading Strategy.

Module description#

Helpers to timestamp format and value conformity.

  • We are operating on naive Python datetimes, all in UTC timezone

Functions#

assert_compatible_timestamp(ts)

Check we do not get in bad input timestamps.

generate_monthly_timestamps(start, end)

Generate timestamps from the start to the end.

get_prior_timestamp(series, ts)

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

is_compatible_timestamp(ts)

Ensure Pandas Timestamp is naive.

naive_utcfromtimestamp(timestamp)

Get naive UTC datetime from UNIX time.

naive_utcnow()

Get utcnow() but without timezone information.

to_int_unix_timestamp(dt)

Get datetime as UTC seconds since epoch.