Hide navigation sidebar
Hide table of contents sidebar
Toggle table of contents sidebar

# self.localize_datetime

lumibot.strategies.strategy.Strategy.localize_datetime(self, dt)

  Returns a datetime localized to the data source’s timezone.

  Parameters

    dt (datetime.datetime) – The datetime to localize.

  Returns

    The localized datetime.

  Return type

    datetime.datetime

  Example

      >>> # Will return a datetime localized to the data source's timezone
      >>> localize_datetime = self.localize_datetime(dt=datetime.datetime(2020, 1, 1))
      >>> self.log_message(f"Localized datetime: {localize_datetime}")