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§
Source§impl OrderEventFactory
impl OrderEventFactory
Sourcepub fn new(
trader_id: TraderId,
account_id: AccountId,
account_type: AccountType,
base_currency: Option<Currency>,
) -> Self
pub fn new( trader_id: TraderId, account_id: AccountId, account_type: AccountType, base_currency: Option<Currency>, ) -> Self
Creates a new OrderEventFactory instance.
Sourcepub fn account_id(&self) -> AccountId
pub fn account_id(&self) -> AccountId
Returns the account ID.
Sourcepub const fn set_account_id(&mut self, account_id: AccountId)
pub const fn set_account_id(&mut self, account_id: AccountId)
Sets the account ID.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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§
Source§impl Clone for OrderEventFactory
impl Clone for OrderEventFactory
Source§fn clone(&self) -> OrderEventFactory
fn clone(&self) -> OrderEventFactory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more