deribit_http/model/response/mmp.rs
1/******************************************************************************
2 Author: Joaquín Béjar García
3 Email: jb@taunais.com
4 Date: 7/3/26
5******************************************************************************/
6use pretty_simple_display::{DebugPretty, DisplaySimple};
7use serde::{Deserialize, Serialize};
8use serde_with::skip_serializing_none;
9
10/// Market Maker Protection (MMP) configuration
11///
12/// Contains the MMP parameters for a specific index and optional MMP group.
13#[skip_serializing_none]
14#[derive(DebugPretty, DisplaySimple, Clone, Serialize, Deserialize)]
15pub struct MmpConfig {
16 /// Index identifier (e.g., "btc_usd", "eth_usd")
17 pub index_name: String,
18 /// MMP group name (for Mass Quotes)
19 pub mmp_group: Option<String>,
20 /// Monitoring window duration in seconds
21 pub interval: u32,
22 /// Time in seconds that MMP remains active after being triggered
23 /// (0 = manual reset required)
24 pub frozen_time: u32,
25 /// Quantity limit for MMP
26 pub quantity_limit: Option<f64>,
27 /// Delta limit for MMP
28 pub delta_limit: Option<f64>,
29 /// Vega limit for MMP
30 pub vega_limit: Option<f64>,
31 /// Maximum quote quantity per side per order book
32 pub max_quote_quantity: Option<f64>,
33}
34
35/// Market Maker Protection (MMP) status
36///
37/// Contains the current MMP status for a triggered index or MMP group.
38#[skip_serializing_none]
39#[derive(DebugPretty, DisplaySimple, Clone, Serialize, Deserialize)]
40pub struct MmpStatus {
41 /// Index identifier (e.g., "btc_usd", "eth_usd")
42 pub index_name: String,
43 /// Timestamp (milliseconds since UNIX epoch) until the user is frozen
44 /// (0 = frozen until manual reset)
45 pub frozen_until: u64,
46 /// MMP group name (for Mass Quotes, optional)
47 pub mmp_group: Option<String>,
48}
49
50/// Request to set MMP configuration
51///
52/// Used to configure Market Maker Protection for a specific index.
53#[skip_serializing_none]
54#[derive(DebugPretty, DisplaySimple, Clone, Default, Serialize, Deserialize)]
55pub struct SetMmpConfigRequest {
56 /// Index identifier (e.g., "btc_usd", "eth_usd")
57 pub index_name: String,
58 /// Monitoring window duration in seconds (0 = remove MMP configuration)
59 pub interval: u32,
60 /// Time in seconds that MMP remains active after being triggered
61 /// (0 = manual reset required)
62 pub frozen_time: u32,
63 /// Quantity limit for MMP
64 pub quantity_limit: Option<f64>,
65 /// Delta limit for MMP
66 pub delta_limit: Option<f64>,
67 /// Vega limit for MMP
68 pub vega_limit: Option<f64>,
69 /// Maximum quote quantity per side per order book (required)
70 pub max_quote_quantity: Option<f64>,
71 /// MMP group name (for Mass Quotes)
72 pub mmp_group: Option<String>,
73 /// If true, configure MMP for Block RFQ
74 pub block_rfq: Option<bool>,
75}