bybit/models/
price_filter.rs

1use crate::prelude::*;
2
3/// Price constraints for an instrument.
4///
5/// Defines the allowable price ranges and increments for orders. Bots must use these to place valid orders in perpetual futures.
6#[derive(Debug, Serialize, Deserialize, Default, Clone)]
7#[serde(rename_all = "camelCase", default)]
8pub struct PriceFilter {
9    /// The minimum price allowed (optional).
10    ///
11    /// The lowest price at which orders can be placed. If `None`, there’s no lower bound. Bots should check this to avoid rejected orders due to prices being too low.
12    #[serde(
13        with = "string_to_float_optional",
14        skip_serializing_if = "Option::is_none"
15    )]
16    pub min_price: Option<f64>,
17    /// The maximum price allowed (optional).
18    ///
19    /// The highest price at which orders can be placed. If `None`, there’s no upper bound. Bots should ensure order prices are below this to avoid rejections.
20    #[serde(
21        with = "string_to_float_optional",
22        skip_serializing_if = "Option::is_none"
23    )]
24    pub max_price: Option<f64>,
25    /// The price tick size.
26    ///
27    /// The increment for price changes (e.g., `0.01` for two decimal places). Bots must round order prices to this increment to comply with Bybit’s precision rules, avoiding rejection.
28    #[serde(with = "string_to_float")]
29    pub tick_size: f64,
30}