Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# self.minutes_before_closing

property Strategy.minutes_before_closing

  Get or set the number of minutes that the strategy will stop executing before market closes.

  The lifecycle method on_trading_iteration is executed inside a loop that stops only when there is only minutes_before_closing minutes remaining before market closes. By default equals to 5 minutes.

  Parameters:

    minutes_before_closing (int) – The number of minutes before market closes that the strategy will stop executing.

  Returns:

    minutes_before_closing – The number of minutes before market closes that the strategy will stop executing.

  Return type:

    int

  Example

      >>> # Set the minutes before closing to 5
      >>> self.minutes_before_closing = 5

      >>> # Get the minutes before closing
      >>> self.log_message(self.minutes_before_closing)

      >>> # Set the minutes before closing to 10 in the initialize method
      >>> def initialize(self):
      >>>     self.minutes_before_closing = 10