#[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: OrderIdUnique order ID
exchange_order_id: Option<String>Exchange-specific order ID (once assigned)
venue: VenueExchange identifier
symbol: StringTrading symbol (e.g. “BTCUSDT”)
side: OrderSideOrder side (buy or sell)
order_type: OrderTypeOrder type
price: Option<Decimal>Limit price (required for limit orders)
stop_price: Option<Decimal>Stop price (required for stop orders)
quantity: DecimalOrder quantity
filled_quantity: DecimalFilled quantity
average_fill_price: Option<Decimal>Average fill price
status: OrderStatusCurrent order status
creation_time_ns: u64Order creation time in nanoseconds
update_time_ns: u64Order update time in nanoseconds
client_id: ClientIdStrategy or client ID that created this order
time_in_force: TimeInForceTime in force for the order
metadata: ValueAdditional order metadata
Implementations§
Source§impl Order
impl Order
Sourcepub fn new(
venue: Venue,
symbol: impl AsRef<str>,
side: OrderSide,
order_type: OrderType,
quantity: Decimal,
price: Option<Decimal>,
client_id: ClientId,
) -> Self
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
Sourcepub 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
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
Sourcepub fn remaining_quantity(&self) -> Decimal
pub fn remaining_quantity(&self) -> Decimal
Calculate remaining quantity
Sourcepub fn update_status(&mut self, status: OrderStatus)
pub fn update_status(&mut self, status: OrderStatus)
Update order status
Trait Implementations§
Source§impl Default for Order
Default implementation using Poolable for object pool compatibility
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§impl<'de> Deserialize<'de> for Order
impl<'de> Deserialize<'de> for Order
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Poolable for Order
Poolable implementation for safe object pool usage
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.