self.sell_all

lumibot.strategies.strategy.Strategy.sell_all(self, cancel_open_orders: bool = True, is_multileg: bool = False)

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.

  • is_multileg (boolean) – When True, will use multileg orders to close positions.

Return type:

None

Example

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