Struct OrderEventFactory
pub struct OrderEventFactory { /* private fields */ }Expand description
Factory for generating order and account events.
This struct holds the identity information needed to construct events and provides
methods to generate all order event types. It is Clone and Send, allowing it
to be used in async contexts.
Implementations§
§impl OrderEventFactory
impl OrderEventFactory
pub fn new(
trader_id: TraderId,
account_id: AccountId,
account_type: AccountType,
base_currency: Option<Currency>,
) -> OrderEventFactory
pub fn new( trader_id: TraderId, account_id: AccountId, account_type: AccountType, base_currency: Option<Currency>, ) -> OrderEventFactory
Creates a new OrderEventFactory instance.
pub fn trader_id(&self) -> TraderId
pub fn trader_id(&self) -> TraderId
Returns the trader ID.
pub fn account_id(&self) -> AccountId
pub fn account_id(&self) -> AccountId
Returns the account ID.
pub fn generate_account_state(
&self,
balances: Vec<AccountBalance>,
margins: Vec<MarginBalance>,
reported: bool,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> AccountState
pub fn generate_account_state( &self, balances: Vec<AccountBalance>, margins: Vec<MarginBalance>, reported: bool, ts_event: UnixNanos, ts_init: UnixNanos, ) -> AccountState
Generates an account state event.
pub fn generate_order_denied(
&self,
order: &OrderAny,
reason: &str,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_denied( &self, order: &OrderAny, reason: &str, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order denied event.
The event timestamp ts_event is the same as the initialized timestamp ts_init.
pub fn generate_order_submitted(
&self,
order: &OrderAny,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_submitted( &self, order: &OrderAny, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order submitted event.
The event timestamp ts_event is the same as the initialized timestamp ts_init.
pub fn generate_order_rejected(
&self,
order: &OrderAny,
reason: &str,
ts_event: UnixNanos,
ts_init: UnixNanos,
due_post_only: bool,
) -> OrderEventAny
pub fn generate_order_rejected( &self, order: &OrderAny, reason: &str, ts_event: UnixNanos, ts_init: UnixNanos, due_post_only: bool, ) -> OrderEventAny
Generates an order rejected event.
pub fn generate_order_accepted(
&self,
order: &OrderAny,
venue_order_id: VenueOrderId,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_accepted( &self, order: &OrderAny, venue_order_id: VenueOrderId, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order accepted event.
pub fn generate_order_modify_rejected(
&self,
order: &OrderAny,
venue_order_id: Option<VenueOrderId>,
reason: &str,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_modify_rejected( &self, order: &OrderAny, venue_order_id: Option<VenueOrderId>, reason: &str, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order modify rejected event.
pub fn generate_order_cancel_rejected(
&self,
order: &OrderAny,
venue_order_id: Option<VenueOrderId>,
reason: &str,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_cancel_rejected( &self, order: &OrderAny, venue_order_id: Option<VenueOrderId>, reason: &str, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order cancel rejected event.
pub fn generate_order_updated(
&self,
order: &OrderAny,
venue_order_id: VenueOrderId,
quantity: Quantity,
price: Option<Price>,
trigger_price: Option<Price>,
protection_price: Option<Price>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_updated( &self, order: &OrderAny, venue_order_id: VenueOrderId, quantity: Quantity, price: Option<Price>, trigger_price: Option<Price>, protection_price: Option<Price>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order updated event.
pub fn generate_order_canceled(
&self,
order: &OrderAny,
venue_order_id: Option<VenueOrderId>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_canceled( &self, order: &OrderAny, venue_order_id: Option<VenueOrderId>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order canceled event.
pub fn generate_order_triggered(
&self,
order: &OrderAny,
venue_order_id: Option<VenueOrderId>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_triggered( &self, order: &OrderAny, venue_order_id: Option<VenueOrderId>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order triggered event.
pub fn generate_order_expired(
&self,
order: &OrderAny,
venue_order_id: Option<VenueOrderId>,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_expired( &self, order: &OrderAny, venue_order_id: Option<VenueOrderId>, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order expired event.
pub fn generate_order_filled(
&self,
order: &OrderAny,
venue_order_id: VenueOrderId,
venue_position_id: Option<PositionId>,
trade_id: TradeId,
last_qty: Quantity,
last_px: Price,
quote_currency: Currency,
commission: Option<Money>,
liquidity_side: LiquiditySide,
ts_event: UnixNanos,
ts_init: UnixNanos,
) -> OrderEventAny
pub fn generate_order_filled( &self, order: &OrderAny, venue_order_id: VenueOrderId, venue_position_id: Option<PositionId>, trade_id: TradeId, last_qty: Quantity, last_px: Price, quote_currency: Currency, commission: Option<Money>, liquidity_side: LiquiditySide, ts_event: UnixNanos, ts_init: UnixNanos, ) -> OrderEventAny
Generates an order filled event.
Trait Implementations§
§impl Clone for OrderEventFactory
impl Clone for OrderEventFactory
§fn clone(&self) -> OrderEventFactory
fn clone(&self) -> OrderEventFactory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for OrderEventFactory
impl RefUnwindSafe for OrderEventFactory
impl Send for OrderEventFactory
impl Sync for OrderEventFactory
impl Unpin for OrderEventFactory
impl UnsafeUnpin for OrderEventFactory
impl UnwindSafe for OrderEventFactory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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