Web38 min read

Order book vs AMM: how crypto exchanges set a price

An order book matches buyers and sellers at the prices they post. An AMM prices every trade from a pool. How each works, where each wins, and how INKY trades.

An order book and an AMM are the two ways a crypto market decides the price of your trade. An order book lists the prices real buyers and sellers have posted, and your trade fills against them. An AMM (Automated Market Maker) has no list: you trade against a pool of two tokens, and a formula sets the price from how much of each the pool holds.

Both answer the same question, which is who is on the other side of your trade. On an order book it is another person's posted order. On an AMM it is the pool.

Knowing which one you are using explains most of what surprises people on their first trades: why a price moves, why a large order costs more per token, and why some tokens can be traded at any hour while others sit with no buyer.

What is an order book?

An order book is a live list of every open offer to buy and every open offer to sell a pair, sorted by price. Buy offers are called bids, sell offers are called asks, and a trade happens when a bid and an ask meet.

The gap between the highest bid and the lowest ask is the spread. On a busy pair the spread is tiny, because many people are posting offers close to each other. On a quiet pair it can be wide, and that gap is a cost you pay the moment you buy and sell straight back.

You can use an order book in two ways:

  • A limit order posts your own price and waits. It fills only if somebody accepts it, and it may never fill.
  • A market order accepts the best prices already posted and fills straight away, at whatever those prices are.

Most order books run on a centralised exchange, where a company's servers match the orders and hold the funds while they wait.

What is an AMM?

An AMM is a smart contract that holds two tokens in a pool and prices every trade with a formula. There are no posted offers and nobody waiting on the other side. You send one token into the pool and take the other out, and the ratio between the two reserves moves as you do.

The most common formula is constant product, written x * y = k, and it has one property that matters more than the maths: the pool always quotes a price, as long as it holds both tokens. AMM and liquidity pools explained works through the formula with numbers.

AMMs run on-chain. On BNB Smart Chain the largest one is PancakeSwap, and every pool, every reserve and every trade in it can be read by anyone.

An AMM's two reserves sit on one curve. A trade slides the point along it, and the slope at that point is the price.
An AMM's two reserves sit on one curve. A trade slides the point along it, and the slope at that point is the price.

Order book vs AMM: what is the difference?

The difference is where the price comes from. On an order book, people set it by posting offers. On an AMM, the pool's balances set it, and nobody has to be online for a trade to happen.

Order bookAMM
Who sets the priceBuyers and sellers, by posting offersA formula, from the ratio of the pool's two tokens
Who is on the other sideAnother trader's posted orderThe pool
When you can tradeWhen somebody has posted an offer at a price you acceptAny time the pool holds both tokens
Choosing your own priceYes, with a limit orderNo: you take the pool's price, and can only cap how far it moves
What a large order doesFills the best offers, then the next ones, at worse pricesSlides along the curve, at a worse price per token
Where it usually runsA centralised exchange's serversA smart contract on a public blockchain
Who supplies what you trade againstTraders and professional market makers posting offersLiquidity providers who deposit both tokens
What you can check yourselfWhat the exchange shows youThe pool's reserves and every past trade, on-chain

What happens to a large order in each?

A large order costs more per token on both, for the same reason: it uses up the best prices first. The mechanism has a different name in each.

On an order book, say the lowest asks are 400 tokens at 1.01 and 600 more at 1.02. A market order for 1,000 tokens buys the first 400 at 1.01 and the other 600 at 1.02, an average of 1.016. The order "walks the book", and the thinner the book, the further it walks.

On an AMM, the same order slides along the pool's curve, paying a little more for every token it takes out. This is called price impact, and it depends on your order's size compared with the pool's depth. In a pool ten times deeper, the same order moves the price about a tenth as much.

Either way, the price on the screen is the price of the next token, not the average of yours. The amount you are shown before you confirm is the number to read. What is slippage in crypto separates this from slippage, which is the price moving because of other people's trades while you wait.

Which one is better?

Neither is better everywhere. An order book works best when many people trade a pair all day, and an AMM works best when they do not.

An order book wins on busy pairs. With thousands of offers close together, spreads are narrow, large orders barely move the price, and a limit order lets you name your price and wait for it.

An AMM wins on smaller tokens. A token with few traders would have an empty or very wide order book most of the day. A pool quotes a price at any hour, and the depth behind that price is public, so you can see before you trade how far your order will move it.

The trade-offs run the other way too. On a thin pool, price impact grows fast with order size, and pending on-chain trades can be seen and traded around before they confirm. On a thin order book, spreads widen and the exchange running it holds your funds while your order waits.

How is INKY traded?

INKY's public market is an AMM. INKY trades against USDT in public pools on PancakeSwap, and there is no order book for it. The price is the ratio of the two tokens in those pools, and anyone can check it on-chain. The pool addresses and their live depth are listed in the INKY liquidity documentation.

Inside the Inkryptus app, a swap also goes through a pool, but the app handles that part for you. You choose an amount, the app shows the final amount you will receive before you confirm, and that is what arrives. There is no slippage tolerance to set and no network fee to pay: a flat 3 USDT per operation is the only charge, shown on the same screen. How swap works on Inkryptus covers the details.

Frequently asked questions

Is an AMM the same thing as a DEX?

Not exactly. A DEX (decentralised exchange) is any exchange that runs on a blockchain, and an AMM is one way of building one. Some decentralised exchanges run an order book on-chain instead. The largest ones on BNB Smart Chain, such as PancakeSwap, use pools.

Can I place a limit order on an AMM?

Not in the pool itself, which only swaps at its current price. Some trading interfaces add limit orders on top: they wait until the pool's price reaches your target, then send the swap for you.

What is a bid-ask spread?

It is the gap between the highest price anyone will pay (the bid) and the lowest price anyone will sell at (the ask) on an order book. Buying at the ask and selling straight back at the bid loses the spread, which is why a narrow spread signals a busy, liquid market.

Why do smaller tokens usually trade on an AMM?

Because an order book needs people posting offers all day, and a smaller token rarely has them. A pool quotes a price at any hour from its own reserves, so a token with few traders can still be bought and sold, with a price impact anyone can check in advance.

Does the Inkryptus app have an order book?

No. In the app you do not post offers or wait for somebody to accept them. You ask for a swap, see the final amount before you confirm, and receive it. The swap goes through a liquidity pool underneath, and the app handles that step for you.

Which is safer, an order book or an AMM?

They carry different risks rather than more or fewer. On a centralised order book, the exchange holds your funds while you trade, so you rely on it. On an AMM, you rely on the pool's smart contract and on its depth, and a thin pool can move a long way on one large order. Checking who holds the funds and how deep the market is answers most of the question.

Keep learning

AMM and liquidity pools explained | What is slippage in crypto | What is a crypto swap | DeFi explained

Crypto asset investments involve risks, including price volatility and risk of partial or total loss of the invested amount. Digital tokens are not legal tender. This content is informational and does not constitute investment advice.