Skip to content

About

Inventory-Aware Market-Making Strategy with Microstructural Signals

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

avellaneda-mm

Inventory-Aware Market-Making Strategy with Microstructural Signals

A research-grade market-making strategy implementation exploring order-flow-based signals and inventory-skewed quoting, backtested against historical L2 market data. Built on top of liquid-book (order book + matching infra) so this repo can focus entirely on the trading logic.

Research/backtesting only. Not connected to any live exchange, and not a claim of live trading performance. All results below are backtest results on historical/synthetic data, clearly labeled as such.

Status: early development. The "Backtest Results" section stays empty until a real backtest has actually run — see docs/description.md for the current plan and status.


Note on Infrastructure: The underlying exchange mechanics, order matching, and latency simulation for this strategy are powered by my custom C++/Java/Rust matching engine, liquid-book.


Why this exists

Separates the alpha/research question ("does this signal + quoting logic produce positive risk-adjusted PnL on historical data?") from the systems question (how fast can it run) — which lives in liquid-book. Keeping them apart makes both stories cleaner: this repo can be judged on statistical rigor and backtest methodology, not implementation speed.

Dependency

This repo depends on liquid-book for the order book and simulated exchange (as a git submodule or linked library — see Build section). It does not reimplement book/matching logic.

Core Ideas

Order Flow Imbalance (OFI)

Quantifies net supply/demand shifts by tracking changes in price and size at the best bid and ask across consecutive book updates. Positive OFI → buying pressure; negative → selling pressure.

Micro-Price

A volume-weighted mid-price incorporating top-of-book queue depth:

$$P_{\text{micro}} = \frac{P_{\text{bid}} \cdot V_{\text{ask}} + P_{\text{ask}} \cdot V_{\text{bid}}}{V_{\text{bid}} + V_{\text{ask}}}$$

When V_ask >> V_bid, the micro-price shifts toward the ask, suggesting the mid is more likely to move upward — the imbalance in resting size implies imbalance in near-term pressure.

Avellaneda-Stoikov Quoting

Inventory-aware two-sided quoting: reservation price skews away from current inventory (sell more aggressively when long, buy more aggressively when short), and spread widens with volatility. Classic market-making framework — implemented here as a baseline to compare signal-augmented variants against, not treated as novel on its own.

Repository Structure

include/
├── signals/                 # OFI, Micro-Price calculators
└── strategy/                # Avellaneda-Stoikov quoting logic
src/
├── strategy.cpp
└── backtest_runner.cpp
notebooks/                    # Exploratory analysis, signal validation (Python)
data/                         # Historical/synthetic L2 data (or symlink/fetch script)
docs/
└── description.md            # Detailed dev + research plan (start here)

Prerequisites

  • C++20 compiler (matches liquid-book)
  • liquid-book built and available (submodule: git submodule update --init)
  • Python 3.10+ with pandas, numpy, matplotlib for the analysis notebooks (signal validation and backtest reporting happen in Python; execution logic stays in C++)

Build

git submodule update --init --recursive
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)

Run a Backtest

./build/backtest_runner --data data/sample_l2.csv --strategy avellaneda_stoikov

Backtest Results

(Empty until a real backtest has run — see docs/description.md for methodology. Results here will include: Sharpe ratio, information coefficient (IC) of each signal, max drawdown, PnL curve, and — critically — the data date range and whether it's in-sample or out-of-sample. A backtest without an explicit train/test split is not a credible result.)

Future Scope

  • HMM regime classification (trending / mean-reverting / volatile) to condition strategy parameters
  • ML tick-direction prediction (LightGBM/XGBoost) on microstructural features
  • Multi-level weighted micro-price (top-K levels, exponential decay)
  • Trade arrival rate signal (EWMA intensity estimation)

License

MIT — see LICENSE.

About

Inventory-Aware Market-Making Strategy with Microstructural Signals

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors