How DEXs Price Assets: Order Books vs. Liquidity Pools
DEXs power billions in daily crypto volume, but they price assets in fundamentally different ways than centralized exchanges. Understanding whether you're trading against an order book or a liquidity pool—and what that means for slippage, execution, and fees—is essential before you place your first trade.
The custody difference: Why DEXs matter
Centralized exchanges (CEX) sit in the middle: they match your buy order to someone else's sell order, hold your private keys, and take custody of your funds. You trust them not to get hacked or shut down.
Decentralized exchanges (DEXs) remove the middleman. When you trade on a DEX, your wallet connects directly to a smart contract. You keep your private keys. The blockchain records the trade. No platform holds your money in between.
This custody difference shapes everything downstream—price discovery, liquidity structure, and how you'll experience execution when you're actually trading on TradingView or any frontend that connects to a DEX protocol.
Order-book DEXs: Close to what you know
Some DEXs mimic the order-book model you'd recognize from a CEX. A buyer posts a bid, a seller posts an ask, and a smart contract matches them when prices meet.
The trade-off is practical. On-chain order books (where matching and settlement both happen on-chain) are slow and expensive because every order has to be written to the blockchain. Off-chain order books move order-creation off-chain to save gas fees, then settle the final trade on-chain. This is faster but more centralized—you're trusting a server to match orders fairly.
For traders: order-book DEXs feel familiar. You set a limit price, wait for a match, or market-sell at a predictable spread. But liquidity is often thin compared to AMMs, and you'll pay for that predictability in wider spreads or longer waits.
Automated Market Makers: Pools instead of order books
AMMs work differently. Instead of matching two traders, they match you against a pool of locked-in liquidity.
Imagine a pool holding 100 ETH and 200,000 DAI. A liquidity provider (LP) deposited both tokens in equal value and earns a cut of every trade fee that flows through the pool. When you buy 1 ETH from the pool, you send DAI in and remove ETH out. The pool's ratio shifts. A pricing formula (usually x × y = k, Uniswap's constant-product model) ensures the pool stays balanced by raising the price of the asset you bought.
Example: Start with 100 ETH and 200,000 DAI (k = 20,000,000). You buy 1 ETH and send 2,020 DAI. The new pool is 99 ETH and 202,020 DAI. The math holds: 99 × 202,020 ≈ 19,999,980. The price moved against you slightly—that's slippage, and it's built into every AMM trade. A 0.1 ETH order has minimal slippage; a 50 ETH order bleeds significantly more.
Slippage: The hidden cost of size
Here's what bites most traders new to DEXs: larger orders don't just move the market linearly. They move it exponentially.
A 1 ETH buy might cost you 2,020 DAI (roughly 0.2% slippage). A 10 ETH buy doesn't cost 20,200 DAI—it costs much more, because you're pushing the pool's ratio out of proportion harder with each successive ETH you remove.
This is why on TradingView, when you're analyzing a DEX trade, you need to think about pool depth, not just the current mid-price. A 500 million dollar liquidity pool handles big trades cleanly. A 5 million dollar pool will punish you with brutal slippage on anything above a few thousand dollars.
Use a tool like PineMind when you're building a DEX trading bot in PineScript—you can add slippage calculations based on order size and pool reserves to backtest realistically, not assume you'll get a mid-market price on every execution.
Why liquidity providers matter (and why they move the market)
LPs earn fees but take on risk. When you deposit 50 ETH and 100,000 DAI to a 50/50 pool, you're betting the ratio won't move too far apart.
If ETH rallies 20%, the pool automatically rebalances to keep the product constant. You end up owning less ETH and more DAI than you started with—a kind of forced selling into strength. If ETH crashes 20%, you own more ETH and less DAI. This impermanent loss is real and often exceeds the fees you collect, especially in volatile pairs.
For traders: this means LP incentives shape market structure. When fees are high (volatile pairs, new tokens), LPs flood in. Liquidity balloons. Slippage drops and spreads tighten. When volatility dies, LPs exit, liquidity evaporates, and execution becomes painful. A 20% APY fee rate is seductive until the pair trades sideways and your impermanent loss wipes out six months of earnings.
Choosing where to trade
On TradingView, when you're evaluating a DEX opportunity, ask three questions:
1. Is there an order book or an AMM? Order books suit directional trades with clear entries/exits. AMMs suit smaller, faster executions where you accept slippage as the cost of immediate settlement.
2. How deep is the liquidity pool? Divide the pool's total USD value by your intended order size. If your trade is more than 0.1% of the pool, expect meaningful slippage. If it's more than 1%, slippage becomes a deal-killer.
3. What are the fees? DEX fees typically range 0.01% to 1%. A 0.3% pool on a stable pair might be cheaper than a 1% pool on a volatile pair (higher slippage, higher fee). Do the math before you click.
Hybrid DEXs (some use order books for stable pairs, AMMs for illiquid tokens) are becoming common. They let you pick your poison: market certainty or tighter execution. As a trader, the choice is yours—but you need to understand the mechanics underneath.