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#

lumibot.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")