def on_new_order¶
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.
Parameters:
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)
Reference¶
- lumibot.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
- Parameters:
order (Order object) – The order that is being processed.
- Return type:
None
Example
>>> def on_new_order(self, order): >>> if order.asset == "AAPL": >>> self.log_message("Order for AAPL")