self.get_order¶
- lumibot.strategies.strategy.Strategy.get_order(self, identifier: str, broker_refresh: bool = True, broker_refresh_ttl_seconds: float = 0.0)
Get a tracked order given an identifier. Check the details of the order including status, etc.
In live trading this refreshes broker order state before returning by default. Refresh normally reads the broker order list; a tracked active order absent from that list may also receive a direct lookup. This is not an unconditional single-order HTTP request. Set broker_refresh=False to read only tracked state.
- Returns:
An order objects for the identifier
- Return type:
Order or None
Example
>>> # Get the order object for the order id >>> order = self.get_order(order_id) >>> # Show the status of the order >>> self.log_message(order.status)