pub struct OrderFactory { /* private fields */ }Implementations§
Source§impl OrderFactory
impl OrderFactory
Sourcepub fn new(
trader_id: TraderId,
strategy_id: StrategyId,
init_order_id_count: Option<usize>,
init_order_list_id_count: Option<usize>,
clock: &'static AtomicTime,
use_uuids_for_client_order_ids: bool,
use_hyphens_in_client_order_ids: bool,
) -> Self
pub fn new( trader_id: TraderId, strategy_id: StrategyId, init_order_id_count: Option<usize>, init_order_list_id_count: Option<usize>, clock: &'static AtomicTime, use_uuids_for_client_order_ids: bool, use_hyphens_in_client_order_ids: bool, ) -> Self
Creates a new OrderFactory instance.
Sourcepub const fn set_client_order_id_count(&mut self, count: usize)
pub const fn set_client_order_id_count(&mut self, count: usize)
Sets the client order ID generator count.
Sourcepub const fn set_order_list_id_count(&mut self, count: usize)
pub const fn set_order_list_id_count(&mut self, count: usize)
Sets the order list ID generator count.
Sourcepub fn generate_client_order_id(&mut self) -> ClientOrderId
pub fn generate_client_order_id(&mut self) -> ClientOrderId
Generates a new client order ID.
Sourcepub fn generate_order_list_id(&mut self) -> OrderListId
pub fn generate_order_list_id(&mut self) -> OrderListId
Generates a new order list ID.
Sourcepub const fn reset_factory(&mut self)
pub const fn reset_factory(&mut self)
Resets the factory by resetting all ID generators.
Sourcepub fn market(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
client_order_id: Option<ClientOrderId>,
) -> OrderAny
pub fn market( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, time_in_force: Option<TimeInForce>, reduce_only: Option<bool>, quote_quantity: Option<bool>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, client_order_id: Option<ClientOrderId>, ) -> OrderAny
Creates a new market order.
Sourcepub fn limit(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
price: Price,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
post_only: Option<bool>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
display_qty: Option<Quantity>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
client_order_id: Option<ClientOrderId>,
) -> OrderAny
pub fn limit( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, price: Price, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, post_only: Option<bool>, reduce_only: Option<bool>, quote_quantity: Option<bool>, display_qty: Option<Quantity>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, client_order_id: Option<ClientOrderId>, ) -> OrderAny
Creates a new limit order.
Sourcepub fn stop_market(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
trigger_price: Price,
trigger_type: Option<TriggerType>,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
display_qty: Option<Quantity>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
client_order_id: Option<ClientOrderId>,
) -> OrderAny
pub fn stop_market( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, trigger_price: Price, trigger_type: Option<TriggerType>, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, reduce_only: Option<bool>, quote_quantity: Option<bool>, display_qty: Option<Quantity>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, client_order_id: Option<ClientOrderId>, ) -> OrderAny
Creates a new stop-market order.
Sourcepub fn stop_limit(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
price: Price,
trigger_price: Price,
trigger_type: Option<TriggerType>,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
post_only: Option<bool>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
display_qty: Option<Quantity>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
client_order_id: Option<ClientOrderId>,
) -> OrderAny
pub fn stop_limit( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, price: Price, trigger_price: Price, trigger_type: Option<TriggerType>, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, post_only: Option<bool>, reduce_only: Option<bool>, quote_quantity: Option<bool>, display_qty: Option<Quantity>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, client_order_id: Option<ClientOrderId>, ) -> OrderAny
Creates a new stop-limit order.
Sourcepub fn market_if_touched(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
trigger_price: Price,
trigger_type: Option<TriggerType>,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
client_order_id: Option<ClientOrderId>,
) -> OrderAny
pub fn market_if_touched( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, trigger_price: Price, trigger_type: Option<TriggerType>, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, reduce_only: Option<bool>, quote_quantity: Option<bool>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, client_order_id: Option<ClientOrderId>, ) -> OrderAny
Creates a new market-if-touched order.
Sourcepub fn limit_if_touched(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
price: Price,
trigger_price: Price,
trigger_type: Option<TriggerType>,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
post_only: Option<bool>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
display_qty: Option<Quantity>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
client_order_id: Option<ClientOrderId>,
) -> OrderAny
pub fn limit_if_touched( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, price: Price, trigger_price: Price, trigger_type: Option<TriggerType>, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, post_only: Option<bool>, reduce_only: Option<bool>, quote_quantity: Option<bool>, display_qty: Option<Quantity>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, client_order_id: Option<ClientOrderId>, ) -> OrderAny
Creates a new limit-if-touched order.
Sourcepub fn bracket(
&mut self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
entry_price: Option<Price>,
sl_trigger_price: Price,
tp_price: Price,
entry_trigger_price: Option<Price>,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
post_only: Option<bool>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
emulation_trigger: Option<TriggerType>,
trigger_instrument_id: Option<InstrumentId>,
exec_algorithm_id: Option<ExecAlgorithmId>,
exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>,
tags: Option<Vec<Ustr>>,
) -> OrderList
pub fn bracket( &mut self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, entry_price: Option<Price>, sl_trigger_price: Price, tp_price: Price, entry_trigger_price: Option<Price>, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, post_only: Option<bool>, reduce_only: Option<bool>, quote_quantity: Option<bool>, emulation_trigger: Option<TriggerType>, trigger_instrument_id: Option<InstrumentId>, exec_algorithm_id: Option<ExecAlgorithmId>, exec_algorithm_params: Option<IndexMap<Ustr, Ustr>>, tags: Option<Vec<Ustr>>, ) -> OrderList
Creates a bracket order list with entry order and attached stop-loss and take-profit orders.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OrderFactory
impl RefUnwindSafe for OrderFactory
impl Send for OrderFactory
impl Sync for OrderFactory
impl Unpin for OrderFactory
impl UnwindSafe for OrderFactory
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§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>
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 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>
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