IMM Functions

IMM Conservation Functions

A scenario representing a trader buying from the pool:

A scenario representing a trader selling to the pool:

The conservation functions implicitly affect the “bonding curve”, which is continuous, differentiable, convex, and monotonically decreasing.

If the trader exchanges ΔY units of ETH to ΔX units of LP token (buys X), the pool will consist of X = Xc- ΔX and Y = Yc+ ΔY units correspondingly after the trade and the effective price of the buy trade will be:

Similarly, if the trader exchanges ΔX units of LP token to ΔY units of ETH (sells X), the pool will consist of X = Xc+ ΔX and Y = Yc- ΔY units correspondingly after the trade and the effective price of the sale deal will be:

IMM Price Functions

The IMM price function is derived from the IMM conservation function as follows: Price as the function of ΔX:

Price as the function of ΔY:

Note: if ΔX→0 and ΔY→0 (infinitely small trade amounts), then

Pb → Pc and Ps → Pc and the spread equals 0.

Pc = - dYdX = the derivative of the bonding curve function with a negative sign.

The price functions have the following properties:

  • Continuous and monotone.

  • Symmetric and reflective of the equality of assets X and Y. Thus, we can replace X↔Y, buy↔sell, and P ↔ 1P

  • Practically, the pool assets will not be exhausted as:

    • Pb → ∞ and Y→ ∞ when X → Xc , for a buy trade;

    • Ps → 0 and X→ ∞ when Y → Yc , for a sale trade;

The price functions determine the slippage for the buy and sell trades. When the trade quantities are relatively small in comparison to the pool total quantities (i.e. ΔX << Xc and ΔY << Yc ), the effective trade price will be very close to Pc.

However, as the trade quantity increases, the buy price rises for the buy trade and decreases for the sale trade, in comparison to the Oracle market price.

Last updated