Trading Engines - Order Books & AMMs

In crypto markets, liquidity is what makes a venue usable, and whether the asset is Bitcoin on a centralized exchange or a governance token on a decentralized one, the mechanism that matches buyers and sellers shapes every trade. Order books and automated market makers (AMMs) are the two dominant models, and traders, builders, and protocol designers all need to know how they differ.

Crypto Trading: Order Books and AMMs

Market terms used below

Four terms come up throughout the comparison:

  • Liquidity is how easily an asset can be bought or sold without moving its price.
  • Slippage is the difference between the expected price of a trade and the executed price.
  • Price discovery is how a market arrives at an asset's value.
  • Makers and takers are the two kinds of participant, with makers providing liquidity and takers consuming it.

Centralized and decentralized exchanges

Centralized exchanges (CEXs) like Binance and Coinbase custody user funds, run order books, and execute trades at high speed, while decentralized exchanges (DEXs) like Uniswap and dYdX let users trade directly from their wallets without an intermediary. CEXs offer performance and deep liquidity, and DEXs offer transparency, permissionless access, and self-custody.

The order book model

An order book lists every buy (bid) and sell (ask) order and executes a trade when two of them match. Users place market orders, which fill immediately at the best available price, or limit orders, which fill only at a specified price or better. Order books support complex strategies and tighter spreads, and they need active market making and are sensitive to latency.

AMMs and Uniswap V3

AMMs, introduced by Uniswap, pool liquidity in smart contracts and set prices algorithmically. The original constant product model (x*y=k) was capital-inefficient, and Uniswap V3 added concentrated liquidity, which lets LPs allocate funds within specific price ranges. AMMs always have liquidity available, and LPs pay for that with impermanent loss while large trades pay with price impact.

Projects by model

Order book-based:

  • dYdX: perpetuals on a high-performance order book on Cosmos.
  • Injective: derivatives and prediction markets with zero gas fees.
  • Vertex: a hybrid design that supports high-frequency trading.
  • Phoenix: a high-performance order book on Solana.
  • OpenBook: the community-led successor to Serum on Solana.
  • Sei Network: a chain with a built-in matching engine and sub-second finality.

AMM-based:

  • Uniswap: V3 with concentrated liquidity.
  • Curve: optimized for stable swaps.
  • Balancer: customizable pool weights.
  • Trader Joe: an AMM with a liquidity book model.
  • Raydium: a Solana AMM with yield farming and a launchpad.
  • Orca: concentrated liquidity on Solana with a consumer-friendly interface.
  • Osmosis: customizable liquidity pools on Cosmos.
  • Saber: a stablecoin-focused AMM on Solana.
  • Lifinity: an oracle-based AMM designed to reduce impermanent loss.

Hybrids:

  • GMX: spot and perpetual trading with oracle pricing.
  • Maverick: dynamic liquidity provision.
  • nftperp: a Fusion AMM that combines DLOB and CLAMM for NFT perpetuals.
  • Drift Protocol: a Solana hybrid with a JIT order book.
  • Kujira: a Cosmos hybrid with DeFi tools and a liquidation marketplace.
  • Jupiter: a Solana aggregator that routes across AMMs and order books.

When I would pick each model

I would pick an order book when a product needs precise pricing, limit orders, or large trade sizes, and an AMM for plain swaps, smaller trades, or assets whose liquidity is fragmented. Layer 2s like Arbitrum and Optimism, high-performance chains like Solana, and Cosmos appchains lower costs and improve performance for both models, so the final choice comes down to the product's frontend and backend requirements.

Hybrids and intent-based systems are where market design is heading, since they hide the complexity from users and keep the useful parts of both models. For technical leaders building in DeFi, understanding how order books and AMMs actually work is what lets you pick a venue, or design one, based on the trades your users will make.

Related writing