Struct Order

Source
#[repr(align(64))]
pub struct Order {
Show 17 fields pub id: OrderId, pub exchange_order_id: Option<String>, pub venue: Venue, pub symbol: String, pub side: OrderSide, pub order_type: OrderType, pub price: Option<Decimal>, pub stop_price: Option<Decimal>, pub quantity: Decimal, pub filled_quantity: Decimal, pub average_fill_price: Option<Decimal>, pub status: OrderStatus, pub creation_time_ns: u64, pub update_time_ns: u64, pub client_id: ClientId, pub time_in_force: TimeInForce, pub metadata: Value,
}
Expand description

Represents an order in the system

Fields§

§id: OrderId

Unique order ID

§exchange_order_id: Option<String>

Exchange-specific order ID (once assigned)

§venue: Venue

Exchange identifier

§symbol: String

Trading symbol (e.g. “BTCUSDT”)

§side: OrderSide

Order side (buy or sell)

§order_type: OrderType

Order type

§price: Option<Decimal>

Limit price (required for limit orders)

§stop_price: Option<Decimal>

Stop price (required for stop orders)

§quantity: Decimal

Order quantity

§filled_quantity: Decimal

Filled quantity

§average_fill_price: Option<Decimal>

Average fill price

§status: OrderStatus

Current order status

§creation_time_ns: u64

Order creation time in nanoseconds

§update_time_ns: u64

Order update time in nanoseconds

§client_id: ClientId

Strategy or client ID that created this order

§time_in_force: TimeInForce

Time in force for the order

§metadata: Value

Additional order metadata

Implementations§

Source§

impl Order

Source

pub fn new( venue: Venue, symbol: impl AsRef<str>, side: OrderSide, order_type: OrderType, quantity: Decimal, price: Option<Decimal>, client_id: ClientId, ) -> Self

Create a new order

Source

pub fn with_time_in_force( venue: Venue, symbol: impl AsRef<str>, side: OrderSide, order_type: OrderType, quantity: Decimal, price: Option<Decimal>, client_id: ClientId, time_in_force: TimeInForce, ) -> Self

Create a new order with specific time in force

Source

pub fn is_filled(&self) -> bool

Determine if order is completely filled

Source

pub fn remaining_quantity(&self) -> Decimal

Calculate remaining quantity

Source

pub fn update_status(&mut self, status: OrderStatus)

Update order status

Trait Implementations§

Source§

impl Clone for Order

Source§

fn clone(&self) -> Order

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Order

Source§

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

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

impl Default for Order

Default implementation using Poolable for object pool compatibility

This implementation uses the safe Poolable trait to provide Default behavior for object pools while maintaining the security benefits of removing the original Default implementation that could create accidentally valid orders.

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Order

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 Poolable for Order

Poolable implementation for safe object pool usage

This implementation provides safe pool initialization without the risks of the Default trait. Objects created through this trait are obviously invalid and safe for pool pre-allocation.

Source§

fn new_for_pool() -> Self

Create a poolable object with invalid/empty state Read more
Source§

fn reset_for_pool(&mut self)

Reset the object to poolable state Read more
Source§

impl Serialize for Order

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

Auto Trait Implementations§

§

impl Freeze for Order

§

impl RefUnwindSafe for Order

§

impl Send for Order

§

impl Sync for Order

§

impl Unpin for Order

§

impl UnwindSafe for Order

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = 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
Source§

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

§

impl<T> ErasedDestructor for T
where T: 'static,