Struct OrderRequest
pub struct OrderRequest {
pub market: Market,
pub side: Side,
pub order_type: OrderType,
pub size: Size,
pub price: Option<Decimal>,
pub time_in_force: Option<TimeInForce>,
pub reduce_only: bool,
pub client_id: Option<String>,
}Expand description
An order to place.
Build it with OrderRequest::market, OrderRequest::limit, or
OrderRequest::best, which keep price and size in step. Only a limit
order carries a caller-selected price.
Fields§
§market: MarketThe market to trade.
side: SideBuy or sell.
order_type: OrderTypeMarket, limit, or exchange-priced best.
size: SizeHow much, in base or quote terms.
price: Option<Decimal>The limit price. None for market and best orders.
time_in_force: Option<TimeInForce>How long the order stays live. None leaves it to the exchange default.
reduce_only: boolWhether the order may only reduce an existing position.
Derivatives only. Set it with OrderRequest::reduce_only.
client_id: Option<String>Caller-assigned order identifier, when the exchange supports one.
Implementations§
§impl OrderRequest
impl OrderRequest
pub fn market(market: Market, side: Side, size: Size) -> Self
pub fn market(market: Market, side: Side, size: Size) -> Self
An order that takes whatever the book offers, immediately.
pub fn limit(market: Market, side: Side, size: Size, price: Decimal) -> Self
pub fn limit(market: Market, side: Side, size: Size, price: Decimal) -> Self
An order that rests on the book at a stated price.
pub fn best(
market: Market,
side: Side,
size: Size,
time_in_force: TimeInForce,
) -> Self
pub fn best( market: Market, side: Side, size: Size, time_in_force: TimeInForce, ) -> Self
An order priced from the best opposing quote at submission time.
Exchanges that support this shape require immediate-or-cancel or fill-or-kill. The accepted size unit is exchange-specific.
pub fn time_in_force(self, time_in_force: TimeInForce) -> Self
pub fn time_in_force(self, time_in_force: TimeInForce) -> Self
Sets how long the order stays live.
pub fn reduce_only(self) -> Self
pub fn reduce_only(self) -> Self
Restricts the order to reducing an existing position.
Rejected as Error::Unsupported on spot
markets, which have no positions to reduce.
Trait Implementations§
§impl Clone for OrderRequest
impl Clone for OrderRequest
§fn clone(&self) -> OrderRequest
fn clone(&self) -> OrderRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for OrderRequest
impl Debug for OrderRequest
impl Eq for OrderRequest
§impl PartialEq for OrderRequest
impl PartialEq for OrderRequest
impl StructuralPartialEq for OrderRequest
Auto Trait Implementations§
impl Freeze for OrderRequest
impl RefUnwindSafe for OrderRequest
impl Send for OrderRequest
impl Sync for OrderRequest
impl Unpin for OrderRequest
impl UnsafeUnpin for OrderRequest
impl UnwindSafe for OrderRequest
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.