Skip to main content

bybit/models/
leverage_filter.rs

1use crate::prelude::*;
2
3/// Leverage constraints for a futures instrument.
4///
5/// Specifies the allowable leverage settings for a perpetual futures contract. Bots must adhere to these to set valid leverage levels and manage risk.
6#[derive(Debug, Serialize, Deserialize, Clone)]
7#[serde(rename_all = "camelCase")]
8pub struct LeverageFilter {
9    /// The minimum leverage allowed.
10    ///
11    /// The lowest leverage setting for the contract (e.g., `"1"` for 1x). Bots must ensure leverage settings are at least this value to avoid API errors. Low leverage reduces risk but also potential returns.
12    #[serde(with = "string_to_float")]
13    pub min_leverage: f64,
14    /// The maximum leverage allowed.
15    ///
16    /// The highest leverage setting (e.g., `"100"` for 100x). High leverage amplifies gains and losses in perpetual futures, increasing liquidation risk. Bots should use this to cap leverage based on risk tolerance.
17    #[serde(with = "string_to_float")]
18    pub max_leverage: f64,
19    /// The leverage step size.
20    ///
21    /// The increment for leverage adjustments (e.g., `"0.1"`). Bots must set leverage in multiples of this step to comply with Bybit’s rules.
22    #[serde(with = "string_to_float")]
23    pub leverage_step: f64,
24}