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

# def before_starting_trading

Use this lifecycle method to reinitialize variables for day trading like resetting the list of blacklisted shares.

    class MyStrategy(Strategy):
        def before_starting_trading(self):
            self.blacklist = []

## Reference

strategies.strategy.Strategy.before_starting_trading(self)

  Lifecycle method executed after the market opens and before entering the trading loop. Use this method for daily resetting variables

  Return type:

    None

  Example

      >>> # Get pricing data for the last day
      >>> def before_starting_trading(self):
      >>>     self.get_historical_prices("SPY", 1, "day")