Written by: Leida Xiong, founder of DODO
An effective market contains a huge amount of information, which carries the market’s judgment on prices. However, the computing resources on the chain are limited. To achieve a highly flexible market on the chain is like putting an elephant in a refrigerator.
It is not uncommon to cram an elephant into a refrigerator, and there have been several feats in the history of the Internet. Such as image compression, audio compression.
The essence of compression is to extract the most important features and discard unimportant details.
So, what is the most important characteristic of a market? Liquidity. Liquidity can be expressed as a depth map.
From the figure below, we can see that the depth map can be abstracted as two triangles, and to describe these two triangles, only the median price and slope are needed.
We focus on the depth of the selling trapezoid on the right. Its biggest feature is that the more Base Tokens bought, the higher the price. Therefore, this linear depth can be expressed as
Where i is the first parameter “mid price” and k is the second parameter “slope”.
B represents the current Base Token inventory, B0 represents the initial Base Token inventory, and (B0-B)/B0 is used to represent the percentage of BaseToken that has been consumed.
This formula can make the price increase linearly with the number of Base Token sold.
But is linearity really the best way to describe liquidity? No, linear description has two limitations:
- In the real market, most of the liquidity is concentrated near the middle price of the market, and the linear description does not reflect this uneven distribution.
- Even if the price deviates far from the market median price, there should be liquidity, and the price under the linear description has upper and lower limits.
We have introduced nonlinearity to the price curve. Under the premise of not expanding the parameters, the depth distribution is more in line with market laws and more flexible.
The simplest nonlinear solution is to use multiplication instead of addition.
This formula can satisfy that as B decreases, P keeps increasing until infinity. But how do you add the influence of the slope?
This requires modification of the B0/B item. B0/B≥1, we use a parameter to scale it, while keeping this value greater than or equal to 1, we can control its “degree greater than 1”.
In the above formula, the value range of k is [0,1], which determines the slope of the price.
When k=0, the price is completely unchanged
When k=1, the price slope degenerates to the previous version of the formula
The larger the k, the more sensitive the price changes. The smaller the k, the less sensitive the price changes.
But there is a small problem, where P is the marginal price, and the integral to the marginal price is the amount of assets that users need to pay. In the above formula, a logarithmic function appears after the integration of B0/B, which makes subsequent calculations very complicated. In order to avoid this trouble, we go further:
Add a square term outside B0/B so that after integration becomes a simple division.
What is amazing is that when k=1, this curve is exactly the bonding curve defined by AMM. This coincidence makes us believe that this is a set of algorithms that touches the essence of the market more.
Similarly, for the depth map on the left half, we use a symmetrical approach, replacing base token with quote token, and replacing multiplication with division:
We combine the depth maps on the left and right sides to get the full version of the PMM algorithm.
The PMM algorithm is a high compression of the Orderbook market, with simple parameters but extremely flexible.
This allows us to have an ability comparable to an elephant in such a small space as a refrigerator.
Let me enumerate what use cases this algorithm can achieve by adjusting the parameters and the deposit and withdrawal rules.
Use Case 1 Active market making following external market prices
The application scenario of this use case is a mainstream currency with a huge external market, such as ETH BTC, etc.
PMM can actively adjust the market price and reduce IL. Get a higher utilization rate of funds than AMM, and hold a single currency to provide liquidity
The settings are as follows:
Set price i to the external market price
Set k to a number less than 1
Allow anyone to deposit and withdraw unilaterally
We call this Use Case the DODO Classic Pool.
Use Case 2 Automatic market making algorithm with light capital demand
This use case is applied to the long-tail currency market without subjective pricing power, and the pricing power is completely given to the taker
Generally speaking, long tail coins are new assets, and there is insufficient selling liquidity under the AMM framework, which leads to long-term lack of liquidity.
The settings are as follows:
Set the price i to the initial issue price
Arbitrarily set k
The first recharge can be in any proportion of assets without changing the market price
Subsequent deposits (or withdrawals) must operate both assets at the same time according to the current asset ratio
This Use Case is called DODO Vending Machine.
Use Case 3 Completely free market making algorithm
This use case is prepared for market makers who are ambitious and want to make a big splash. (The market maker can also be a project party or an individual)
In this use case, all funds in the fund pool are owned by the market maker. All parameters can be adjusted, and the market maker can price assets flexibly according to his judgment. At the same time, the market maker can charge the bill of lading in one currency at will, without affecting the market price.
E.g:
Make a market near ETH=700USDT, use a small k to obtain very competitive liquidity and earn a lot of handling fees. When it is detected that ETH is expected to rise, withdraw ETH inventory to reduce unilateral risk. But this operation does not weaken buying liquidity.
The new asset issuance project only provides tokens without funding. Start selling tokens at 1$. In order to allow more people to buy tokens at a reasonable price, a smaller k is set, which makes the token rise moderately. Later, when the project party finds that it needs to use funds, it can directly raise the assets in the fund pool without damaging the liquidity of the selling order, that is, users can still buy a lot of cheap tokens.
The settings are as follows:
- Only market makers can deposit and withdraw, allowing single currency operations
This Use Case is called DODO Private Pool.
Use Case 4 Liquidity Crowdfunding
We can divide the new asset issuance into two stages:
- Do not open spot transactions, all participants in the sale will get tokens at the same price
- The ending price of the previous stage opens the spot transaction, and the remaining tokens and assets of the previous stage are used to establish a DODO Vending Machine
We call this Use Case CrowdPooling.
Use Case 5 degenerates into AMM
When the following conditions are met, the PPM algorithm behaves the same as AMM.
This also means that AMM is a special case of PMM. The derivation process is as follows:
The price formula of AMM is xy = k, where k is a constant, and x and y respectively represent the quantity of two tokens. In order to avoid the ambiguity of letters, we define the constant product in the AMM formula as Const and rewrite it as y=Const/x.
Where y represents the quote token inventory, and x represents the base token inventory. The price can be written as the derivative of y (note that the absolute value is added here, because the price is a positive number).
Next, back to the PMM formula for k=1, we can write it as:
We found that the numerator of the PMM price formula is a constant, and the denominator is the inventory of the base token. Just make
The pricing formula of AMM is consistent with that of PMM!
Use Case 6 stablecoin trading
The settings are as follows:
Algorithm performance can be the same as curve, and more flexible, it can be closer to rigid exchange than curve, or closer to AMM.
Source link: medium.com