def on_canceled_order¶
The lifecycle method called when an order has been successfully canceled by the broker. Use this lifecycle event to execute code when an order has been canceled by the broker
Parameters:
order (Order): The corresponding order object that has been canceled
class MyStrategy(Strategy):
def on_canceled_order(self, order):
self.log_message(f"{order} has been canceled by the broker")
Reference¶
- lumibot.strategies.strategy.Strategy.on_canceled_order(self, order)¶
Use this lifecycle event to execute code when an order is canceled.
- Parameters:
order (Order object) – The order that is being canceled.
- Return type:
None
Example
>>> def on_canceled_order(self, order): >>> if order.asset == "AAPL": >>> self.log_message("Order for AAPL canceled")