Jump to content
Tareom

News from across crypto

How Decentralized Exchanges Determine Token Prices

How decentralized exchanges determine token prices comes down to pool balances and trading curves or to matched order books, and every quote changes with trade size.

The Tareom Editors5 min read

How Decentralized Exchanges Determine Token Prices

A decentralized exchange prices a token by one of two mechanisms: an order book that matches ranked bids and offers, or an automated market maker that calculates every trade from the pool's current balances. The key difference is what changes the price. On an order-book exchange, the best outstanding bid and ask set the quote. On an AMM, the price comes from a formula that connects the two token reserves.

Order books and AMMs use different price mechanics

An order-book exchange consumes price-ranked orders: buyers post bids, sellers post asks, and the highest bid plus the lowest ask define the spread. A large order walks through several resting orders, so its average fill price moves as it goes. An automated market maker has no order book. It holds reserves of two tokens and lets anyone trade against them at a price set by a curve, most often the constant-product curve x × y = k.

Think of an AMM as a seesaw with two baskets. The price is the ratio of the two basket weights, and each trade moves tokens from one basket to the other. The seesaw analogy stops at one point: the basket contents are not fixed. The pool itself changes after every trade, so the next trader sees a different ratio.

A constant-product trade, worked out

A constant-product trade follows x × y = k exactly, ignoring fees. Start with 100 X and 10,000 Y in the pool, so x × y = 1,000,000. If you buy 10 X, the X reserve falls to 90. Keeping the product constant, the Y reserve rises to 1,000,000 ÷ 90 ≈ 11,111.11 Y. You pay 11,111.11 − 10,000 = 1,111.11 Y, not the 1,000 Y the starting ratio might suggest.

That extra cost is slippage: the trade itself moves the ratio. The larger the trade, the more it moves. Arbitrage is what pulls the ratio back: when a pool's price differs from the same pair elsewhere, arbitrageurs trade against the pool until the difference no longer covers their fees and gas.

SushiSwap V3 prices are ticks, not decimal numbers

SushiSwap V3 records a pool's price as a tick index and a square-root value, not as a decimal number. Its V3 core uses the same constant-product curve, but it concentrates liquidity into tick ranges. A tick index i represents a raw token1/token0 ratio of 1.0001^i. The pool stores the square root of that ratio as sqrtPriceX96, a Q64.96 fixed-point number (64 integer bits, 96 fractional bits): the square-root price multiplied by 2^96. The TickMath library defines the conversion between ticks and sqrtPriceX96.

Liquidity providers choose a range between two ticks. Their liquidity is active only while the price is inside that range; outside it, their position stops earning fees until the price re-enters. This is why V3 pools can have deep liquidity in a narrow band and thin liquidity outside it.

To read a V3 pool's price, you start from sqrtPriceX96, not from a human price. The human token1/token0 price is (sqrtPriceX96 / 2^96)^2 × 10^(decimals0 − decimals1). Suppose the raw ratio is 10^-12 with an 18-decimal token0 and a 6-decimal token1. The formula gives 10^-12 × 10^(18−6) = 1, so one whole token0 buys one whole token1. Skip the decimal step and you would call the same price a trillionth of what it is. To verify a displayed price, read that pool's sqrtPriceX96 from a block explorer and apply the formula; the correct human price is 1 in this example, not 10^-12.

On SushiSwap, a price only exists for a pair that has a pool. So before you look up a contract's raw numbers, check the sushiswap supported tokens page; it shows which assets are available and whether your pair can be priced at all.

What changes a price between quote and execution

The price you execute at is not the pool's spot price. It depends on order size, curve shape, fees, and routing.

Order size matters because a constant-product curve has slippage: the more you buy, the less favorable the ratio becomes. A different curve shape, such as a stableswap curve, changes slippage for assets of similar value. Fee tiers change the effective cost, and a router can split a trade across several pools, making the final price a blend of routes rather than one pool's quote.

An oracle observation is not an execution price either. A V3 pool can record the current tick over time and produce a TWAP, a time-weighted average of past observations. A TWAP tells another contract what the pool has seen, not what a trader will get on the next swap. The observable difference: a quote is available now, while a TWAP is a historical average that no pool is obligated to re-fill.

Who sets the pool price, and what moves it?

Who sets a new liquidity pool price?

The person or contract that creates the pool sets the starting ratio, either by depositing the two tokens in a chosen proportion or by specifying an initial square-root price. That starting point matters only until the first trade; after that, the curve and subsequent trades set all prices.

Can DEX prices be manipulated?

Trades can move shallow pool prices temporarily, so a large buy can push a pool's observed price far from the market price. The movement is visible in the pool's reserves and usually reverses when arbitrage traders return the ratio to a market-consistent level.

Why does token dollar price differ between websites?

Different websites quote different pairs, use different pools as their price source, and sample at different times, so the dollar price they show is not one universal number. A token priced against USDC, against WETH, or against a stablecoin on another chain can all be correct at the same moment.