self.get_orders

lumibot.strategies.strategy.Strategy.get_orders(self)

Get all the current open orders.

Returns:

Order objects for the strategy if there are tracked

Return type:

list of Order objects

Example

>>> # Get all tracked orders
>>> orders = self.get_orders()
>>> for order in orders:
>>>     # Show the status of each order
>>>     self.log_message(order.status)
>>> # Get all open orders
>>> orders = self.get_tracked_orders()
>>> for order in orders:
>>>     # Show the status of each order
>>>     self.log_message(order.status)
>>>     # Check if the order is open
>>>     if order.status == "open":
>>>         # Cancel the order
>>>         self.cancel_order(order)