self.sleep¶
- lumibot.strategies.strategy.Strategy.sleep(self, sleeptime: float, process_pending_orders: bool = True)
Sleep for sleeptime seconds.
Use to pause the execution of the program. This should be used instead of time.sleep within the strategy. Also processes pending orders in the meantime.
- Parameters:
sleeptime (float) – Time in seconds the program will be paused.
process_pending_orders (bool) – If True, process pending broker fills around the sleep. In backtesting this calls
broker.process_pending_ordersbefore and after advancing the simulation clock. Required for agent tools such asorders_wait_for_terminalso market orders can fill without waiting for the next strategy bar.
- Return type:
None
Example
>>> # Sleep for 5 seconds >>> self.sleep(5)