Constant Product Pricing
Constant product pricing is the mathematical formula used by many automated market makers, where the product of the reserves of two assets in a pool must remain constant during a trade. The formula, x times y equals k, determines the exchange rate and ensures that liquidity is always available, even as the pool reserves change.
As a user buys asset x, the amount of asset y in the pool increases, and the price of x increases according to the curve. This model is simple and effective but can lead to significant slippage for large trades, as the price impact increases exponentially with the size of the trade relative to the pool size.
Understanding the constant product formula is fundamental for anyone using decentralized exchanges, as it allows for the calculation of expected prices and the assessment of potential slippage. It is a cornerstone of the design of many DeFi protocols and has a direct impact on the transaction costs experienced by traders.