# Avellaneda–Stoikov Optimal Market Making

The Avellaneda–Stoikov model: reservation price, inventory skew and the optimal spread from risk aversion and order arrival rates.

## About this tool

The Avellaneda–Stoikov model answers a precise question: where should a risk-averse market maker place the bid and the ask? The answer has two parts. First, the centre of the quotes is not the mid price but a reservation price that moves away from it in proportion to the inventory: r = s − qγσ²(T − t), where q is the position, γ the risk aversion, σ the volatility and T − t the time left. Second, the total spread is γσ²(T − t) + (2/γ)·ln(1 + γ/k), where k says how fast order arrivals fall off with distance. This lab turns both formulas into something you can see move.

## Frequently asked questions

### What is the reservation price?

It is the price at which the market maker is indifferent between holding the current inventory and not holding it. With a long position the reservation price lies below the mid, because the maker would accept a little less to get rid of risk. Quoting around it instead of around the mid skews both quotes: with a long inventory the ask becomes more attractive and the bid less so, and the position tends to shrink.

### Where does the optimal spread come from?

It has two terms. The term γσ²(T − t) is compensation for the risk of holding inventory until the end of the horizon. The term (2/γ)·ln(1 + γ/k) comes from the order arrival: when arrivals fall off quickly with distance (large k), quoting wide loses too many trades, so the spread is tighter. A very risk-averse maker quotes wider to trade less often.

### What should I try in the lab?

Start with zero inventory and see the quotes sit symmetrically around the mid. Then push the inventory positive and watch both quotes slide down. Raise γ and the skew grows; shorten the time left and the skew fades because there is less time for the price to move. Finally draw your own policy and compare its P&L and inventory path with the model's on the same seed.

### Is a higher risk aversion always safer?

It reduces inventory swings, but it is not free. A very large γ pushes the quotes wide and skews them hard, so the maker trades less and gives away edge on almost every fill it does get. The common misconception is that zero inventory is the goal; the model actually trades a little inventory risk for spread income, and the best γ depends on how you score the result.

## Learn the theory

- [Inventory risk and quote skewing](https://quantsandbox.dev/guide/microstructure/inventory-risk): How a maker's position turns price moves into P&L, why that risk grows with position and time, and how shading both quotes pulls inventory back to zero.
- [Optimal quoting: the Avellaneda–Stoikov model](https://quantsandbox.dev/guide/microstructure/avellaneda-stoikov): Exponential utility, fills that fall off with distance from the mid, the reservation price, the optimal spread, and how risk aversion and time shape quotes.

Open the interactive tool: https://quantsandbox.dev/avellaneda-stoikov
