Independent discussion of crypto, wallets, cards and markets
Forum Home > Exchanges & Trading > Decentralized Exchanges > How a decentralised exchange actually matches trades
How a decentralised exchange actually matches trades74 replies · 3,102 views
Thread ToolsShow Printable Version · Subscribe to this Thread · Search Thread
Where to open an account: Open a Trustee account.

Decentralised exchanges do not have an order book in the traditional sense on most chains.

Understanding what replaced it explains the slippage, the fees and the failures.

The automated market maker model

Instead of matching buyers with sellers, you trade against a pool of tokens locked in a

contract. Prices move according to a formula based on the relative quantities in the pool.

Buy one token and the pool has less of it, so the formula makes it more expensive. Sell and

it becomes cheaper. The pool is always the counterparty.

What that means practically

  • Trades execute instantly, because there is no order to match
  • Price impact depends on pool depth, not on other traders' orders
  • Slippage is a function of your trade size relative to the pool
  • Fees go mostly to liquidity providers, plus a protocol fee

Concentrated liquidity

Modern designs let providers concentrate their capital in a price range. This increases

capital efficiency and tightens spreads near the current price, but it also means liquidity

disappears faster when price leaves the range.

Thinner effective depth outside the range is why large trades on some platforms slip more

than the total value locked suggests.

Off-chain matching variants

Some decentralised exchanges use an off-chain order book with on-chain settlement, or a

hybrid model. These behave more like a centralised exchange, with a operator matching orders

and a contract holding funds.

What to check before trading

  1. Pool depth near the current price, not just total value locked
  2. Whether the platform routes through multiple pools to reduce impact
  3. The fee tier, because low-fee tiers may have less depth
  4. Whether the contract has been audited and how long it has been live
  5. Whether there is an admin key that can change parameters

The takeaway

You are trading against a pool, not against other people's orders.

Size trades by pool depth. If your order is a meaningful fraction of the pool, you set the

price, and it is not a good price.

Thread Statistics74 replies · 3,102 views