DVM Initial Price Formula Explanation

Since this pool uses the PMM algorithm, which is different from the normal AMM pool mechanism, the initial price calculation is also different from AMM. In such specialized PMM pools, we employ a very small value for i to reduce the impact of k and i, increasing the weight of Base Reserve and Quote Reserve in the pool price calculation, making the performance of the pool tends to be similar to the AMM. In the pool creation process, i is constant 10510^5, and the absolute value of the converted units is 1โˆ—10โˆ’131*10^{-13}.

ย ย 

Calculate initial price when B and Q known#

B and Q can be obtained when initialization. At this time Q0 = 0, we can calculate B0, which is similar to the standard regression case. For calculation formula details, please refer to: Calulating the Regression Target

B0=B1+B12k(1+4kฮ”QiB1โˆ’1)B_0 = B_1 + \frac{B_1}{2k}(\sqrt{1+ \frac{4k\Delta Q}{iB_1}} - 1)

Among it, where B1 = B and delta Q = Q, substituting k and i gives B0.

When B0 is known, the formula for calculating midPrice is:

P=i(1โˆ’k+kB02B2)P = i(1 - k+k\frac{B_0^2}{B^2})

ย ย 

Setting the midprice and B to deduce Q#

The midPrice formula is as follow:

P=i(1โˆ’k+kB02B2)P = i(1 - k+k\frac{B_0^2}{B^2})

The formula for calculating B0 after the transformation is:

B0=(Piโˆ—k+1โˆ’1k)B2B_0 = \sqrt{(\frac{P}{i*k}+1 - \frac{1}{k})B^2}

Substituting B0 into the formula for calculating target, then we get:

  1. k = 0. The refined formula for B0 is:
B0=B+QiQ=iโˆ—(B0โˆ’B)B_0 = B + \frac{Q}{i} \newline Q = i*(B_0 - B)
  1. B = 0. This case is excluded, B cannot be 0.
  2. Normal case. The refined formula for B0 is:
kBB02+(1โˆ’2k)B0โˆ’(1โˆ’k)Bโˆ’Qi=0\frac{k}{B}B_0^2 + (1- 2k)B_0 - (1 - k)B - \frac{Q}{i} = 0

โ€‚โ€‚โ€‚ Substituting B0, B, i, and k, and we get:

Q=i[kBB02+(1โˆ’2k)B0โˆ’(1โˆ’k)B]Q= i[\frac{k}{B}B_0^2 + (1- 2k)B_0 - (1 - k)B ]