← Back to list

Uniswap’s AMM Is Not “Liquidity Without Depth” — It’s an Order Book Written in Math

At first glance, Uniswap feels almost too simple.

Ethan · 2025-12-28 18:05 · 0 claps · 4.3 min read
#defi #crpyto #quantitative-finance #uniswap #ethereum
Open on Medium ↗
Wiki topics: CRY · Crypto & Web3 📐 · Mathematics

Uniswap’s AMM Is Not “Liquidity Without Depth” — It’s an Order Book Written in Math

At first glance, Uniswap feels almost too simple.

There is no order book. No bids, no asks, no visible price ladder. Just a liquidity pool and a short formula:

x · y = k

For anyone coming from traditional finance or centralized exchanges, this immediately raises a question:

If there is no order book, where does market depth come from?

The common assumption is that Automated Market Makers (AMMs) somehow trade without real depth — that prices magically adjust without meaningful liquidity behind them. This intuition, however, is fundamentally wrong.

Uniswap’s AMM does not remove market depth. Instead, it models the entire depth of a traditional order book as a continuous mathematical function. Buy more, and the price moves up. Sell more, and the price moves down. The behavior is identical to a limit order book — only the implementation is radically different.

In this article, we start from the familiar mechanics of order‑book trading and gradually work toward Uniswap’s AMM. By the end, you’ll see why the constant‑product formula is not a shortcut or a hack, but a principled way to reconstruct market liquidity on‑chain.

How Market Depth Works in a Traditional Order Book

In a traditional exchange, trading is organized around a limit order book:

  • Buyers place bids at specific prices
  • Sellers place asks at specific prices
  • Orders are matched whenever bid ≥ ask

Traditional order book model with price-based order matching

Traditional order book model with price-based order matching

Market depth emerges from the stacking of many discrete orders at different price levels. Large trades move the price because they consume multiple layers of liquidity.

This is intuitive: the more you buy, the higher up the order book you climb.

The Core Idea Behind Uniswap’s AMM

Uniswap replaces discrete orders with a pool of two assets and a single invariant:

x · y = k

Where:

  • x is the amount of asset A (e.g., ETH)
  • y is the amount of asset B (e.g., USDC)
  • k is a constant representing total liquidity

Every trade must preserve this invariant. As a result:

  • Buying ETH removes ETH from the pool and adds USDC
  • ETH becomes scarcer → its price increases
  • Selling ETH adds ETH to the pool → its price decreases

There are no orders, but price impact is unavoidable, just like in an order book.

A Simple Swap Example

Assume a liquidity pool contains:

  • 6 ETH
  • 6,000 USDC

So:

k = 6 × 6,000 = 36,000

If a trader adds 100 USDC to the pool, the new USDC balance becomes 6,100. To preserve k, the remaining ETH must be:

36,000 / 6,100 ≈ 5.9016 ETH

The trader receives:

6 − 5.9016 ≈ 0.0984 ETH

As ETH leaves the pool, its price rises — exactly what would happen if a large market buy consumed sell orders in a traditional order book.

Uniswap AMM model with liquidity pools instead of an order book

Uniswap AMM model with liquidity pools instead of an order book

Liquidity Providers and Fees

Liquidity Providers (LPs) supply both assets in equal value proportions. In return, they earn:

  • Trading fees (typically 0.3%)
  • Additional protocol incentives (if applicable)

The more trading activity a pool has, the more fees LPs collect.

The Trade‑Off: Impermanent Loss

Because AMMs automatically rebalance asset ratios, LPs are always trading against the market:

  • When price goes up, LPs sell the appreciating asset
  • When price goes down, LPs buy the depreciating asset

Compared to simply holding both assets, LPs may end up with a lower total value. This difference is known as Impermanent Loss (IL).

A given Excel is shown the comaprsion between Value of Holding and Value of investing in LP (Liquidity Pool) as the perice movement per certange.

https://docs.google.com/spreadsheets/d/1BXLmZyYhP8CWcH4-Tny0dE0QvXH6e6xM/edit?gid=848054291#gid=848054291

Key observations:

  • IL increases sharply during large price drops
  • IL grows more slowly during price increases
  • In moderate price ranges (-30%~+30%), fees can often offset IL

Impermanent loss curve

Impermanent loss curve

AMM Curves vs. Order Book Depth

A traditional depth chart visualizes liquidity as discrete steps. Each step corresponds to a batch of limit orders at a specific price level. Large trades consume multiple steps, causing increasing price impact. The AMM replaces discrete orders with a continuous curve. Liquidity exists at every price point, and price impact increases smoothly as trades move along the curve.

A traditional order book depth chart shows:

  • Step‑like liquidity
  • Discrete price levels

BTC / USDT Depth Graph

BTC / USDT Depth Graph

An AMM curve (y = k / x) is:

  • Continuous
  • Smooth
  • Deterministic

Constant Product AMM Curve (y = k / x)

Constant Product AMM Curve (y = k / x)

If you rotate an order book depth chart by 90 degrees, its overall shape resembles the AMM curve. This is not a coincidence.

Both systems encode the same market rule:

The more you trade, the worse the marginal price becomes.

The difference lies in implementation:

  • Order books use discrete human‑placed orders
  • AMMs use continuous mathematical liquidity

AMMs are not the opposite of order books — they are their mathematical abstraction.

Slippage and Non‑Linear Price Impact

Because the AMM curve is non‑linear:

  • Small trades incur minimal slippage
  • Large trades move far along the curve

For example:

  • Buying a small amount may cause 0.1% slippage
  • Buying several times more can cause 3%+ slippage

This mirrors the experience of sweeping multiple levels of an order book.

Conclusion: Why AMMs Matter

Uniswap succeeded not because it removed complexity, but because it compressed complexity into mathematics.

By replacing millions of limit orders with a single invariant, AMMs made permissionless, on‑chain liquidity possible for the first time. While they introduce new risks — such as impermanent loss and slippage — they also unlocked a new design space for decentralized markets.

Uniswap’s AMM is not a market without depth. It is a market where depth is written directly into the formula.


메타데이터
post_id
536a07fcd0e4
slug
uniswaps-amm-is-not-liquidity-without-depth-it-s-an-order-book-written-in-math-536a07fcd0e4
url
https://medium.com/@hechenworkspace/uniswaps-amm-is-not-liquidity-without-depth-it-s-an-order-book-written-in-math-536a07fcd0e4
canonical_url
https://medium.com/@hechenworkspace/uniswaps-amm-is-not-liquidity-without-depth-it-s-an-order-book-written-in-math-536a07fcd0e4
author_url
https://medium.com/@hechenworkspace
status
ok
fetched_at
2026-07-13 21:02:30