Skip to content

amitabhsinghh/Avellaneda-Stoikov-Market-Maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Avellaneda-Stoikov-Market-Maker

Simulation of a market making strategy using the Avellaneda–Stoikov model with EWMA volatility, Poisson fills, and risk controls.


Features

  • 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.

Installation & Guide

1. Clone & Navigate

git clone https://github.com/amitabhsinghh/Avellaneda-Stoikov-Market-Maker.git
cd Avellaneda-Stoikov-Market-Maker

2. Create Virtual Environment (macOS)

python3 -m venv .venv
source .venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

4. Run the Simulator

python -m mm_sim.run --config configs/as_small.yaml

This produces summary metrics in results_as_small.json and full time-series data in timeseries_as_small.csv.

5. Visualize Results

python -m mm_sim.plot --results results_as_small.json --csv timeseries_as_small.csv

Shows plots for equity curve, inventory trajectory, and quoted spread.


Recommended Usage

  • 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.

Project Structure

├── 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

About

Simulation of a market making strategy using the Avellaneda–Stoikov model with EWMA volatility, Poisson fills, and risk controls.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages