Market Making Lab
How market makers quote, and what they are actually paid for. Everything here is simulated. Read the write-up.
What is this? You are the market maker: set a bid and an ask around a price you cannot see ahead, and try to earn the spread without being picked off by traders who know where the price is going.
- P&L
- $11.46
- Inventory
- 0
- Fill rate
- 57.9%
- Picked off
- 0.9%
- Spread per fill
- 4.75c
234 of 404 orders
share of fills that were informed
You earned $11.06 from uninformed traders and lost $0.02 to informed ones; holding inventory while the price moved added $0.41. Widening the spread earns more per trade but fills less.
Mid price, your quotes and fills
Inventory
Cumulative P&L, split
Find the best spread
Expected P&L at 25 half-spreads, 200 simulated runs each, same market paths for every spread.
Limitations
Simulated order flow, not market data. No queue priority, fees, rebates or latency; one unit per fill; the fill model and the informed-trader rule are assumptions. A teaching tool, not a trading strategy.
Not investment advice.
What is this? How a market maker should move and widen its quotes as inventory builds up, using the Avellaneda-Stoikov model.
- Time t
- 0.500
- Inventory q
- 0
- Reservation price r
- 101.808
- Optimal spread δ
- 1.491
step 100 of 200
mid 101.808
bid 101.06 · ask 102.55
One path: mid, reservation price and A-S quotes
When the market maker is long, the reservation price drops below the mid, so both quotes move down: the ask gets more attractive and the bid less, so sells fill more often than buys and inventory drifts back to zero. Short inventory does the reverse. Holding less inventory means less exposure to price moves, which is why A-S has a much narrower spread of outcomes than a fixed symmetric spread, usually for a little less average profit.
A-S against a fixed symmetric spread
500 paths each, the same price paths and fill draws for both strategies. Naive half-spread ±0.746.
Limitations
Model assumptions: fills arrive at a rate A·exp(-k·distance) that only depends on how far the quote is from the mid; the mid follows a Brownian motion with no drift or jumps; there are no informed traders, so no adverse selection; one unit per fill, no fees or queue position. Simulated, not market data.
Not investment advice.
What is this? Why a spread has to exist at all: the Glosten-Milgrom model finds the spread that just covers losses to informed traders.
The spread exists to pay for losses to informed traders.
- Bid = E[V | sell]
- 99.800
- Ask = E[V | buy]
- 100.200
- Spread
- 0.400
- P(buy)
- 0.500
20.0% of the value range
Per trade: earned from uninformed traders, lost to informed ones
At these quotes the two cancel exactly (net 0.000000): the bid and ask are set so the market maker breaks even on average.
Price discovery: belief and quotes after each trade
True value 99.00 (low). After 60 trades the belief P(high) is 0.008 and the spread is 0.0188. Each buy or sell moves the belief by Bayes' rule; the more informed the flow, the faster the quotes converge on the truth.
Try this in Quote & survive
Sets the informed share to 20% and informed traders to see 1 step ahead. Informed traders who see further ahead are what push the best spread out, so a high informed share comes with a longer horizon.
Limitations
Two possible values, one unit per trade, a competitive market maker who breaks even, and traders who never trade on price alone. A teaching model, not a description of a real order book.
Not investment advice.
What is this? How an options market maker who delta-hedges earns or loses depending on whether the stock moves more or less than the option price implied.
Long gamma earns when realised volatility is above implied, and loses time decay when it isn't. Break-even realised vol = implied vol.
- Final P&L (this path)
- $46.91
- Gamma P&L
- $159.78
- Theta P&L
- -$139.31
- Residual
- $26.45
- Analytic approximation
- $64.10
½·Γ·(ΔS)² summed
time decay
financing, higher-order terms
½·Γ₀·S₀²·(σr² − σi²)·T
Approximation only: it freezes gamma at its starting value, so it runs too optimistic. It overstates gains when realised vol is above implied and understates losses when it is below.
Spot path and hedge trades
Delta over time
Cumulative P&L, split
Many paths
1,000 spot paths at each hedge frequency (1, 2, 4 and 8 times a day).
In real markets implied volatility usually trades above the volatility that follows. That gap is the variance risk premium, the same effect behind "protection looks expensive" in Protect & Earn. It means a long-gamma market maker loses on average, and a short-gamma one is paid to carry crash risk. A later Swaps & Credit page (/rates-credit) will measure it from variance swap strikes.
Limitations
The stock follows a lognormal path at a constant realised vol, and the option is priced and hedged at a constant implied vol, with no smile, jumps, transaction costs, bid-ask spread on the hedge or early exercise. Hedges happen at fixed times. Simulated, not market data.
Not investment advice.