Learn · Fundamentals

What is an automated market maker (AMM)?

An automated market maker, or AMM, is the engine behind most decentralized exchanges. Instead of matching buyers to sellers through an order book, it lets you trade against a pool of tokens using a mathematical formula that sets the price automatically. That single design choice is what makes permissionless, always-on, on-chain trading possible. This article explains how AMMs work, the constant-product math at their core, why prices move with every trade, and what the people who supply the pools actually earn.

No order book, just a pool

A traditional exchange maintains an order book of bids and asks and matches them. An AMM has no order book. Instead, liquidity providers deposit two tokens into a shared pool, and traders swap against that pool. A formula decides the exchange rate based purely on the ratio of tokens in the pool. There is no counterparty waiting to take the other side of your trade — the pool itself is the counterparty, and it is always open.

The constant-product formula

The most common AMM keeps the product of the two token quantities constant: multiply the amount of token A by the amount of token B and that number stays fixed through every trade. When you buy token A, you remove some from the pool and add token B; to keep the product constant, the price of A rises. This simple rule produces a smooth pricing curve that always quotes a price, no matter how large or small the trade.

Why prices move on every trade

Because price depends on the ratio of reserves, every trade changes the price for the next trader. Small trades against a deep pool barely move it; large trades move it a lot. This is the source of price impact, and it is why quotes expire — other people's trades change the ratio between the moment you preview and the moment you sign. It is also what arbitrageurs exploit to keep AMM prices in line with the wider market.

What liquidity providers earn

Providers deposit tokens and earn a share of the trading fees the pool charges on every swap, proportional to their share of the pool. The catch is impermanent loss: when the two token prices diverge, providers end up with less value than if they had simply held the tokens. Whether providing liquidity pays depends on whether fee income outruns that divergence, which is why stable, high-volume pairs are generally friendlier to providers than volatile ones.

Variations on the theme

Newer AMMs refine the basic model. Concentrated-liquidity designs let providers focus their capital in a price range for greater efficiency, and stable-swap curves are tuned for assets meant to trade near parity, giving very tight spreads between stablecoins. The core idea is the same throughout: a formula and a pool replace the order book, and an aggregator like XAUConnect reads across these pools to find your best route.

Legal

Risk disclosure

XAUConnect is a non-custodial swap aggregator. Digital assets are volatile and may lose value rapidly. Content on this page is educational and not investment advice. Verify every contract address on the official block explorer before approving a transaction.

Frequently asked questions

How does an AMM set prices without an order book?

A formula based on the ratio of tokens in the pool sets the price. Trading shifts the ratio, which moves the price automatically — no buyers and sellers need to be matched.

What is the constant-product formula?

It keeps the product of the two token quantities fixed. Buying one token raises its price so the product stays constant, producing a smooth curve that always quotes a price.

Why do AMM prices change with every trade?

Because price depends on reserve ratios. Each trade changes the ratio, so it moves the price for the next trader — the source of price impact and why quotes expire.

What do liquidity providers earn?

A share of trading fees proportional to their stake, offset by impermanent loss when token prices diverge. High-volume, low-volatility pools favor providers.

Live execution

Trade on XAUConnect

Open the swap page to compare live routes, set slippage, and sign from your own wallet — fully non-custodial.

Continue exploring

Related markets, guides & networks

Curated next steps based on this topic — deepen your research before you trade.

Build programmatically

Swap via API for bots and AI agents — quotes, builds, and cross-chain routes.

Developer quickstart