self.get_timestamp

lumibot.strategies.strategy.Strategy.get_timestamp(self)

Returns the current timestamp according to the data source. In a backtest this will be the current bar’s timestamp. In live trading this will be the current timestamp on the exchange.

Returns:

The current timestamp.

Return type:

int

Example

>>> # Will return the current timestamp
>>> timestamp = self.get_timestamp()
>>> self.log_message(f"The current timestamp is {timestamp}")