Skip to main content

Module mmp

Module mmp 

Source
Expand description

Engine-internal MMP (Market Maker Protection) state.

Market Maker Protection is a risk control mechanism that automatically freezes a market maker’s trading when cumulative fill exposure exceeds configured thresholds within a rolling time window. This prevents runaway fills during adverse market conditions or quoting errors.

Each (wallet, currency) pair has its own EngineMmpState. The state tracks fills in a rolling window of interval_ms duration and monitors three independent limits: quantity, delta, and vega. Breaching any enabled limit freezes the market maker for frozen_time_ms, during which all fills are rejected.

All operations are synchronous. No timers or background tasks are involved. Time advances only when the caller provides current_time_ms to EngineMmpState::process_fill or EngineMmpState::is_frozen.

Structs§

EngineMmpState
Engine-internal MMP state for a single (wallet, currency) pair.
MmpFillRecord
A single fill record tracked by MMP.