Skip to main content

OrderAny

Enum OrderAny 

Source
pub enum OrderAny {
    Limit(LimitOrder),
    LimitIfTouched(LimitIfTouchedOrder),
    Market(MarketOrder),
    MarketIfTouched(MarketIfTouchedOrder),
    MarketToLimit(MarketToLimitOrder),
    StopLimit(StopLimitOrder),
    StopMarket(StopMarketOrder),
    TrailingStopLimit(TrailingStopLimitOrder),
    TrailingStopMarket(TrailingStopMarketOrder),
}

Variants§

§

Limit(LimitOrder)

§

LimitIfTouched(LimitIfTouchedOrder)

§

Market(MarketOrder)

§

MarketIfTouched(MarketIfTouchedOrder)

§

MarketToLimit(MarketToLimitOrder)

§

StopLimit(StopLimitOrder)

§

StopMarket(StopMarketOrder)

§

TrailingStopLimit(TrailingStopLimitOrder)

§

TrailingStopMarket(TrailingStopMarketOrder)

Implementations§

Source§

impl OrderAny

Source

pub fn from_events(events: Vec<OrderEventAny>) -> Result<Self>

Creates a new OrderAny instance from the given events.

§Errors

Returns an error if:

  • The events is empty.
  • The first event is not OrderInitialized.
  • Any event has an invalid state transition when applied to the order.
§Panics

Panics if events is empty (after the check, but before .unwrap()).

Source

pub fn init_event(&self) -> &OrderInitialized

Returns a reference to the crate::events::OrderInitialized event.

This is always the first event in the order’s event list (invariant).

§Panics

Panics if the first event is not OrderInitialized (violates invariant).

Source

pub fn set_order_list_id(&mut self, id: OrderListId)

Trait Implementations§

Source§

impl Clone for OrderAny

Source§

fn clone(&self) -> OrderAny

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for OrderAny

Source§

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

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

impl<'de> Deserialize<'de> for OrderAny

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 Display for OrderAny

Source§

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

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

impl From<LimitIfTouchedOrder> for OrderAny

Source§

fn from(v: LimitIfTouchedOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<LimitOrder> for OrderAny

Source§

fn from(v: LimitOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<LimitOrderAny> for OrderAny

Source§

fn from(order: LimitOrderAny) -> Self

Converts to this type from the input type.
Source§

impl From<MarketIfTouchedOrder> for OrderAny

Source§

fn from(v: MarketIfTouchedOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<MarketOrder> for OrderAny

Source§

fn from(v: MarketOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<MarketToLimitOrder> for OrderAny

Source§

fn from(v: MarketToLimitOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<OrderAny> for OrderSnapshot

Source§

fn from(order: OrderAny) -> Self

Converts to this type from the input type.
Source§

impl From<OrderInitialized> for OrderAny

Source§

fn from(order: OrderInitialized) -> Self

Converts to this type from the input type.
Source§

impl From<PassiveOrderAny> for OrderAny

Source§

fn from(order: PassiveOrderAny) -> Self

Converts to this type from the input type.
Source§

impl From<StopLimitOrder> for OrderAny

Source§

fn from(v: StopLimitOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<StopMarketOrder> for OrderAny

Source§

fn from(v: StopMarketOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<StopOrderAny> for OrderAny

Source§

fn from(order: StopOrderAny) -> Self

Converts to this type from the input type.
Source§

impl From<TrailingStopLimitOrder> for OrderAny

Source§

fn from(v: TrailingStopLimitOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl From<TrailingStopMarketOrder> for OrderAny

Source§

fn from(v: TrailingStopMarketOrder) -> OrderAny

Converts to this type from the input type.
Source§

impl Order for OrderAny

Source§

fn calculate_overfill(&self, __enum_dispatch_arg_0: Quantity) -> Quantity

Calculates potential overfill quantity without mutating order state.

Source§

fn apply( &mut self, __enum_dispatch_arg_0: OrderEventAny, ) -> Result<(), OrderError>

Applies the event to the order.

§Errors

Returns an error if the event is invalid for the current order status.

Source§

fn is_duplicate_fill(&self, __enum_dispatch_arg_0: &OrderFilled) -> bool

Returns true if a fill with matching trade_id, side, qty, and price already exists.

Source§

fn into_any(self) -> OrderAny

Source§

fn status(&self) -> OrderStatus

Source§

fn trader_id(&self) -> TraderId

Source§

fn strategy_id(&self) -> StrategyId

Source§

fn instrument_id(&self) -> InstrumentId

Source§

fn symbol(&self) -> Symbol

Source§

fn venue(&self) -> Venue

Source§

fn client_order_id(&self) -> ClientOrderId

Source§

fn venue_order_id(&self) -> Option<VenueOrderId>

Source§

fn position_id(&self) -> Option<PositionId>

Source§

fn account_id(&self) -> Option<AccountId>

Source§

fn last_trade_id(&self) -> Option<TradeId>

Source§

fn order_side(&self) -> OrderSide

Source§

fn order_type(&self) -> OrderType

Source§

fn quantity(&self) -> Quantity

Source§

fn time_in_force(&self) -> TimeInForce

Source§

fn expire_time(&self) -> Option<UnixNanos>

Source§

fn price(&self) -> Option<Price>

Source§

fn trigger_price(&self) -> Option<Price>

Source§

fn activation_price(&self) -> Option<Price>

Source§

fn trigger_type(&self) -> Option<TriggerType>

Source§

fn liquidity_side(&self) -> Option<LiquiditySide>

Source§

fn is_post_only(&self) -> bool

Source§

fn is_reduce_only(&self) -> bool

Source§

fn is_quote_quantity(&self) -> bool

Source§

fn display_qty(&self) -> Option<Quantity>

Source§

fn limit_offset(&self) -> Option<Decimal>

Source§

fn trailing_offset(&self) -> Option<Decimal>

Source§

fn trailing_offset_type(&self) -> Option<TrailingOffsetType>

Source§

fn emulation_trigger(&self) -> Option<TriggerType>

Source§

fn trigger_instrument_id(&self) -> Option<InstrumentId>

Source§

fn contingency_type(&self) -> Option<ContingencyType>

Source§

fn order_list_id(&self) -> Option<OrderListId>

Source§

fn linked_order_ids(&self) -> Option<&[ClientOrderId]>

Source§

fn parent_order_id(&self) -> Option<ClientOrderId>

Source§

fn exec_algorithm_id(&self) -> Option<ExecAlgorithmId>

Source§

fn exec_algorithm_params(&self) -> Option<&IndexMap<Ustr, Ustr>>

Source§

fn exec_spawn_id(&self) -> Option<ClientOrderId>

Source§

fn tags(&self) -> Option<&[Ustr]>

Source§

fn filled_qty(&self) -> Quantity

Source§

fn leaves_qty(&self) -> Quantity

Source§

fn overfill_qty(&self) -> Quantity

Source§

fn avg_px(&self) -> Option<f64>

Source§

fn slippage(&self) -> Option<f64>

Source§

fn init_id(&self) -> UUID4

Source§

fn ts_init(&self) -> UnixNanos

Source§

fn ts_submitted(&self) -> Option<UnixNanos>

Source§

fn ts_accepted(&self) -> Option<UnixNanos>

Source§

fn ts_closed(&self) -> Option<UnixNanos>

Source§

fn ts_last(&self) -> UnixNanos

Source§

fn order_side_specified(&self) -> OrderSideSpecified

Source§

fn commissions(&self) -> &IndexMap<Currency, Money>

Source§

fn update(&mut self, __enum_dispatch_arg_0: &OrderUpdated)

Source§

fn events(&self) -> Vec<&OrderEventAny>

Source§

fn last_event(&self) -> &OrderEventAny

Source§

fn event_count(&self) -> usize

Source§

fn venue_order_ids(&self) -> Vec<&VenueOrderId>

Source§

fn trade_ids(&self) -> Vec<&TradeId>

Source§

fn has_price(&self) -> bool

Source§

fn is_buy(&self) -> bool

Source§

fn is_sell(&self) -> bool

Source§

fn is_passive(&self) -> bool

Source§

fn is_aggressive(&self) -> bool

Source§

fn is_emulated(&self) -> bool

Source§

fn is_active_local(&self) -> bool

Source§

fn is_primary(&self) -> bool

Source§

fn is_spawned(&self) -> bool

Source§

fn is_contingency(&self) -> bool

Source§

fn is_parent_order(&self) -> bool

Source§

fn is_child_order(&self) -> bool

Source§

fn is_open(&self) -> bool

Source§

fn is_canceled(&self) -> bool

Source§

fn is_closed(&self) -> bool

Source§

fn is_inflight(&self) -> bool

Source§

fn is_pending_update(&self) -> bool

Source§

fn is_pending_cancel(&self) -> bool

Source§

fn to_own_book_order(&self) -> OwnBookOrder

Source§

fn is_triggered(&self) -> Option<bool>

Source§

fn set_position_id(&mut self, __enum_dispatch_arg_0: Option<PositionId>)

Source§

fn set_quantity(&mut self, __enum_dispatch_arg_0: Quantity)

Source§

fn set_leaves_qty(&mut self, __enum_dispatch_arg_0: Quantity)

Source§

fn set_emulation_trigger(&mut self, __enum_dispatch_arg_0: Option<TriggerType>)

Source§

fn set_is_quote_quantity(&mut self, __enum_dispatch_arg_0: bool)

Source§

fn set_liquidity_side(&mut self, __enum_dispatch_arg_0: LiquiditySide)

Source§

fn would_reduce_only( &self, __enum_dispatch_arg_0: PositionSide, __enum_dispatch_arg_1: Quantity, ) -> bool

Source§

fn previous_status(&self) -> Option<OrderStatus>

Source§

impl PartialEq for OrderAny

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OrderAny

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

impl TryFrom<OrderAny> for LimitOrderAny

Source§

type Error = String

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

fn try_from(order: OrderAny) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<OrderAny> for PassiveOrderAny

Source§

type Error = String

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

fn try_from(order: OrderAny) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<OrderAny> for StopOrderAny

Source§

type Error = String

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

fn try_from(order: OrderAny) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryInto<LimitIfTouchedOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<LimitIfTouchedOrder, <Self as TryInto<LimitIfTouchedOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<LimitOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into(self) -> Result<LimitOrder, <Self as TryInto<LimitOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<MarketIfTouchedOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<MarketIfTouchedOrder, <Self as TryInto<MarketIfTouchedOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<MarketOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into(self) -> Result<MarketOrder, <Self as TryInto<MarketOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<MarketToLimitOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<MarketToLimitOrder, <Self as TryInto<MarketToLimitOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<StopLimitOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<StopLimitOrder, <Self as TryInto<StopLimitOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<StopMarketOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<StopMarketOrder, <Self as TryInto<StopMarketOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<TrailingStopLimitOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<TrailingStopLimitOrder, <Self as TryInto<TrailingStopLimitOrder>>::Error>

Performs the conversion.
Source§

impl TryInto<TrailingStopMarketOrder> for OrderAny

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<TrailingStopMarketOrder, <Self as TryInto<TrailingStopMarketOrder>>::Error>

Performs the conversion.
Source§

impl Eq for OrderAny

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

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

§

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