The math behind sPMM

Synthetic Proactive Market Making (sPMM)

sPMM is the core algorithm powering the WOOFi Swap, which provides the best way to simulate a CEX order book in a DEX liquidity pool.

The sPMM works as follows:

If a user wants to buy the minimum amount of base tokens, the executed price will be:

The average buy price is:

We can get the sell price in the same way. The final formula is:

  • Basic sell function:

  • Basic buy function:

  • Reverse sell function:

  • Basic buy function:

Custom On-chain Price Feed

Last updated