Market Maker Functions
AMMs utilize a formula that decides how assets will be priced in the pool. Constant function means that no matter the size of the trade or the asset being traded, the rules for trading remain the same. The most common type is Constant Product Market Maker, but other functions are utilized as well.
Many AMMs utilize the Constant Product Market Maker model (x * y = k). This design requires that the total amount of liquidity (k) within the pool remains constant. Liquidity equals the total value of Asset A multiplied by the value of Asset B.
Prices in the pool are determined by this function (shown by the curve below). The cost of each trade is based on how much it shifts the curve. Each additional unit of Asset B that the trader purchases shifts the curve even further right, meaning each unit of Asset B is more expensive than the previous one.
This design simply replaces the multiplication in Constant Product with addition (x + y = z). Liquidity in the pool equals the total value of Asset A plus the total value of Asset B.
This model allows users to create liquidity pools with more than two tokens and non-standard weights. Constant Mean Market Maker requires that the weighted mean of an asset remains constant. Constant mean market maker utilizes the formula: (x y z)³ = k
Some AMMs allow for unique parameters in the pool. A hybrid constant function could involve a combination of constant product and constant sum (Curve Protocol) or an entirely new mathematical expression.
Most AMMs require every pool to utilize the same function. Osmosis allows liquidity pools to be created with any conceivable design. Osmosis opted to be an “AMM laboratory” where experimentation is encouraged. This creative freedom positions Osmosis to be ground zero for AMM innovation, such as new methods of reducing slippage or impermanent loss.