self.wait_for_order_execution#

lumibot.strategies.strategy.Strategy.wait_for_order_execution(self, order)#

Wait for one specific order to be executed or canceled by the broker

Parameters:

order (Order object) – Order object to be executed by the broker.

Return type:

Order object

Example

>>> # For a market buy order
>>> order = self.create_order("SPY", 100, "buy")
>>> self.submit_order(order)
>>> self.wait_for_order_execution(order)