self.sleep#

strategies.strategy.Strategy.sleep(self, sleeptime, process_pending_orders=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, the broker will process any pending orders.

Return type:

None

Example

>>> # Sleep for 5 seconds
>>> self.sleep(5)