pub struct Order {Show 22 fields
pub id: Uuid,
pub client_order_id: SmartString<LazyCompact>,
pub exchange_order_id: Option<SmartString<LazyCompact>>,
pub venue: Exchange,
pub symbol: SmartString<LazyCompact>,
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: OmsOrderStatus,
pub time_in_force: Option<TimeInForce>,
pub reduce_only: bool,
pub creation_time_ns: u64,
pub update_time_ns: u64,
pub strategy_id: SmartString<LazyCompact>,
pub rejection_reason: Option<RejectionReason>,
pub metadata: OwnedValue,
pub take_profit: Option<Decimal>,
pub stop_loss: Option<Decimal>,
}Expand description
Internal order representation
Fields§
§id: UuidUnique order ID
client_order_id: SmartString<LazyCompact>Client-assigned order ID
exchange_order_id: Option<SmartString<LazyCompact>>Exchange-assigned order ID (once assigned)
venue: ExchangeExchange venue
symbol: SmartString<LazyCompact>Trading symbol (e.g., “BTCUSDT”)
side: OrderSideOrder side (buy or sell)
order_type: OrderTypeOrder type (market, limit, etc.)
price: Option<Decimal>Price (required for limit orders)
stop_price: Option<Decimal>Stop price (required for stop orders)
quantity: DecimalQuantity to trade
filled_quantity: DecimalFilled quantity
average_fill_price: Option<Decimal>Average fill price
status: OmsOrderStatusOrder status
time_in_force: Option<TimeInForce>Time in force
reduce_only: boolOrder is reducing only (close position)
creation_time_ns: u64Creation time in nanoseconds
update_time_ns: u64Last update time in nanoseconds
strategy_id: SmartString<LazyCompact>Strategy ID that created this order
rejection_reason: Option<RejectionReason>Rejection reason if rejected
metadata: OwnedValueAdditional order metadata
take_profit: Option<Decimal>Take profit price
stop_loss: Option<Decimal>Stop loss price
Implementations§
Source§impl Order
impl Order
Sourcepub fn from_request(request: &OrderRequest) -> Self
pub fn from_request(request: &OrderRequest) -> Self
Create a new order from an order request
Sourcepub fn remaining_quantity(&self) -> Decimal
pub fn remaining_quantity(&self) -> Decimal
Calculate remaining quantity
Sourcepub fn update_status(&mut self, status: OmsOrderStatus)
pub fn update_status(&mut self, status: OmsOrderStatus)
Update order status
Sourcepub fn reject(&mut self, reason: RejectionReason)
pub fn reject(&mut self, reason: RejectionReason)
Reject an order with reason
Trait Implementations§
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>,
Deserialize this value from the given Serde deserializer. 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more