self.await_market_to_close#

lumibot.strategies.strategy.Strategy.await_market_to_close(self, timedelta=None)#

Sleep until market closes.

If the market is open, pauses code execution until market is closed. If an input (float) is passed as parameter, pauses code execution starting input minutes before market closes.

Parameters:

timedelta (int) – Time in minutes before market closes to pause. Overrides the self.minutes_before_closing.

Return type:

None

Example

>>> # Sleep until market closes (on_trading_iteration will stop running until the market closes)
>>> self.await_market_to_close()