Back to Research
Algorithmic Trading July 18, 2026 • 15 min read

Optimal Market Making: Inventory Control and Spread Dynamics under Avellaneda-Stoikov

An in-depth look at stochastic control theory in order book dynamics, formulating optimal reservation prices and dynamic spreads to mitigate inventory drift.

High-tech glowing digital server racks displaying mathematical equations and market curves representing order book liquidity control

1. The Market Maker's Dilemma: Adverse Selection vs. Inventory Risk

In electronic limit order markets, market makers perform a critical utility: they supply liquidity by simultaneously placing bid and ask limit orders. Their primary source of revenue is the bid-ask spread—collecting the difference when matching counterparties buy and sell. However, this process exposes the market maker to two distinct, hostile forces: adverse selection and inventory risk.

Adverse Selection occurs when the market maker trades with informed participants (traders possessing superior information or latency advantage). These trades result in immediate losses as the price shifts in the direction of the trade, leaving the market maker holding a devaluing asset. Inventory Risk is the risk of holding a non-zero position (long or short) while the underlying asset price undergoes stochastic drift. If a market maker accumulates a large long inventory during a downward market trend, the resulting mark-to-market losses can easily erase days of accumulated spread capture.

To survive, a market maker must dynamically adjust their bid and ask prices relative to their current inventory. If they hold a long position, they must lower their bid (to make buying less likely) and lower their ask (to make selling more attractive), actively shedding inventory. This paper examines the mathematical framework developed by Marco Avellaneda and Sasha Stoikov in their seminal 2008 paper, providing a blueprint for modern stochastic inventory control in high-frequency trading.

2. Setup of the Avellaneda-Stoikov Model

The model assumes a market maker operating over a finite time horizon $T$ in a market where the mid-price $S_t$ of an asset follows an arithmetic Brownian motion with no drift:

dS_t = σ dW_t

where σ is the asset price volatility and $W_t$ is a standard 1D Brownian motion. The market maker's cash position $x_t$ and inventory of the asset $q_t$ define their total wealth at any point:

X_t = x_t + q_t S_t

At each time step $t$, the market maker posts a bid price $P_t^b = S_t - δ_t^b$ and an ask price $P_t^a = S_t + δ_t^a$. The distances to the mid-price, δ_t^b and δ_t^a, are the control variables. The total spread is δ_t^b + δ_t^a.

A. Order Execution Modeling

The execution of the market maker's limit orders is modeled as a Poisson process with arrival intensities λ^b(δ^b) and λ^a(δ^a). The probability of an order execution decreases exponentially as the order is placed further from the mid-price:

λ^b(δ^b) = A e^{-k δ^b},      λ^a(δ^a) = A e^{-k δ^a}

Here, $A$ represents the overall market order frequency, and $k$ represents the order book density (liquidity decay rate). A high value of $k$ means the order book is thin, and placing an order slightly further from the mid-price drastically reduces the execution probability.

3. The Optimal Reservation Price

The market maker's objective is to maximize the expected utility of their terminal wealth at $T$, penalizing variance (inventory risk) using an absolute risk aversion parameter γ:

U(X_T) = -e^{-\gamma X_T}

By solving the Hamilton-Jacobi-Bellman (HJB) equation for this stochastic control problem, Avellaneda and Stoikov derived the concept of the Reservation Price ($R$). The reservation price is the subjective value the market maker assigns to a unit of the asset, given their current inventory $q$ and remaining time $(T - t)$:

R(s, q, t) = s - q γ σ^2 (T - t)

where $s$ is the best mid-price. This formula reveals several fundamental execution dynamics:

  • Neutral Inventory ($q=0$): If the market maker has no inventory, the reservation price is equal to the mid-price ($R = s$).
  • Long Inventory ($q > 0$): The reservation price is lower than the mid-price. Because the market maker is long, they discount the asset value to encourage selling and discourage buying.
  • Short Inventory ($q < 0$): The reservation price is higher than the mid-price. The market maker values the asset more highly to encourage buying and cover their short position.
  • Time Decay: The correction factor increases as time approaches $T$ (though in practice, high-frequency algorithms often use an infinite horizon approximation where $(T - t)$ is replaced by a constant utility decay factor).

4. Optimal Spreads and Order Placement

Once the reservation price $R$ is calculated, the optimal bid and ask spreads, δ^b and δ^a, are positioned symmetrically around $R$ rather than the mid-price $s$. The optimal spreads are formulated as:

δ^b(q, t) = (R(s, q, t) - s) + \frac{1}{\gamma} \ln\left(1 + \frac{\gamma}{k}\right)
δ^a(q, t) = (s - R(s, q, t)) + \frac{1}{\gamma} \ln\left(1 + \frac{\gamma}{k}\right)

Combining the reservation price formula with the spread equations gives the final placement targets for bid and ask quotes:

P^b = R(s, q, t) - \frac{1}{\gamma} \ln\left(1 + \frac{\gamma}{k}\right)
P^a = R(s, q, t) + \frac{1}{\gamma} \ln\left(1 + \frac{\gamma}{k}\right)

5. Quantitative Simulation of Optimal Spreads

Let us evaluate how optimal quote offsets scale under varying inventory constraints. We assume parameters typical of a liquid digital asset market: σ = 0.02, γ = 0.1, $k = 1.5$, and $(T-t) = 1.0$. The table below charts the optimal bid and ask offsets relative to the mid-price:

Inventory (q) Reservation Offset (R - s) Bid Offset (δb) Ask Offset (δa) Total Spread
-3 (Short) +0.00120 0.00318 0.00558 0.00876
-1 (Short) +0.00040 0.00398 0.00478 0.00876
0 (Neutral) 0.00000 0.00438 0.00438 0.00876
+1 (Long) -0.00040 0.00478 0.00398 0.00876
+3 (Long) -0.00120 0.00558 0.00318 0.00876

The data highlights the elegant symmetry of the model. When holding a long inventory of $+3$ units:

  • The reservation price shifts downward by $0.00120$.
  • The optimal bid offset δ^b increases to $0.00558$ (placing the bid order deeper inside the book, making an execution less likely).
  • The optimal ask offset δ^a decreases to $0.00318$ (bringing the ask closer to the mid-price, making a fill highly likely).
  • The total spread remains constant at $0.00876$. The quotes simply shift in unison around the moving reservation price.

6. Implementation in Modern HFT Infrastructure

While the mathematical beauty of the Avellaneda-Stoikov model is clear, executing it in modern fragmented markets introduces significant engineering challenges. In a live HFT environment, volatility σ and order book density $k$ are not static parameters—they are dynamic, noisy signals that must be estimated in real-time.

At TwoWayMind, our execution engine maps this stochastic control model onto FPGA-accelerated tick pipelines. Instead of static estimations, we compute volatility dynamically using high-frequency Realized Volatility metrics over sub-millisecond sliding windows. The book density parameter $k$ is estimated continuously by tracking the fill-to-cancellation ratios of best bid/ask quotes, allowing the engine to widen spreads instantly ahead of major volume events (adverse selection protection).

Furthermore, because cryptocurrency markets feature extreme skewness and non-normal jumps, our models extend the standard Brownian motion assumption to include jump-diffusion processes, preventing the market maker from getting run over during rapid flash-crash events. By automating this inventory-controlled spread adjustment at microsecond speeds, we maintain stable execution spreads while eliminating inventory tail risk.