Foundations of Market Making
A Market Maker (MM) provides liquidity to financial markets by simultaneously posting buy orders (bids) and sell orders (asks). The difference between these prices is the bid-ask spread. The market maker's primary goal is to capture this spread repeatedly while minimizing exposure to directional price moves.
In electronic markets, this liquidity is organized within the Limit Order Book (LOB). Market makers face two primary risks: adverse selection (trading against informed traders who know the price is about to move) and inventory risk (accumulating a large long or short position that loses value during a market trend).
1. Limit Order Book Dynamics
The LOB tracks all pending limit orders. * Market Orders: Executed immediately against the best available limit orders on the opposite side. * Limit Orders: Placed in the book and queue-prioritized by price, then time (Price-Time Priority).
Let $S^a_t$ represent the best ask price and $S^b_t$ the best bid price. The mid-price $S_t$ is: $$S_t = \frac{S^a_t + S^b_t}{2}$$
The bid-ask spread $\delta_t$ is: $$\delta_t = S^a_t - S^b_t$$
Market makers optimize their order placements (distance from mid-price) based on order arrival rates (modeled as Poisson processes) to ensure their orders get filled without sitting too long in the queue.
2. The Avellaneda-Stoikov Inventory Model
To manage inventory risk, market makers adjust their bid and ask quotes dynamically. The Avellaneda-Stoikov model provides the mathematical framework for this adjustment.
Let $q$ represent the market maker's inventory. The MM defines a reservation price $R$ which is shifted away from the mid-price $S$ based on their inventory $q$ and risk aversion parameter $\gamma$: $$R(s, q, t) = S_t - q \gamma \sigma^2 (T - t)$$ Where: * $\sigma$ = Asset price volatility * $T - t$ = Time horizon of the trading session
Quote Optimization * **Long Inventory ($q > 0$):** The reservation price $R$ shifts downward. The MM lowers both bid and ask quotes. This discourages buys (bids) and encourages sells (asks), helping to liquidate the inventory. * **Short Inventory ($q < 0$):** The reservation price $R$ shifts upward. The MM raises quotes to discourage asks and attract bids, covering the short position.
The optimal bid spread $d^b$ and ask spread $d^a$ from the mid-price are calculated as: $$d^a + d^b = \gamma \sigma^2 (T - t) + \frac{2}{\gamma} \ln\left(1 + \frac{\gamma}{\kappa}\right)$$ Where $\kappa$ represents the order book liquidity density.
3. Adverse Selection and HFT Exploitation
In high-frequency trading (HFT), adverse selection occurs when a market maker's limit order is filled right before a major price breakout. The counterparty is typically an informed trader or an institutional algorithm executing a sweep.
To detect toxic order flow, market makers compute Volume Toxicity metrics like the Volume-Synchronized Probability of Toxicity (VPIN). When VPIN exceeds safety thresholds, market making algorithms immediately widen their spreads or pull their quotes from the book to prevent capital depletion.
4. Microstructure Features for Market Making
To trade profitably in microseconds, HFT market makers feed real-time order book metrics into high-speed predictive engines:
- Order Flow Imbalance (OFI): OFI measures the net buying or selling pressure by analyzing changes in the quantities of resting limit orders at the best bid and ask levels:
- $$OFI_t = \Delta Q_{bid, t} - \Delta Q_{ask, t}$$
- Where $\Delta Q_{bid, t}$ is positive if the best bid price increases or if the volume at the best bid increases, and negative otherwise. Positive OFI is a strong short-term predictor of upward price moves.
- Micro-Price: The micro-price weights the bid and ask prices by their opposite volumes, providing a cleaner representation of immediate price direction than the mid-price:
- $$P_{micro} = \frac{Q^b S^a + Q^a S^b}{Q^b + Q^a}$$
- Where $Q^b$ and $Q^a$ represent the volumes at the best bid and ask.
5. Practical Checklist for HFT Market Maker System Design
- Optimize Network Architecture: Use low-latency protocols (fix/fast, binary protocols) and locate servers in co-location facilities near the exchange.
- Implement Price-Time Priority Queuing: Build structures to track your exact queue position at each price level of the limit order book.
- Compute Real-Time Micro-Price: Monitor the micro-price instead of the mid-price to anticipate order book imbalance.
- Calculate VPIN Toxicity: Monitor volume toxicity continuously. Reduce bid/ask sizes or halt trading if toxic flow thresholds are breached.
- Calibrate the Avellaneda-Stoikov Parameters: Update volatility $\sigma$ and liquidity intensity $\kappa$ dynamically using rolling intraday windows.
- Set Strict Inventory Limits: Implement hard bounds on maximum inventory $q$ to avoid exposure to catastrophic price trends.
- Perform Latency Audits: Regularly measure and optimize queue latency, execution latency, and network round-trip time.
- Utilize Passive Order Execution: Target execution via resting limit orders rather than aggressive market orders to capture the spread.
- Mitigate Correlation Risk: If market making across correlated pairs, manage inventory net exposures to prevent simultaneous drawdowns.
- Build a Microsecond Backtester: Simulate your algorithm against historical tick-by-tick L3 data, accounting for queue dynamics and market impact.