What is the constant product formula?
The constant product formula is the pricing model used by many automated market makers in DeFi, especially platforms like Uniswap. It keeps trading smooth by ensuring that the product of the two token reserves in a liquidity pool always stays the same. The formula is written as **x × y = k**, where x and y are the quantities of the two tokens in the pool, and k is a constant that cannot change during trades.
When someone swaps one token for another, the pool adjusts the reserves so the equation still holds. If a trader adds token X to the pool, the value of x increases, so the pool must reduce the amount of token Y to maintain the constant product. This is what causes the price to move automatically. As traders buy more of one token, it becomes more expensive because the pool has less of it left.
This mechanism allows trading without an order book, matching engine or counterparty. It also encourages arbitrage traders to step in and correct price differences between the pool and the broader market, which helps keep prices aligned.
The constant product formula is simple but powerful. It ensures liquidity at all times, no matter how large or small the trade is. It also sets the foundation for many modern AMM designs, helping create open and decentralised markets where anyone can trade or provide liquidity.
When someone swaps one token for another, the pool adjusts the reserves so the equation still holds. If a trader adds token X to the pool, the value of x increases, so the pool must reduce the amount of token Y to maintain the constant product. This is what causes the price to move automatically. As traders buy more of one token, it becomes more expensive because the pool has less of it left.
This mechanism allows trading without an order book, matching engine or counterparty. It also encourages arbitrage traders to step in and correct price differences between the pool and the broader market, which helps keep prices aligned.
The constant product formula is simple but powerful. It ensures liquidity at all times, no matter how large or small the trade is. It also sets the foundation for many modern AMM designs, helping create open and decentralised markets where anyone can trade or provide liquidity.
The constant product formula is a pricing model used by automated market makers in decentralised exchanges. It keeps the product of two token reserves equal to a fixed value. When traders buy one token, its reserve decreases while the other increases, and the price adjusts automatically to maintain the same product. This creates continuous liquidity without relying on traditional order books. The formula also means large trades move the price more, which helps protect pools from being drained. Liquidity providers deposit both tokens to support the pool and earn a share of trading fees. The model is simple, predictable, and widely used in platforms that rely on automated, permissionless trading.
Dec 03, 2025 02:53