# Details about PMM

**Algorithm Introduction**

The PMM algorithm has to answer how prices change according to inventory.

We observe two characteristics from the market.

- 1.Most of the liquidity is concentrated around the mid-market price, i.e., the price changes non-linearly with respect to the inventory.
- 2.There should be liquidity even if the price deviates far from the mid-market price, but it will be very scarce We therefore introduce a nonlinear term for the price curve to make the depth distribution more consistent with the market and more flexible.

The price curve equation is as follows:

$P = i(1-k + k(\frac{B_0}{B})^2)$

where

$i$

is the first parameter "guide price", $k$

is the second parameter "slippage factor", $B$

denotes the current token inventory,${B_0}$

denotes the equilibrium inventory (which can be interpreted as the exposure you are willing to hold), and $\frac{B_0}{B}$

is used to indicate how much the current token inventory has shifted compared to the equilibrium state.Note that "equilibrium" does not mean that both tokens are worth the same. What constitutes "equilibrium" is artificial, and everyone can set what they think is "equilibrium". Under this formula.

-When

$k=1$

, this curve is exactly the same bonding curve as AMM -When

$0<k<1$

, this curve concentrates liquidity more in the $i$

neighborhood than the AMM =---When$k=0$

, this curve degenerates to a fixed price We call the valuation tokens in a pair Quote Token and the transaction tokens Base Token, abbreviated as $B$

and$Q$

. Quote Tokens and Transaction Tokens have equal status in this system, i.e., they are symmetric. Therefore, $i$

refers to how many $B$

tokens can be exchanged for $Q$

each token.So, for the case of a missing inventory of valued tokens, we replace multiplication with division using the symmetric approach.

$P=i/(1-k+(\frac{Q_0}{Q})^2k)$

To put it in order, the price curve of PMM corresponds to the formula :

$P=iR$

is determined by the following rule : If

$B<B_0$

, then$R=1-k+(\frac{B_0}{B})^2k$

If

$Q<Q_0$

, then$R=1/(1-k+(\frac{Q_0}{Q})^2k)$

Other cases

$R=1$

**Design ideas**

The PMM algorithm is not just an empty idea, but has a complete evolution, if you want to know more please refer to

**this article****.**Last modified 9mo ago