Quant Sandbox
DerivativesPortfolio & RiskFixed IncomeCorporate FinanceProbability & MeasureStochastic ModelsMarket MicrostructureGuide
Guide
Derivatives pricing0 / 17
01Forwards, calls and puts02Combining positions03Arbitrage and the forward price04Put–call parity05The one-step binomial model06Risk-neutral probabilities07Multi-step trees and backward induction08American options and early exercise09Delta and hedging10Geometric Brownian motion11The Black–Scholes formula12The Greeks: gamma, vega, theta and rho13Options on dividend-paying stocks, indices, currencies and futures14Implied volatility and the volatility smile15Stochastic volatility and the Heston model16Static replication: Breeden–Litzenberger and Carr–Madan17Exotic options: barriers, Asians and digitals
Portfolio & risk0 / 12
01Returns and volatility02Diversification and correlation03The efficient frontier and the capital market line04Risk aversion and the optimal complete portfolio05CAPM, beta and the security market line06Performance measures: Sharpe, Treynor, Jensen and information ratio07Factor models and systematic risk08The Fama–French factor models09Value at Risk and expected shortfall10Systemic risk and contagion11Portfolio constraints and the no-short-sales frontier12Estimating expected returns and covariances
Fixed income0 / 10
01Bond prices and yields02Duration and convexity03Immunization and duration matching04Spot rates, forward rates and the yield curve05Non-parallel curve moves and key-rate durations06Bond futures and the cheapest-to-deliver07Interest rate swaps08Callable bonds and negative convexity09Credit risk: default probabilities and credit spreads10Real rates, inflation and inflation-linked bonds
Corporate finance0 / 10
01Interest, compounding and discounting02Annuities, perpetuities and loan amortization03Net present value and internal rate of return04Project risk: sensitivity, scenarios and Monte Carlo NPV05The weighted average cost of capital06Capital structure and the Modigliani–Miller theorems07Dividends, payout policy and the dividend discount model08Discounted cash flow valuation09Relative valuation with multiples10Real options: the value of flexibility
Probability and measure0 / 13
01Measuring the size of sets02σ-algebras and Borel sets03Lebesgue measure and null sets04Measurable functions05The Lebesgue integral06Convergence theorems07Probability spaces and Kolmogorov's axioms08Random variables and their distributions09Expectation, variance and inequalities10Independence and product measures11Modes of convergence and the law of large numbers12Conditional probability and conditional expectation13Measure theory in option pricing
Stochastic models0 / 17
01Random walks and Brownian motion02The law of large numbers and the central limit theorem03Probability spaces, σ-algebras and random variables04Filtrations, adapted processes and stopping times05Conditional expectation and martingales06Properties of Brownian motion07The reflection principle and first passage times08The Brownian bridge09The Itô integral10Itô's lemma11Kolmogorov equations and the Feynman–Kac formula12Change of measure and Girsanov's theorem13Monte Carlo option pricing14Simulating SDEs: the Euler–Maruyama scheme15Correlated Brownian motions and multi-asset models16Mean reversion: Ornstein–Uhlenbeck and Vasicek17Jumps and the Merton jump-diffusion model
Market microstructure0 / 11
01Market makers and liquidity02The limit order book03Queue position and fill probability04Adverse selection and informed trading05The Glosten–Milgrom model06Measuring and decomposing the bid–ask spread07Informed trading and Kyle's lambda08Price impact and optimal execution09Inventory risk and quote skewing10Optimal quoting: the Avellaneda–Stoikov model11Market making profit and loss attribution
Knowledge graph

© 2026 Quant Sandbox · A study aid for quantitative finance

Privacy & dataNo cookies

This site does not use cookies and asks for no personal data. It keeps a few small settings in your browser's local storage — your chosen theme and language, the sidebar layout, and your progress and answers in the Guides — so it remembers them on your next visit. This data never leaves your device; clearing your browser storage removes it. Inputs you change can also be captured in the page URL, so you can share or bookmark a specific setup. The site uses Vercel Web Analytics, a privacy-friendly, cookieless service that records only anonymous, aggregated usage (such as page views) without identifying you or tracking you across other sites.

Guides/Market microstructure/11

Market making profit and loss attribution

Lesson 11 of 11 · 1 min read

A market maker's day ends with one number, the profit and loss, and that number alone says almost nothing about what to change. A desk that earned 23 USD may have earned 27 from the spread and lost 17 to informed customers, or the other way round. This lesson splits the P&L exactly into spread capture, adverse selection, inventory and fees, using the markout from "Adverse selection and informed trading" and the inventory view from "Inventory risk and quote skewing", and then lists the few monitoring numbers a desk reads to decide whether to widen, skew or pull its quotes.

Marking to market

Let the maker's cash be the money it has received minus the money it has paid, its inventory III the net number of shares it holds, and mTm_TmT​ the mid price at the end of the session. Valuing the inventory at the mid, the total P&L is

P&L=cash+I mT+fees.\text{P\&L} = \text{cash} + I\,m_T + \text{fees}.P&L=cash+ImT​+fees.

A fill of qqq shares at price ppp changes cash by −ε p q-\varepsilon\,p\,q−εpq and inventory by ε q\varepsilon\,qεq, where ε=+1\varepsilon = +1ε=+1 if the maker bought and ε=−1\varepsilon = -1ε=−1 if it sold. Fees are positive for a rebate and negative for a charge. This is the number the exchange statement agrees with, but it mixes three different stories: what the maker charged, what the price did next, and what it still holds.

Spread capture

Let mtm_tmt​ be the mid price just before the fill at time ttt. The spread capture of the fill is how far from the mid the maker traded, signed so that a good price is positive:

S=ε (mt−p) q.S = \varepsilon\,(m_t - p)\,q.S=ε(mt​−p)q.

A maker who buys below the mid, or sells above it, captures the spread. Note the word before: if the mid is read after the fill, the price move that the fill itself caused leaks into the spread term and flatters it.

Adverse selection

Choose a markout horizon hhh, for example 10 seconds. The adverse selection of the fill is the mid price move over the next hhh seconds, signed from the maker's side, as in the lesson on markouts:

A=ε (mt+h−mt) q.A = \varepsilon\,(m_{t+h} - m_t)\,q.A=ε(mt+h​−mt​)q.

It is negative when the maker bought just before the price fell or sold just before it rose: the customer knew something. Averaged over many fills and divided by shares, AAA is the markout. After noise customers it averages zero; after informed customers it is negative and eats the spread capture.

Inventory

The fill is not over after hhh seconds: the maker still holds the shares until it trades them away, and the mid keeps moving until the end TTT of the session. For one fill, split the total change in value at ttt and t+ht+ht+h:

−ε p q+ε q mT=ε (mt−p) q⏟S+ε (mt+h−mt) q⏟A+ε (mT−mt+h) q⏟inventory.-\varepsilon\,p\,q + \varepsilon\,q\,m_T = \underbrace{\varepsilon\,(m_t - p)\,q}_{S} + \underbrace{\varepsilon\,(m_{t+h} - m_t)\,q}_{A} + \underbrace{\varepsilon\,(m_T - m_{t+h})\,q}_{\text{inventory}}.−εpq+εqmT​=Sε(mt​−p)q​​+Aε(mt+h​−mt​)q​​+inventoryε(mT​−mt+h​)q​​.

The identity holds because the mid terms telescope: mtm_tmt​ and mt+hm_{t+h}mt+h​ cancel. Summing over all fills and adding the fees gives

P&L=∑S+∑A+∑ε (mT−mt+h) q+fees.\text{P\&L} = \sum S + \sum A + \sum \varepsilon\,(m_T - m_{t+h})\,q + \text{fees}.P&L=∑S+∑A+∑ε(mT​−mt+h​)q+fees.

The third sum is the inventory term: the profit or loss from holding the position beyond the markout window. The four parts sum to the total exactly, with nothing left over, which is why the desk can trust the split. If the price is a random walk, the inventory term has mean zero but a wide spread, and it is the part that skewing the quotes aims to control.

Worked example

Splitting the P&L of one fill

  1. The maker buys 100 at 99.99 while the mid is 100.00. Spread capture:

    S=(100.00−99.99)×100\displaystyle S = (100.00 - 99.99)\times 100S=(100.00−99.99)×100=1
  2. Ten seconds later the mid is 99.95 and stays there. Adverse selection:

    A=(99.95−100.00)×100\displaystyle A = (99.95 - 100.00)\times 100A=(99.95−100.00)×100=-5
  3. The mid does not move after the markout window, so the inventory term is zero:

    (99.95−99.95)×100\displaystyle (99.95 - 99.95)\times 100(99.95−99.95)×100=0
  4. With no fees the total is the sum of the parts:

    1.00−5.00+0+0\displaystyle 1.00 - 5.00 + 0 + 01.00−5.00+0+0=-4
  5. Direct check with cash plus inventory times the mid:

    −9999+100×99.95\displaystyle -9999 + 100\times 99.95−9999+100×99.95=-4
  6. With a maker rebate of 0.002 per share the fees are 0.20 and the total improves to:

    −4.00+0.002×100\displaystyle -4.00 + 0.002\times 100−4.00+0.002×100=-3.8

Fees and rebates

Exchanges often pay a small rebate to the side that posts a resting order and charge a taker fee to the side that removes liquidity. A maker earns the rebate on every fill, so it adds to the total independent of the price path, and it can make a thin-spread strategy viable. When the maker hedges its inventory with a market order, it pays the taker fee and also crosses the spread: the hedge is a fill with a negative spread-capture term, because the maker trades away from the mid. The decomposition handles hedges with no extra rules, as one more fill with its own SSS, AAA and fee.

What a desk watches

The split is only useful if it is read every day. Try the figure below: it runs a five-minute session of a maker against the crowd flow, and lets you change the informed share, the quote distance and the markout horizon. Raise the informed share and watch the adverse selection bar and the markout curve fall; move the quotes further from the mid and watch the fills, and with them every bar, shrink. In the default state, 67 fills give 27.16 USD of spread capture, −16.98 of adverse selection, 2.90 of inventory and 10.43 of rebates, for a total of 23.51 USD.

The parts of a market maker's P&LOpen in Market Making
15%
00.4
0.5
0.53
10 s
130

5-minute session, quotes of 100 shares; 67 fills, final inventory 816 shares. P&L in USD, markout in cents per share.

Average markout (¢ per share)
Spread capture (USD)
27.16
Adverse selection (USD)
-16.98
Inventory (USD)
2.90
Fees and rebates (USD)
10.43
Total P&L (USD)
23.51

Five numbers do most of the monitoring.

  • Markout curve. The average markout against the horizon. A curve that sinks and stays negative means the flow is informed: widen the quotes or stop quoting to the toxic customers. A curve that returns to zero means the move was temporary pressure on the book, not information.
  • Fill ratio. Fills divided by orders placed, the practical measure of queue position from "Queue position and fill probability". A very high ratio usually means the quotes are too tight; a very low one means the maker is far back in the queue or too wide.
  • Quote-to-trade ratio. Quote updates per fill. It measures the cost of staying at the touch and is often capped by the exchange.
  • Inventory turnover. How quickly the position cycles back to flat. Slow turnover with large swings in the inventory term is a signal to skew quotes harder, as in "Optimal quoting: the Avellaneda–Stoikov model".
  • Limits. Maximum inventory and loss per day. A breach means pulling quotes, for example before a scheduled news release when adverse selection is highest.

The attribution in the desk game

The Market Making Desk game at /market-making/desk reports exactly this split at the end of each round, with the markout horizon you choose. The lab linked below lets you change the quotes and the flow and see the four parts move.

Summary

  • Total P&L is cash plus inventory times the mid, plus fees, and it splits exactly into spread capture, adverse selection, inventory and fees.
  • Spread capture ε(mt−p)q\varepsilon(m_t - p)qε(mt​−p)q uses the mid before the fill; adverse selection ε(mt+h−mt)q\varepsilon(m_{t+h} - m_t)qε(mt+h​−mt​)q is the markout over the horizon; the inventory term is the rest of the holding period.
  • The four parts sum to the total because the mid terms telescope.
  • Hedges are fills with negative spread capture and a taker fee; rebates add a path-independent income.
  • A markout curve, fill ratio, quote-to-trade ratio, inventory turnover and limits tell the desk whether to widen, skew or pull quotes.
Try itOpen the market making lab
2 questions on this lesson at the end of the series
Previous · 10Optimal quoting: the Avellaneda–Stoikov modelNextBack to Market microstructure
Connections

Market making profit and loss attribution

Open the full graph
Builds on
07.10Optimal quoting: the Avellaneda–Stoikov model07.04Adverse selection and informed trading07.09Inventory risk and quote skewing07.03Queue position and fill probability
See it in the knowledge graph
Labs for this lesson
Market Making