PMM Overview

Active Market Maker Algorithm

DODO uses the original PMM algorithm to provide liquidity.
PMM is an inventory management strategy. When the quantity of an asset becomes low, the PMM algorithm automatically increases the price quoted for this asset in anticipation of buying back the missing inventory from the market.

A simple example

Next we will use a simple example to illustrate how PMM works. (The following example numbers are not exact, but are just to help you understand how the algorithm works)
Peter's boss gives him $100 and 10 apples. There are people in the market who buy and sell apples, and Peter has to satisfy these people's buying and selling needs with the inventory he has on hand. In more technical terms, this is "providing liquidity to the apple market".
The owner tells Peter that the apples are about $10 each and then goes home to rest, leaving Peter to wait for the users above in the market. Someone buys an apple from Peter, Peter adds a little price to it and sells it to him for $12. The $2 is the so-called "slippage". At this point Peter's inventory is $112 and 9 apples. That is + $12 - 1 apple.
Peter automatically places a pending order at $11 (slightly above market price), expecting to buy back an apple as soon as possible to make up the shortfall. Soon Peter buys back the apple for $11, leaving Peter with $101 and 10 apples in stock, or +$1 and 0 apples. Although it cost $1 more, the extra $2 received through the slippage was enough to make up for it, and Peter helped his boss make a net profit of $1.
The PMM algorithm is the Peter of the above behavior, and you are Peter's boss. what Peter does in a nutshell is to provide liquidity while maintaining a healthy inventory by actively adjusting prices.

Price Curve

To better describe how PMM manages inventory, we need to introduce the price curve as a tool. It shows exactly how the price of an asset changes when its inventory decreases.
Click to enter ———— Price Curve Simulator.
[The horizontal coordinate, from 100% to 1%, represents the inventory stock, and the vertical coordinate, price, can be set with parameters and mouse-over]
If you adjust the parameters
, you will find that: the larger
, the steeper the curve, the more sensitive the price is to the quantity of inventory, and the larger the trading slippage. The smaller
, the smoother the curve, the less sensitive the price is to the quantity in stock, and the smaller the trading slippage.
This parameter
, which we call the slippage factor, is the key to the PMM algorithm and allows market makers to concentrate liquidity around a certain price. The smaller it is, the more liquidity is concentrated and the better the price at which traders can trade.

Using smart contracts to provide liquidity

DODO has implemented the EVM smart contract version of the PMM algorithm, in which the concept of orders does not exist, but rather the supply and consumption of liquidity.