def on_abrupt_closing#
This lifecycle method runs when the strategy execution gets interrupted. Use this lifecycle method to execute code to stop trading gracefully like selling all assets
class MyStrategy(Strategy):
    def on_abrupt_closing(self):
        self.sell_all()
Reference#
- lumibot.strategies.strategy.Strategy.on_abrupt_closing(self)#
- Use this lifecycle event to execute code when the main trader was shut down (Keybord Interuption) - Parameters:
- None – 
- Return type:
- None 
 - Example - >>> def on_abrupt_closing(self): >>> self.log_message("Abrupt closing") >>> self.sell_all()