def after_market_closes

This lifecycle method is executed right after the market closes.

class MyStrategy(Strategy):
    def after_market_closes(self):
        pass

Reference

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

Use this lifecycle method to execute code after market closes. For example dumping stats/reports. This method is called after the last on_trading_iteration.

Parameters:

None

Return type:

None

Example

>>> # Dump stats
>>> def after_market_closes(self):
>>>     self.log_message("The market is closed")
>>>     self.log_message(f"The total value of our portfolio is {self.portfolio_value}")
>>>     self.log_message(f"The amount of cash we have is {self.cash})