pub struct Order { /* private fields */ }Expand description
Represents a trading order.
Implementations§
Source§impl Order
impl Order
Sourcepub fn market(
id: impl Into<String>,
symbol: impl Into<String>,
exchange: impl Into<String>,
direction: OrderDirection,
quantity_lots: u32,
) -> Self
pub fn market( id: impl Into<String>, symbol: impl Into<String>, exchange: impl Into<String>, direction: OrderDirection, quantity_lots: u32, ) -> Self
Creates a new market order.
Sourcepub fn limit(
id: impl Into<String>,
symbol: impl Into<String>,
exchange: impl Into<String>,
direction: OrderDirection,
quantity_lots: u32,
limit_price: Money,
) -> Self
pub fn limit( id: impl Into<String>, symbol: impl Into<String>, exchange: impl Into<String>, direction: OrderDirection, quantity_lots: u32, limit_price: Money, ) -> Self
Creates a new limit order.
Sourcepub fn exchange_order_id(&self) -> Option<&str>
pub fn exchange_order_id(&self) -> Option<&str>
Returns the exchange order ID if set.
Sourcepub const fn direction(&self) -> OrderDirection
pub const fn direction(&self) -> OrderDirection
Returns the order direction.
Sourcepub const fn order_type(&self) -> OrderType
pub const fn order_type(&self) -> OrderType
Returns the order type.
Sourcepub const fn quantity_lots(&self) -> u32
pub const fn quantity_lots(&self) -> u32
Returns the quantity in lots.
Sourcepub const fn limit_price(&self) -> Option<&Money>
pub const fn limit_price(&self) -> Option<&Money>
Returns the limit price if set.
Sourcepub const fn status(&self) -> OrderStatus
pub const fn status(&self) -> OrderStatus
Returns the current status.
Sourcepub const fn filled_lots(&self) -> u32
pub const fn filled_lots(&self) -> u32
Returns the number of lots filled.
Sourcepub const fn remaining_lots(&self) -> u32
pub const fn remaining_lots(&self) -> u32
Returns the number of lots remaining.
Sourcepub const fn average_fill_price(&self) -> Option<&Money>
pub const fn average_fill_price(&self) -> Option<&Money>
Returns the average fill price if any fills occurred.
Sourcepub const fn created_at(&self) -> DateTime<Utc>
pub const fn created_at(&self) -> DateTime<Utc>
Returns the creation timestamp.
Sourcepub const fn updated_at(&self) -> DateTime<Utc>
pub const fn updated_at(&self) -> DateTime<Utc>
Returns the last update timestamp.
Sourcepub fn fill_percentage(&self) -> Decimal
pub fn fill_percentage(&self) -> Decimal
Calculates the fill percentage.
Sourcepub fn set_status(&mut self, status: OrderStatus)
pub fn set_status(&mut self, status: OrderStatus)
Updates the order status.
Sourcepub fn set_exchange_order_id(&mut self, id: impl Into<String>)
pub fn set_exchange_order_id(&mut self, id: impl Into<String>)
Sets the exchange order ID.
Sourcepub fn record_fill(&mut self, lots: u32, price: Money)
pub fn record_fill(&mut self, lots: u32, price: Money)
Records a fill.
Sourcepub fn set_message(&mut self, message: impl Into<String>)
pub fn set_message(&mut self, message: impl Into<String>)
Sets a message (e.g., rejection 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
impl StructuralPartialEq for Order
Auto Trait Implementations§
impl Forget for Order
impl Freeze for Order
impl Move for Order
impl RefUnwindSafe for Order
impl Send for Order
impl Sync for Order
impl Unpin for Order
impl UnsafeUnpin 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