Skip to main content

How Does an Automated Market Maker (AMM) Calculate the Price of a Token Pair in a Liquidity Pool?

An AMM typically uses a constant product formula, $x y = k$, where $x$ and $y$ are the quantities of the two tokens in the pool, and $k$ is a constant. When a trade occurs, the ratio between $x$ and $y$ must change to maintain the constant $k$.

This change in ratio dictates the new price of the tokens relative to each other. The larger the trade relative to the pool size, the greater the price change.

How Does the Constant Product Formula Work in a Basic AMM?
How Does a Constant Product Formula (X Y=k) Govern the Price in a DEX Smart Contract?
What Is the Formula for the Constant Product Market Maker (CPMM) and How Is It Exploited?
How Does a ‘Hybrid AMM’ (Like Curve’s Stableswap) Combine Features of Constant Product and Constant Sum?