pub struct OrderStatus {
pub order_id: i32,
pub status: OrderStatusKind,
pub filled: f64,
pub remaining: f64,
pub average_fill_price: Option<f64>,
pub perm_id: i64,
pub parent_id: i32,
pub last_fill_price: Option<f64>,
pub client_id: i32,
pub why_held: String,
pub market_cap_price: Option<f64>,
}Expand description
Contains all relevant information on the current status of the order execution-wise (i.e. amount filled and pending, filling price, etc.).
Fields§
§order_id: i32The order’s client id.
status: OrderStatusKindThe current status of the order. See OrderStatusKind for variant
definitions and helpers like is_terminal.
filled: f64Number of filled positions.
remaining: f64The remnant positions.
average_fill_price: Option<f64>Average filling price. None when IBKR did not send a value (UNSET_DOUBLE on text protocol; missing optional field on protobuf).
perm_id: i64The order’s permId used by the TWS to identify orders.
parent_id: i32Parent’s id. Used for bracket and auto trailing stop orders.
last_fill_price: Option<f64>Price at which the last positions were filled. None when IBKR did not send a value.
client_id: i32API client which submitted the order.
why_held: StringThis field is used to identify an order held when TWS is trying to locate shares for a short sell. The value used to indicate this is ‘locate’.
market_cap_price: Option<f64>If an order has been capped, this indicates the current capped price. Requires TWS 967+ and API v973.04+. Python API specifically requires API v973.06+. None when IBKR did not send a value.
Implementations§
Source§impl OrderStatus
impl OrderStatus
Sourcepub fn outcome(&self) -> Option<OrderOutcome>
pub fn outcome(&self) -> Option<OrderOutcome>
How the order ended, or None while it is still working (partial
fills included). The rule wait_for_fill applies to each status, for
waits built on order_status_stream.
Filled for status
Filled, or nothing remaining after a fill
(market orders do not always report Filled);
Ended for any other
terminal status.
§Examples
use ibapi::orders::{OrderOutcome, OrderStatus, OrderStatusKind};
let partial = OrderStatus { status: OrderStatusKind::Submitted, filled: 40.0, remaining: 60.0, ..Default::default() };
assert_eq!(partial.outcome(), None);
let done = OrderStatus { filled: 100.0, remaining: 0.0, ..partial };
assert!(matches!(done.outcome(), Some(OrderOutcome::Filled(_))));