Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 434 Bytes

lifecycle_methods.on_abrupt_closing.rst

File metadata and controls

15 lines (10 loc) · 434 Bytes

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

.. autofunction:: strategies.strategy.Strategy.on_abrupt_closing