This lifecycle method runs when a new order has been successfully submitted to the broker. Use this lifecycle event to execute code when the broker processes a new order.
order (Order): The corresponding order object processed
class MyStrategy(Strategy): def on_new_order(self, order): self.log_message("%r is currently being processed by the broker" % order)
- strategies.strategy.Strategy.on_new_order(self, order)¶
Use this lifecycle event to execute code when a new order is being processed by the broker
order (Order object) – The order that is being processed.
- Return type
>>> def on_new_order(self, order): >>> if order.asset == "AAPL": >>> self.log_message("Order for AAPL")