self.get_datetime_range#

lumibot.strategies.strategy.Strategy.get_datetime_range(self, length, timestep='minute', timeshift=None)#

Returns a list of datetimes for the given length and timestep.

Parameters:
  • length (int) – The number of datetimes to return.

  • timestep (str) – The timestep of the datetimes.

  • timeshift (int) – The number of timesteps to shift the datetimes.

Returns:

A list of datetimes.

Return type:

list

Example

>>> # Will return a list of datetimes for the current day
>>> datetimes = self.get_datetime_range(length=1, timestep="day")
>>> self.log_message(f"Datetimes: {datetimes}")