pub struct SetRiskLimit<'a> {
pub category: Category,
pub symbol: Cow<'a, str>,
pub risk_id: i8,
pub position_idx: Option<i32>,
}Expand description
Parameters for setting risk limits for a position.
Used to construct a request to the /v5/position/set-risk-limit endpoint to adjust risk limits for a specific symbol. Bots use this to control maximum exposure and manage liquidation risk in perpetual futures.
Fields§
§category: CategoryThe product category (e.g., Linear, Inverse).
Specifies the instrument type. Bots must set this to target the correct contract type.
symbol: Cow<'a, str>The trading pair symbol (e.g., “BTCUSDT”).
Identifies the perpetual futures contract for which risk limits are being set. Bots must specify a valid symbol.
risk_id: i8The risk ID to apply.
Identifies the risk limit tier to use, corresponding to specific margin and exposure limits. Bots should select a risk ID that aligns with their risk management strategy.
position_idx: Option<i32>The position index (optional).
Specifies the position type (e.g., 0 for one-way mode, 1 or 2 for hedge mode). Bots should set this for hedge mode positions to target the correct side.
Implementations§
Source§impl<'a> SetRiskLimit<'a>
impl<'a> SetRiskLimit<'a>
Sourcepub fn new(
category: Category,
symbol: &'a str,
risk_id: i8,
position_idx: Option<i32>,
) -> Self
pub fn new( category: Category, symbol: &'a str, risk_id: i8, position_idx: Option<i32>, ) -> Self
Constructs a new SetRiskLimit request with specified parameters.
Allows customization of the risk limit request. Bots should use this to specify the category, symbol, risk ID, and position index as needed.
Sourcepub fn default() -> SetRiskLimit<'a>
pub fn default() -> SetRiskLimit<'a>
Creates a default SetRiskLimit request.
Returns a request with category set to Linear, symbol set to "BTCUSDT", risk_id set to 1, and no position index. Suitable for testing but should be customized for production.
Trait Implementations§
Source§impl<'a> Clone for SetRiskLimit<'a>
impl<'a> Clone for SetRiskLimit<'a>
Source§fn clone(&self) -> SetRiskLimit<'a>
fn clone(&self) -> SetRiskLimit<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more