self.cancel_open_orders

lumibot.strategies.strategy.Strategy.cancel_open_orders(self, orders: list[Order] | None = None)

Cancel all the strategy open orders.

Cancels all orders that are open and awaiting execution within a given strategy. If running multiple strategies, will only cancel the orders in the current strategy.

Parameters:

orders (list[Order] | None) – Optional list of already enumerated orders. Pass in the list when you have just fetched/filtered the active orders to avoid re-querying the broker; leave as None to let the broker gather them itself.

Return type:

None

Example

>>> # Cancel all open orders
>>> self.cancel_open_orders()