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/01

Market makers and liquidity

Lesson 1 of 11 · 1 min read

A stock chart shows one price per moment, but nobody trades at "the price". A buyer pays one number, a seller receives a lower one, and between the two sits a firm that stands ready to take either side. This lesson starts the track on market microstructure by explaining what that firm earns, what it risks, and how to measure the gap between the two prices. It uses returns from "Returns and volatility" and the idea that price changes behave like a random walk from "Random walks and Brownian motion".

Bid, ask, mid and spread

A market quotes two prices at any moment. The bid bbb is the highest price at which someone is willing to buy; the ask aaa is the lowest price at which someone is willing to sell. The bid is always below the ask, otherwise the two sides would already have traded. A trader who wants to buy right now pays the ask, and a trader who wants to sell right now receives the bid.

The mid price is the midpoint, m=(a+b)/2m = (a + b)/2m=(a+b)/2, and is the usual stand-in for "the price". The spread is the gap a−ba - ba−b. It is quoted in three ways: in currency, in ticks (the smallest allowed price step, so a spread of 4 cents on a 1-cent tick is 4 ticks), and in basis points of the mid, which makes stocks with different prices comparable:

sbp=104⋅a−bm.s_{\text{bp}} = 10^4 \cdot \frac{a - b}{m}.sbp​=104⋅ma−b​.

With a bid of 99.98 and an ask of 100.02 the mid is 100.00 and the spread is 0.04, or 104×0.04/100=410^4 \times 0.04 / 100 = 4104×0.04/100=4 basis points. A tight spread means trading is cheap; a wide spread means a trader loses more just by crossing from one side to the other.

Liquidity and immediacy

Liquidity is the ability to trade a meaningful size quickly without moving the price much. It comes from a simple mismatch in time. Some traders want to trade now and accept a worse price for it; others are willing to wait and post the price they want. The first group sends market orders, which execute immediately against the best quote on the other side. The second group posts limit orders, which rest in the book until someone trades against them.

The trader who sends the market order is the taker: she buys at the ask or sells at the bid and so pays half the spread relative to the mid. The trader whose limit order was waiting is the maker: he earns that half-spread. Many exchanges reinforce this with fees: the taker pays a small fee per share and the maker receives a smaller rebate, both a fraction of a cent. Either way, the spread is the price of immediacy, and the people who sell immediacy are the market makers.

The round trip

A market maker is a firm that continuously posts both a bid and an ask in the same asset and trades against whoever arrives. It does not want a position; it wants to buy at the bid, sell at the ask, and repeat. Take one round trip: a customer buys qqq shares at the ask, so the maker is now short qqq, and later another customer sells qqq shares at the bid, which closes the position. Suppose the maker keeps its quotes symmetric around the mid, a=m+ha = m + ha=m+h and b=m−hb = m - hb=m−h, where hhh is the half-spread. If the mid is m1m_1m1​ at the first trade and m2m_2m2​ at the second, the maker sold at m1+hm_1 + hm1​+h and bought back at m2−hm_2 - hm2​−h, so per share

P&L=(m1+h)−(m2−h)=2h⏟a−b  −  (m2−m1)⏟Δm.\text{P\&L} = (m_1 + h) - (m_2 - h) = \underbrace{2h}_{a - b} \; - \; \underbrace{(m_2 - m_1)}_{\Delta m}.P&L=(m1​+h)−(m2​−h)=a−b2h​​−Δm(m2​−m1​)​​.

If the mid has not moved, the maker keeps the whole spread a−ba - ba−b. If the mid has moved, the maker also gains or loses Δm\Delta mΔm per share on the position it carried, with a minus sign because it was short: a rising mid hurts. The first term is spread income; the second is inventory P&L. The maker controls the first by choosing the spread and has little control over the second.

Worked example

A round trip in 1,000 shares

  1. Quotes are 99.98 / 100.02. The spread in currency:

    a−b=100.02−99.98\displaystyle a - b = 100.02 - 99.98a−b=100.02−99.98=0.04
  2. The spread in basis points of the 100.00 mid:

    sbp=104⋅0.04/100\displaystyle s_{\text{bp}} = 10^4 \cdot 0.04 / 100sbp​=104⋅0.04/100=4
  3. A customer buys 1,000 at the ask and another later sells 1,000 at the bid. If the mid never moves, the maker's income in USD is:

    0.04×1000\displaystyle 0.04 \times 10000.04×1000=40
  4. Now the mid rises by 0.10 between the two trades and the maker re-quotes around the new mid, 100.10, so its bid is 100.08. It sold at 100.02 and buys back at 100.08, a result in USD of:

    (100.02−100.08)×1000\displaystyle (100.02 - 100.08) \times 1000(100.02−100.08)×1000=-60
  5. Split into the two terms, the inventory P&L in USD is the short position times the rise of the mid:

    −Δm×1000=−0.10×1000\displaystyle -\Delta m \times 1000 = -0.10 \times 1000−Δm×1000=−0.10×1000=-100
  6. The spread income and inventory P&L add up to the round trip, in USD:

    40+(−100)\displaystyle 40 + (-100)40+(−100)=-60

The culprit in the last step is the position the maker carried through the move, not the spread. A 4 bp spread earns 40 USD on this size, while a 10-cent move of the mid, which is only 10 bp, is enough to erase it two and a half times over.

Inventory risk and adverse selection

Two separate risks sit behind the inventory term. The first is inventory risk. While the maker is short, its profit depends on the mid price, and the mid moves unpredictably. If the mid's change per step has standard deviation σ\sigmaσ and steps are independent, as in a random walk, the change over kkk steps has standard deviation σk\sigma\sqrt{k}σk​. The longer the maker holds a position, the more that risk grows, and it grows with the size of the position too. Later lessons in this track develop what a maker does about it.

The second is adverse selection: the customer may know something. If a buyer knows the price is about to rise, the maker sells exactly before the mid moves up, and the loss is not luck but a consequence of who chose to trade. A maker cannot see who is informed, so it must charge every customer a spread wide enough to cover the losses to the informed ones. Later lessons develop it; here it is enough to see that the spread pays for both risks, not just for waiting.

The figure below plays out the round trip. A mid price follows a random walk for 30 steps; the maker always quotes half-spread hhh around the current mid; a customer buys at the ask at step 5 and another sells at the bid at step 20, for 100 shares. Drag the ask line, or use the half-spread slider, and watch the spread income grow in proportion. Then raise the volatility, press New path a few times and compare the sign of the inventory P&L over different paths. At the defaults (half-spread 2¢, volatility 1¢ per step, first path) the spread income is 4.00 USD, the mid happens to rise 4.47¢ between the two trades, the inventory P&L is −4.47 USD and the round trip ends at −0.47 USD. Over 15 steps of 1¢ the standard deviation of the mid's change is 15≈3.9\sqrt{15} \approx 3.915​≈3.9¢, about as large as the whole spread, so a typical single round trip is close to a coin flip around the income.

A market maker's round tripOpen in Market Making
2¢
110
1.0¢
03
AskMidBid
Spread income (USD)
4.00
Inventory P&L (USD)
-4.47
Round-trip total (USD)
-0.47

Types of market maker

Some market makers carry an obligation: a designated market maker on an exchange agrees to quote continuously, within a maximum spread and with a minimum size, and in return gets fee advantages or a privileged role. Most liquidity today comes from electronic liquidity providers, trading firms with no obligation whose software posts and cancels quotes thousands of times a second and leaves when conditions are bad. In over-the-counter markets, such as bonds and currencies, dealers quote to customers on request and keep the position on their own books. The three differ in obligations and in technology, but share the economics above: spread income in return for inventory risk and adverse selection.

Summary

  • The bid is the best price to sell at, the ask the best price to buy at, and the spread a−ba - ba−b is the cost of crossing; it is measured in currency, ticks or basis points 104(a−b)/m10^4 (a - b)/m104(a−b)/m.
  • Takers pay the spread for immediacy; makers who post limit orders earn it.
  • A round trip at symmetric quotes earns (a−b)−Δm(a - b) - \Delta m(a−b)−Δm per share: the spread, minus the rise of the mid while the maker was short.
  • The mid's move is inventory risk, which grows like σk\sigma\sqrt{k}σk​ with holding time; informed customers add adverse selection, and the spread must pay for both.

The next lesson, "The limit order book", shows where the quotes of all makers and traders are stored and how a market order consumes them.

Try itOpen the market making lab and quote a simulated market yourself
3 questions on this lesson at the end of the series
Next · 02The limit order book
Connections

Market makers and liquidity

Open the full graph
Builds on
02.01Returns and volatility06.01Random walks and Brownian motion
Leads to
07.02The limit order book07.04Adverse selection and informed trading07.09Inventory risk and quote skewing07.10Optimal quoting: the Avellaneda–Stoikov model
See it in the knowledge graph
Labs for this lesson
Market Making