Skip to main content

OrderApi

Struct OrderApi 

Source
pub struct OrderApi<'a> { /* private fields */ }
Expand description

User-facing order creation API.

Implementations§

Source§

impl<'a> OrderApi<'a>

Source

pub fn generate_client_order_id(&self) -> ClientOrderId

Generates a new client order ID.

§Panics

Panics if the order factory is already mutably borrowed.

Source

pub fn generate_order_list_id(&self) -> OrderListId

Generates a new order list ID.

§Panics

Panics if the order factory is already mutably borrowed.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<'a> Debug for OrderApi<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for OrderApi<'a>

§

impl<'a> !Send for OrderApi<'a>

§

impl<'a> !Sync for OrderApi<'a>

§

impl<'a> !UnwindSafe for OrderApi<'a>

§

impl<'a> Freeze for OrderApi<'a>

§

impl<'a> Unpin for OrderApi<'a>

§

impl<'a> UnsafeUnpin for OrderApi<'a>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more