Skip to main content

hypercall_db/types/
mmp.rs

1//! Market Maker Protection (MMP) configuration types.
2//!
3//! Per-wallet, per-currency monitoring intervals and Greek limits that
4//! trigger an automatic order freeze when exceeded.
5
6use chrono::NaiveDateTime;
7use hypercall_types::WalletAddress;
8use rust_decimal::Decimal;
9use serde::{Deserialize, Serialize};
10
11/// MMP config for a wallet+currency pair. When fills exceed the configured
12/// limits within the interval, the wallet's orders are frozen.
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct MmpConfigRecord {
15    pub wallet_address: WalletAddress,
16    /// Underlying currency this config applies to, e.g. "BTC".
17    pub currency: String,
18    /// Monitoring window in milliseconds.
19    pub interval_ms: i64,
20    /// How long to freeze after trigger, in milliseconds.
21    pub frozen_time_ms: i64,
22    pub qty_limit: Option<Decimal>,
23    pub delta_limit: Option<Decimal>,
24    pub vega_limit: Option<Decimal>,
25    pub enabled: bool,
26    pub created_at: Option<NaiveDateTime>,
27    pub updated_at: Option<NaiveDateTime>,
28}