self.sell_all

lumibot.strategies.strategy.Strategy.sell_all(self, cancel_open_orders=True)

Sell all strategy positions.

The system will generate closing market orders for each open position. If cancel_open_orders is True, then all open orders will also be cancelled.

Open orders are cancelled before the positions are closed.

Parameters:

cancel_open_orders (boolean) – Cancel all order if True, leave all orders in place if False. Default is True.

Return type:

None

Example

>>> # Will close all positions for the strategy
>>> self.sell_all()