Skip to main content

PlaceOrderRequest

Struct PlaceOrderRequest 

Source
pub struct PlaceOrderRequest {
Show 33 fields pub category: Category, pub symbol: String, pub is_leverage: Option<i64>, pub side: Side, pub order_type: OrderType, pub qty: Decimal, pub market_unit: Option<String>, pub slippage_tolerance_type: Option<Decimal>, pub slippage_tolerance: Option<Decimal>, pub price: Option<Decimal>, pub trigger_direction: Option<TriggerDirection>, pub order_filter: Option<String>, pub trigger_price: Option<Decimal>, pub trigger_by: Option<TriggerBy>, pub order_iv: Option<Decimal>, pub time_in_force: Option<TimeInForce>, pub position_idx: Option<PositionIdx>, pub order_link_id: Option<String>, pub take_profit: Option<Decimal>, pub stop_loss: Option<Decimal>, pub tp_trigger_by: Option<TriggerBy>, pub sl_trigger_by: Option<TriggerBy>, pub reduce_only: Option<bool>, pub close_on_trigger: Option<bool>, pub smp_type: Option<SmpType>, pub mmp: Option<bool>, pub tpsl_mode: Option<TpslMode>, pub tp_limit_price: Option<Decimal>, pub sl_limit_price: Option<Decimal>, pub tp_order_type: Option<OrderType>, pub sl_order_type: Option<OrderType>, pub bbo_side_type: Option<String>, pub bbo_level: Option<String>,
}

Fields§

§category: Category

Product type UTA2.0, UTA1.0: linear, inverse, spot, option classic account: linear, inverse, spot

§symbol: String

Symbol name, like BTCUSDT, uppercase only

§is_leverage: Option<i64>

0(default): false, spot trading 1: true, margin trading, make sure you turn on margin trading, and set the relevant currency as collateral

§side: Side

Buy, Sell

§order_type: OrderType

Market, Limit

§qty: Decimal

Order quantity UTA account Spot: Market Buy order by value by default, you can set marketUnit field to choose order by value or qty for market orders Perps, Futures & Option: always order by qty classic account Spot: Market Buy order by value by default Perps, Futures: always order by qty Perps & Futures: if you pass qty=“0” and specify reduceOnly=true&closeOnTrigger=true, you can close the position up to maxMktOrderQty or maxOrderQty shown on Get Instruments Info of current symbol

§market_unit: Option<String>

Select the unit for qty when create Spot market orders for UTA account baseCoin: for example, buy BTCUSDT, then “qty” unit is BTC quoteCoin: for example, sell BTCUSDT, then “qty” unit is USDT

§slippage_tolerance_type: Option<Decimal>

Slippage tolerance Type for market order, TickSize, Percent take profit, stoploss, conditional orders are not supported TickSize: the highest price of Buy order = ask1 + slippageTolerance x tickSize; the lowest price of Sell order = bid1 - slippageTolerance x tickSize Percent: the highest price of Buy order = ask1 x (1 + slippageTolerance x 0.01); the lowest price of Sell order = bid1 x (1 - slippageTolerance x 0.01)

§slippage_tolerance: Option<Decimal>

Slippage tolerance value TickSize: range is [1, 10000], integer only Percent: range is [0.01, 10], up to 2 decimals

§price: Option<Decimal>

Order price Market order will ignore this field Please check the min price and price precision from instrument info endpoint If you have position, price needs to be better than liquidation price

§trigger_direction: Option<TriggerDirection>

Conditional order param. Used to identify the expected direction of the conditional order. 1: triggered when market price rises to triggerPrice 2: triggered when market price falls to triggerPrice Valid for linear & inverse

§order_filter: Option<String>

If it is not passed, Order by default. Order tpslOrder: Spot TP/SL order, the assets are occupied even before the order is triggered StopOrder: Spot conditional order, the assets will not be occupied until the price of the underlying asset reaches the trigger price, and the required assets will be occupied after the Conditional order is triggered Valid for spot only

§trigger_price: Option<Decimal>

For Perps & Futures, it is the conditional order trigger price. If you expect the price to rise to trigger your conditional order, make sure: triggerPrice > market price Else, triggerPrice < market price For spot, it is the TP/SL and Conditional order trigger price

§trigger_by: Option<TriggerBy>

Trigger price type, Conditional order param for Perps & Futures. LastPrice IndexPrice MarkPrice Valid for linear & inverse

§order_iv: Option<Decimal>

Implied volatility. option only. Pass the real value, e.g for 10%, 0.1 should be passed. orderIv has a higher priority when price is passed as well

§time_in_force: Option<TimeInForce>

Time in force Market order will always use IOC If not passed, GTC is used by default

§position_idx: Option<PositionIdx>

Used to identify positions in different position modes. Under hedge-mode, this param is required 0: one-way mode 1: hedge-mode Buy side 2: hedge-mode Sell side

§order_link_id: Option<String>

User customised order ID. A max of 36 characters. Combinations of numbers, letters (upper and lower cases), dashes, and underscores are supported. Futures & Perps: orderLinkId rules: optional param always unique option orderLinkId rules: required param always unique

§take_profit: Option<Decimal>

Take profit price UTA: Spot Limit order supports take profit, stop loss or limit take profit, limit stop loss when creating an order

§stop_loss: Option<Decimal>

Stop loss price UTA: Spot Limit order supports take profit, stop loss or limit take profit, limit stop loss when creating an order

§tp_trigger_by: Option<TriggerBy>

The price type to trigger take profit. MarkPrice, IndexPrice, default: LastPrice. Valid for linear & inverse

§sl_trigger_by: Option<TriggerBy>

The price type to trigger stop loss. MarkPrice, IndexPrice, default: LastPrice. Valid for linear & inverse

§reduce_only: Option<bool>

What is a reduce-only order? true means your position can only reduce in size if this order is triggered. You must specify it as true when you are about to close/reduce the position When reduceOnly is true, take profit/stop loss cannot be set Valid for linear, inverse & option

§close_on_trigger: Option<bool>

What is a close on trigger order? For a closing order. It can only reduce your position, not increase it. If the account has insufficient available balance when the closing order is triggered, then other active orders of similar contracts will be cancelled or reduced. It can be used to ensure your stop loss reduces your position regardless of current available margin. Valid for linear & inverse

§smp_type: Option<SmpType>

Smp execution type. What is SMP?

§mmp: Option<bool>

Market maker protection. option only. true means set the order as a market maker protection order. What is mmp?

§tpsl_mode: Option<TpslMode>

TP/SL mode Full: entire position for TP/SL. Then, tpOrderType or slOrderType must be Market Partial: partial position tp/sl (as there is no size option, so it will create tp/sl orders with the qty you actually fill). Limit TP/SL order are supported. Note: When create limit tp/sl, tpslMode is required and it must be Partial Valid for linear & inverse

§tp_limit_price: Option<Decimal>

The limit order price when take profit price is triggered linear & inverse: only works when tpslMode=Partial and tpOrderType=Limit Spot(UTA): it is required when the order has takeProfit and “tpOrderType”=Limit

§sl_limit_price: Option<Decimal>

The limit order price when stop loss price is triggered linear & inverse: only works when tpslMode=Partial and slOrderType=Limit Spot(UTA): it is required when the order has stopLoss and “slOrderType”=Limit

§tp_order_type: Option<OrderType>

The order type when take profit is triggered linear & inverse: Market(default), Limit. For tpslMode=Full, it only supports tpOrderType=Market Spot(UTA): Market: when you set “takeProfit”, Limit: when you set “takeProfit” and “tpLimitPrice”

§sl_order_type: Option<OrderType>

The order type when stop loss is triggered linear & inverse: Market(default), Limit. For tpslMode=Full, it only supports slOrderType=Market Spot(UTA): Market: when you set “stopLoss”, Limit: when you set “stopLoss” and “slLimitPrice”

§bbo_side_type: Option<String>

Queue: use the order price on the orderbook in the same direction as the side Counterparty: use the order price on the orderbook in the opposite direction as the side Valid for linear & inverse

§bbo_level: Option<String>

1,2,3,4,5 Valid for linear & inverse

Implementations§

Source§

impl PlaceOrderRequest

Source

pub fn new( category: Category, symbol: String, side: Side, order_type: OrderType, qty: Decimal, ) -> Self

Source

pub fn with_is_leverage(self, v: i64) -> Self

Source

pub fn with_market_unit(self, v: String) -> Self

Source

pub fn with_slippage_tolerance_type(self, v: Decimal) -> Self

Source

pub fn with_slippage_tolerance(self, v: Decimal) -> Self

Source

pub fn with_price(self, v: Decimal) -> Self

Source

pub fn with_trigger_direction(self, v: TriggerDirection) -> Self

Source

pub fn with_order_filter(self, v: String) -> Self

Source

pub fn with_trigger_price(self, v: Decimal) -> Self

Source

pub fn with_trigger_by(self, v: TriggerBy) -> Self

Source

pub fn with_order_iv(self, v: Decimal) -> Self

Source

pub fn with_time_in_force(self, v: TimeInForce) -> Self

Source

pub fn with_position_idx(self, v: PositionIdx) -> Self

Source

pub fn with_take_profit(self, v: Decimal) -> Self

Source

pub fn with_stop_loss(self, v: Decimal) -> Self

Source

pub fn with_tp_trigger_by(self, v: TriggerBy) -> Self

Source

pub fn with_sl_trigger_by(self, v: TriggerBy) -> Self

Source

pub fn with_reduce_only(self, v: bool) -> Self

Source

pub fn with_close_on_trigger(self, v: bool) -> Self

Source

pub fn with_smp_type(self, v: SmpType) -> Self

Source

pub fn with_mmp(self, v: bool) -> Self

Source

pub fn with_tpsl_mode(self, v: TpslMode) -> Self

Source

pub fn with_tp_limit_price(self, v: Decimal) -> Self

Source

pub fn with_sl_limit_price(self, v: Decimal) -> Self

Source

pub fn with_tp_order_type(self, v: OrderType) -> Self

Source

pub fn with_sl_order_type(self, v: OrderType) -> Self

Source

pub fn with_bbo_side_type(self, v: String) -> Self

Source

pub fn with_bbo_level(self, v: String) -> Self

Trait Implementations§

Source§

impl Debug for PlaceOrderRequest

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Serialize for PlaceOrderRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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
Source§

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

Source§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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