pub struct OrderApi<'a> { /* private fields */ }Expand description
User-facing order creation API.
Implementations§
Source§impl<'a> OrderApi<'a>
impl<'a> OrderApi<'a>
Sourcepub fn generate_client_order_id(&self) -> ClientOrderId
pub fn generate_client_order_id(&self) -> ClientOrderId
Sourcepub fn generate_order_list_id(&self) -> OrderListId
pub fn generate_order_list_id(&self) -> OrderListId
Sourcepub fn market(
&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( &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.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn limit(
&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( &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.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn stop_market(
&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( &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.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn stop_limit(
&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( &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.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn market_to_limit(
&self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
time_in_force: Option<TimeInForce>,
expire_time: Option<UnixNanos>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
display_qty: Option<Quantity>,
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_to_limit( &self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, time_in_force: Option<TimeInForce>, expire_time: Option<UnixNanos>, reduce_only: Option<bool>, quote_quantity: Option<bool>, display_qty: Option<Quantity>, 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-to-limit order.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn market_if_touched(
&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( &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.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn limit_if_touched(
&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( &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.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn trailing_stop_market(
&self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
trailing_offset: Decimal,
trailing_offset_type: Option<TrailingOffsetType>,
activation_price: Option<Price>,
trigger_price: Option<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 trailing_stop_market( &self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, trailing_offset: Decimal, trailing_offset_type: Option<TrailingOffsetType>, activation_price: Option<Price>, trigger_price: Option<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 trailing-stop-market order.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn trailing_stop_limit(
&self,
instrument_id: InstrumentId,
order_side: OrderSide,
quantity: Quantity,
price: Price,
limit_offset: Decimal,
trailing_offset: Decimal,
trailing_offset_type: Option<TrailingOffsetType>,
activation_price: Option<Price>,
trigger_price: Option<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 trailing_stop_limit( &self, instrument_id: InstrumentId, order_side: OrderSide, quantity: Quantity, price: Price, limit_offset: Decimal, trailing_offset: Decimal, trailing_offset_type: Option<TrailingOffsetType>, activation_price: Option<Price>, trigger_price: Option<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 trailing-stop-limit order.
§Panics
Panics if the order parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn create_list(
&self,
orders: &mut [OrderAny],
ts_init: UnixNanos,
) -> OrderList
pub fn create_list( &self, orders: &mut [OrderAny], ts_init: UnixNanos, ) -> OrderList
Creates a new order list from the given orders.
§Panics
Panics if the list parameters fail validation or the order factory is already mutably borrowed.
Sourcepub fn bracket<'f1>(&'f1 self) -> OrderApiBracketBuilder<'a, 'f1>
pub fn bracket<'f1>(&'f1 self) -> OrderApiBracketBuilder<'a, 'f1>
Creates a bracket order with an entry order and attached take-profit and stop-loss legs.
§Panics
Panics if the bracket parameters fail validation or the order factory is already mutably borrowed.