Skip to main content

OrderStatus

Enum OrderStatus 

pub enum OrderStatus {
    Active,
    Filled,
    Cancelled,
    Expired,
    Killed,
    Rejected,
    LiquidationCancelled,
    Pending,
    Delayed,
}
Expand description

Current lifecycle state of an order within the matching engine.

This enum tracks the complete lifecycle of orders from submission through final disposition. Each status represents a distinct state with specific implications for order behavior, visibility, and further actions.

§Status Flow

A submitted order lands in one of three live states and moves on from there:

live states
  Active   — plain order: resting on the book, or matching
  Delayed  — aggressive order held back by the maker shield
  Pending  — order carrying a conditional that has not triggered yet

Delayed → Active                        (shield window elapses)
Pending → Active                        (conditional triggers)
Pending → Expired | Cancelled           (conditional expires, or is cancelled)
Active  → Filled | Cancelled | Expired | LiquidationCancelled

terminal at submission, never live:
  Rejected — validation refused the order; `error` carries the OrderError
  Killed   — a FOK order could not be filled in full

§Status Categories

§Live States

  • Active: Order is live and can be matched
  • Delayed: Aggressive order queued behind the maker shield
  • Pending: Order held by the conditional engine, not yet triggered

§Final States (Terminal)

  • Filled: Order completely executed
  • Cancelled: Order cancelled by the client
  • Expired: GTT expiry, or a conditional that expired without triggering
  • Killed: A FOK order could not be filled in full
  • Rejected: Order rejected by validation, carries an OrderError
  • LiquidationCancelled: Order cancelled while the account was liquidated

§Usage

Order status is used for:

  • Client-side order tracking and display
  • Determining valid order operations (cancel, modify, etc.)
  • Audit trails and reporting
  • Risk management and position tracking

§Examples

§Status checking and display

use types::common::OrderStatus;

let status = OrderStatus::Active;
println!("Order status: {}", status); // Prints: "Order status: Active"

// Check if order can be canceled
let can_cancel = matches!(status, OrderStatus::Active);
assert_eq!(can_cancel, true);

§Pattern matching for order management

use types::common::OrderStatus;

fn handle_order_status(status: OrderStatus, order_id: u64) {
    match status {
        OrderStatus::Active => {
            println!("Order {} is active and can be canceled", order_id);
        }
        OrderStatus::Filled => {
            println!("Order {} completed successfully", order_id);
        }
        OrderStatus::Cancelled => {
            println!("Order {} was canceled", order_id);
        }
        OrderStatus::Rejected => {
            println!("Order {} was rejected during validation", order_id);
        }
        _ => println!("Order {} in final state: {}", order_id, status),
    }
}

§JSON Representation

Serialized as the variant name. All nine:

"Active"
"Filled"
"Cancelled"
"Expired"
"Killed"
"Rejected"
"LiquidationCancelled"
"Pending"
"Delayed"

Variants§

§

Active

Order is active and available for matching in the order book.

This is the primary working state for orders. Active orders:

  • Can be matched against incoming orders
  • Are visible in market data and order book
  • Can be canceled or modified (if supported)
  • Consume account margin/balance

§Transitions To

  • Filled: When completely executed
  • Cancelled: When manually canceled
  • Expired: When TTL/expiry reached
  • Killed: When forcibly terminated

§Operations Allowed

  • Cancel order
  • Modify order (system dependent)
  • Query order status
§

Filled

Order has been completely executed.

This is a terminal state indicating successful order completion. Filled orders:

  • Have no remaining quantity to execute
  • Generated execution reports and trade confirmations
  • Updated account positions and balances
  • Are preserved for audit and reporting purposes

§Characteristics

  • Terminal state (no further transitions)
  • Successful completion
  • All quantity executed
  • Positions and balances updated

§Operations Allowed

  • Query order details and execution history
  • Generate trade reports
§

Cancelled

Order was manually canceled before completion.

This terminal state indicates the order was deliberately canceled, either by the client or system administrator. Canceled orders:

  • Stop participating in matching
  • Release reserved margin/balance
  • May have partial fills before cancellation
  • Preserve execution history up to cancellation point

§Causes

  • Client-initiated cancellation
  • Risk management system cancellation
  • Administrator intervention
  • System maintenance procedures

§Characteristics

  • Terminal state
  • Deliberately stopped
  • May have partial execution history
  • Resources released back to account
§

Expired

Order automatically expired due to time-based rules.

This terminal state occurs when orders reach their configured expiry conditions. Expired orders:

  • Were subject to GTT (Good Till Time) time limits
  • Automatically removed at specified timestamp
  • May have partial fills before expiry
  • Release reserved resources

§Triggers

  • GTT expiry timestamp reached
  • Session/market close (if configured)
  • System-defined maximum order lifetime

§Characteristics

  • Terminal state
  • Time-based automatic removal
  • System-initiated (not client-initiated)
  • May have execution history before expiry
§

Killed

A Fill-or-Kill order that could not be filled in full.

This is the only thing that produces Killed. The engine sets it when a FOK order’s reachable volume is short of its quantity — because the book is thin, because the trading band puts the rest of the book out of reach, or because the open-interest cap clips the fill. stopped_quantity carries the whole order and error is OrderError::FokOrderCannotBeFullyFilled.

§Characteristics

  • Terminal, and reached at submission — the order never rests
  • Nothing is filled: filled_quantity is zero
  • A routine outcome, not an incident: this is how FOK declines
§

Rejected

Order was rejected during validation and never became active.

This terminal state indicates the order failed validation checks and was never placed in the order book. Rejected orders:

  • Failed business logic or technical validation
  • Never consumed margin or participated in matching
  • Include specific error details about rejection reason
  • Allow immediate resubmission with corrections

§Common Causes

  • Insufficient balance or margin
  • Invalid price or quantity parameters
  • Market or account restrictions
  • Technical validation failures

§Characteristics

  • Terminal state
  • Failed validation before activation
  • No impact on account balances/positions
  • Includes error details for client action

§Associated Data

Typically accompanied by OrderError details explaining the specific rejection reason.

§

LiquidationCancelled

Order was cancelled as part of a liquidation process.

This terminal state indicates the order was cancelled because the account holding this order was being liquidated. During liquidation, all open orders are typically cancelled to free up margin before closing positions.

§Characteristics

  • Terminal state
  • Part of account liquidation process
  • Order cancelled to free margin
  • Distinguished from user-initiated cancellation

§Context

This status helps differentiate between normal user cancellations and system-initiated cancellations during liquidation events, which is important for audit trails and understanding account history.

§

Pending

Order carries a conditional that has not triggered yet.

The order is parked in the conditional engine — not on the book, not matchable — while its trigger condition is monitored. Nothing bounds how long that lasts: a stop that never triggers stays Pending until it is cancelled or its conditional expiry fires. This is the ordinary resting state of a stop or take-profit, not a sign of congestion.

§Transitions To

  • Active: the conditional triggered; the order goes to the book
  • Expired: the conditional’s expiry elapsed with trigger false
  • Cancelled: cancelled by the client — dormant orders are cancellable
  • Rejected: trigger-time validation refused it (see OrderError)

§Characteristics

  • Not terminal
  • Not in the order book, cannot be matched
  • The order’s conditional.status carries the finer state ([ConditionalStatus::Active], [ConditionalStatus::PendingActivation])
§

Delayed

Aggressive order has been placed in a queue

Trait Implementations§

§

impl Clone for OrderStatus

§

fn clone(&self) -> OrderStatus

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
§

impl Copy for OrderStatus

§

impl Debug for OrderStatus

§

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

Formats the value using the given formatter. Read more
§

impl Default for OrderStatus

§

fn default() -> OrderStatus

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

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

§

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

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

impl Display for OrderStatus

§

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

Formats the value using the given formatter. Read more
§

impl Eq for OrderStatus

§

impl PartialEq for OrderStatus

§

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

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

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

Inequality operator !=. Read more
§

impl Serialize for OrderStatus

§

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

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

impl StructuralPartialEq for OrderStatus

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
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
§

impl<T> AsOut<T> for T
where T: Copy,

§

fn as_out(&mut self) -> Out<'_, T>

Returns an out reference to self.
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Clear for T
where T: InitializableFromZeroed + ?Sized,

§

fn clear(&mut self)

Completely overwrites this value.
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
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

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

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> InitializableFromZeroed for T
where T: Default,

§

unsafe fn initialize(place: *mut T)

Called to initialize a place to a valid value, after it is set to all-bits-zero. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> MaybeSend for T
where T: Send,

§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more