Skip to main content

OrderStatus

Struct OrderStatus 

Source
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: i32

The order’s client id.

§status: OrderStatusKind

The current status of the order. See OrderStatusKind for variant definitions and helpers like is_terminal.

§filled: f64

Number of filled positions.

§remaining: f64

The 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: i64

The order’s permId used by the TWS to identify orders.

§parent_id: i32

Parent’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: i32

API client which submitted the order.

§why_held: String

This 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

Source

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(_))));

Trait Implementations§

Source§

impl Clone for OrderStatus

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for OrderStatus

Source§

impl Debug for OrderStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OrderStatus

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for OrderStatus

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for OrderStatus

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for OrderStatus

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for OrderStatus

Source§

impl ToSchema for OrderStatus

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference utoipa::openapi::schema::Schemas for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

Source§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.