Market Microstructure
How Markets Work at the Mechanical Level

What Is Market Microstructure?

Market microstructure is the study of how exchanges actually work. Not what an asset is worth, but how buyers and sellers find each other, how prices emerge from that interaction, and what frictions exist between wanting to trade and getting the trade done. It covers the mechanics of price discovery, order matching, liquidity provision, and the costs that traders pay simply for the privilege of executing.

In traditional finance, this means order books, market makers, and exchange matching engines. In DeFi, it means liquidity pools, bonding curves, and automated market makers. The concepts are the same even though the implementations are radically different.

Order Books vs AMMs

There are two dominant models for organizing a market. The order book collects limit orders from buyers and sellers, stacks them by price, and matches them when a bid meets an ask. A centralized matching engine processes orders in sequence and maintains the book in real time. This is how NYSE, Binance, and every traditional exchange works.

The Automated Market Maker (AMM) replaces the order book with a mathematical formula. Instead of matching individual buyers and sellers, the AMM holds reserves of two tokens in a pool and prices trades according to a bonding curve. The most common formula is the constant product \(x \cdot y = k\), where x and y are the reserves of each token and k is a constant that only changes when liquidity is added or removed.

Order Book Bids (Buy) $1,998 ·5.2 ETH $1,997 ·3.8 ETH $1,996 ·2.1 ETH $1,995 ·1.0 ETH Asks (Sell) $2,001 ·4.5 ETH $2,002 ·6.1 ETH $2,003 ·2.7 ETH $2,005 ·0.9 ETH spread = $2,001 - $1,998 = $3 Matching Engine price-time priority ordering AMM Pool Token X 1,000 ETH reserve x Token Y 2M USDC reserve y x * y = k Bonding Curve Token Y Token X current price 0

In an order book, liquidity is provided by individual market makers who place limit orders. In an AMM, liquidity is provided by anyone who deposits token pairs into the pool. The AMM formula automatically adjusts the price as trades shift the ratio of reserves.

Liquidity

Liquidity measures how easily you can trade without significantly moving the price. A liquid market has many participants, tight spreads, and deep order books (or large pool reserves). An illiquid market has few participants, wide spreads, and thin depth, meaning even small trades cause large price movements.

In traditional markets, liquidity is measured by order book depth and bid-ask spread width. In DeFi, it is measured by Total Value Locked (TVL) in a pool. A pool with $100M in reserves can absorb much larger trades than a pool with $100K without significant price impact.

Thin Liquidity (shallow pool) $100K TVL 10 ETH trade big price movement! small pool = high impact Deep Liquidity (deep pool) $100M TVL 10 ETH trade barely moves the price deep pool = low impact

Price Discovery

Price discovery is the process by which a market determines the price of an asset. In an order book, the price emerges from the continuous interaction of supply and demand. Buyers post bids, sellers post asks, and the current market price is the midpoint between the best bid and the best ask. When a new buy order crosses the best ask, a trade executes and the price updates.

In an AMM, price discovery works differently. The price is not determined by posted orders but by the ratio of reserves in the pool. If the pool holds 1,000 ETH and 2,000,000 USDC, the implied price is 2,000 USDC per ETH. When someone buys ETH from the pool, they add USDC and remove ETH, shifting the ratio and increasing the price. The formula \(x \cdot y = k\) ensures that as one reserve shrinks, the price of that token rises exponentially.

AMMs rely on arbitrageurs to keep their prices aligned with the broader market. If the AMM price deviates from the price on centralized exchanges, arbitrageurs buy the cheaper side and sell the more expensive side until the prices converge. This means AMMs are price followers, not price leaders.

The Key Concepts

Two concepts sit at the heart of market microstructure and define the real cost of trading. Each deserves its own deep dive.

Spread

The gap between the best price a buyer will pay and the best price a seller will accept. It exists in both order books and AMMs, and it represents the baseline cost of executing a trade.

Read the deep dive →

Slippage

The difference between the price you expect when you submit a trade and the price you actually receive. It depends on trade size, liquidity depth, and market conditions between submission and execution.

Read the deep dive →

The Ethereum Connection

Ethereum is the most active venue for on-chain market microstructure. Smart contracts implement AMM logic directly, meaning the entire exchange exists as code on the blockchain. There is no centralized matching engine, no company running the exchange. The rules are encoded in Solidity and enforced by the EVM.

Uniswap pioneered the constant product AMM and remains the largest DEX by volume. Its V2 uses the simple \(x \cdot y = k\) formula. V3 introduced concentrated liquidity, allowing LPs to provide liquidity within specific price ranges rather than across the entire curve, dramatically improving capital efficiency. The Uniswap deep dive covers the math, fee tiers, multi-hop routing, and flash swaps in detail.

Curve Finance optimizes for stablecoin swaps using a modified bonding curve (the StableSwap invariant) that produces very low slippage for assets that should trade near parity, like USDC/USDT or stETH/ETH.

Every swap on these protocols is an Ethereum transaction. It goes through the mempool, gets included in a block by a validator, and executes on-chain. This means every trade is public, every trade is final once confirmed, and every trade is subject to the same block latency and gas costs as any other transaction. These properties create unique microstructure dynamics like MEV extraction and sandwich attacks, which are covered in the slippage deep dive.

For background on how these smart contracts get deployed and executed, see Ethereum Smart Contracts. For the full transaction lifecycle, see Sending Transactions on Ethereum.