self.to_default_timezone¶
- lumibot.strategies.strategy.Strategy.to_default_timezone(self, dt: datetime)¶
Returns a datetime localized to the data source’s default 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 default timezone >>> to_default_timezone = self.to_default_timezone(dt=datetime.datetime(2020, 1, 1)) >>> self.log_message(f"Localized datetime: {to_default_timezone}")