Constant Product Market Maker Formula
The constant product formula is the mathematical backbone of many AMMs, represented as x times y equals k. Here, x and y are the quantities of two assets in a pool, and k is a fixed constant maintained during trades.
When a user buys asset x, they must add asset y to the pool to keep k unchanged, which forces the price of x to rise. This simple equation ensures that liquidity is always available for trades of any size, though price impact increases as the trade size grows.
It creates a curve that asymptotically approaches infinity, preventing the pool from ever being fully drained of assets. This design provides continuous liquidity without requiring active management or external price feeds.
It is the foundation of the decentralized exchange model.