pub struct SetTradingStopRequest {Show 16 fields
pub category: Category,
pub symbol: String,
pub position_idx: PositionIdx,
pub take_profit: Option<Decimal>,
pub stop_loss: Option<Decimal>,
pub trailing_stop: Option<Decimal>,
pub tp_trigger_by: Option<TriggerBy>,
pub sl_trigger_by: Option<TriggerBy>,
pub active_price: Option<Decimal>,
pub tp_size: Option<Decimal>,
pub sl_size: Option<Decimal>,
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 tpsl_mode: Option<TpslMode>,
}Expand description
Request body of POST /v5/position/trading-stop (Client::set_trading_stop).
Fields§
§category: Categorylinear, inverse
symbol: StringSymbol name, like BTCUSDT, uppercase only.
position_idx: PositionIdxRequired. 0: one-way, 1: hedge Buy side, 2: hedge Sell side
take_profit: Option<Decimal>Cannot be less than 0, 0 means cancel TP.
stop_loss: Option<Decimal>Cannot be less than 0, 0 means cancel SL.
trailing_stop: Option<Decimal>Trailing stop distance from market price
tp_trigger_by: Option<TriggerBy>Take profit trigger price type.
sl_trigger_by: Option<TriggerBy>Stop loss trigger price type.
active_price: Option<Decimal>Activation price for trailing stop
tp_size: Option<Decimal>Partial TP quantity
sl_size: Option<Decimal>Partial SL quantity
tp_limit_price: Option<Decimal>Limit price for TP limit order
sl_limit_price: Option<Decimal>Limit price for SL limit order
tp_order_type: Option<OrderType>The order type when take profit is triggered. Market (default), Limit For tpslMode=Full, it only supports tpOrderType=“Market”.
sl_order_type: Option<OrderType>The order type when stop loss is triggered. Market (default), Limit For tpslMode=Full, it only supports slOrderType=“Market”.
tpsl_mode: Option<TpslMode>TP/SL mode Full: entire position TP/SL, option supports “tpslMode”= Full only Partial: partial position TP/SL.
Implementations§
Source§impl SetTradingStopRequest
impl SetTradingStopRequest
Sourcepub fn new(
category: Category,
symbol: impl Into<String>,
position_idx: PositionIdx,
) -> Self
pub fn new( category: Category, symbol: impl Into<String>, position_idx: PositionIdx, ) -> Self
Create with the required fields; set the optional ones with the with_* methods.
Sourcepub fn with_take_profit(self, v: Decimal) -> Self
pub fn with_take_profit(self, v: Decimal) -> Self
Set take_profit: cannot be less than 0, 0 means cancel TP.
Sourcepub fn with_stop_loss(self, v: Decimal) -> Self
pub fn with_stop_loss(self, v: Decimal) -> Self
Set stop_loss: cannot be less than 0, 0 means cancel SL.
Sourcepub fn with_trailing_stop(self, v: Decimal) -> Self
pub fn with_trailing_stop(self, v: Decimal) -> Self
Set trailing_stop: trailing stop distance from market price.
Sourcepub fn with_tp_trigger_by(self, v: TriggerBy) -> Self
pub fn with_tp_trigger_by(self, v: TriggerBy) -> Self
Set tp_trigger_by: take profit trigger price type.
Sourcepub fn with_sl_trigger_by(self, v: TriggerBy) -> Self
pub fn with_sl_trigger_by(self, v: TriggerBy) -> Self
Set sl_trigger_by: stop loss trigger price type.
Sourcepub fn with_active_price(self, v: Decimal) -> Self
pub fn with_active_price(self, v: Decimal) -> Self
Set active_price: activation price for trailing stop.
Sourcepub fn with_tp_size(self, v: Decimal) -> Self
pub fn with_tp_size(self, v: Decimal) -> Self
Set tp_size: partial TP quantity.
Sourcepub fn with_sl_size(self, v: Decimal) -> Self
pub fn with_sl_size(self, v: Decimal) -> Self
Set sl_size: partial SL quantity.
Sourcepub fn with_tp_limit_price(self, v: Decimal) -> Self
pub fn with_tp_limit_price(self, v: Decimal) -> Self
Set tp_limit_price: limit price for TP limit order.
Sourcepub fn with_sl_limit_price(self, v: Decimal) -> Self
pub fn with_sl_limit_price(self, v: Decimal) -> Self
Set sl_limit_price: limit price for SL limit order.
Sourcepub fn with_tp_order_type(self, v: OrderType) -> Self
pub fn with_tp_order_type(self, v: OrderType) -> Self
Set tp_order_type: the order type when take profit is triggered. Market (default), Limit For tpslMode=Full, it only supports tpOrderType=“Market”.
Sourcepub fn with_sl_order_type(self, v: OrderType) -> Self
pub fn with_sl_order_type(self, v: OrderType) -> Self
Set sl_order_type: the order type when stop loss is triggered. Market (default), Limit For tpslMode=Full, it only supports slOrderType=“Market”.
Sourcepub fn with_tpsl_mode(self, v: TpslMode) -> Self
pub fn with_tpsl_mode(self, v: TpslMode) -> Self
Set tpsl_mode: tP/SL mode Full: entire position TP/SL, option supports “tpslMode”= Full only Partial: partial position TP/SL.