Simulation of a market making strategy using the Avellaneda–Stoikov model with EWMA volatility, Poisson fills, and risk controls.
- Price Process: Geometric Brownian Motion (GBM) with on-the-fly EWMA volatility estimation.
- Strategy: Avellaneda–Stoikov quoting with inventory skew and dynamic spread.
- Fill Model: Poisson-based probability of fills, decreasing exponentially with quote distance from mid-price.
- Risk Controls: Inventory caps and optional maximum drawdown kill-switch.
- Metrics & Reporting: Time-series logging with computed PnL, Sharpe ratio, and maximum drawdown.
- CLI & Configs: Configurable via YAML and runnable from the command line.
- Visualization: Generate equity curve, inventory, and spread plots.
git clone https://github.com/amitabhsinghh/Avellaneda-Stoikov-Market-Maker.git
cd Avellaneda-Stoikov-Market-Makerpython3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtpython -m mm_sim.run --config configs/as_small.yamlThis produces summary metrics in results_as_small.json and full time-series data in timeseries_as_small.csv.
python -m mm_sim.plot --results results_as_small.json --csv timeseries_as_small.csvShows plots for equity curve, inventory trajectory, and quoted spread.
- Parameter Sweeps – Customize the YAML config (e.g., volatility, gamma, risk thresholds) to run multiple simulations and compare performance metrics.
- Monte Carlo Simulations – Replicate simulations with different seeds or volatility regimes to compute statistical performance (Sharpe, drawdown, etc.).
- Experiment Logging – Save metrics and plots for comparative analysis across strategy variations.
├── configs/
│ └── as_small.yaml # Example configuration
├── mm_sim/
│ ├── config.py # Simulation parameters
│ ├── price_process.py # GBM & EWMA volatility
│ ├── strategy.py # AS quoting logic
│ ├── fill_model.py # Poisson fill simulation
│ ├── risk.py # Inventory/drawdown controls
│ ├── metrics.py # Tracking & metrics engine
│ ├── core.py # Simulation orchestration
│ ├── run.py # CLI entry point
│ └── plot.py # Plotting utilities
├── README.md # This file
├── requirements.txt # Python dependencies