Professional Documents
Culture Documents
Kyber Price Discovery
Kyber Price Discovery
Kyber Price Discovery
Jonathan Nathan
26.4.2018
The amount of tokens Tmax that will be sold until reaching Pmax , is related
to the maximal price on our platform P (Emax ) in the following way
Z Emax
1
Tmax = dE
E P
where Emax is given from Pmax itself,
1 Pmax
Emax = ln
r Pmin
1
carrying out the integration and plugging in Emax will give:
1 1 1
Tmax = −
r P (E) Pmax
the initial amount of tokens T0 will be given by calculating Tmax at E0 , which
finally gives
1 1 1
T0 = −
r P0 Pmax
similarly, the initial amount of ETH, E0 , can be deduced from the initial
price P0 as
1 P0
E0 = ln
r Pmin
So given Pmin , Pmax , P0 , r we can find E0 , T0 , Emax .
0.175
0.150
0.125
Price E/T
P0
0.100
0.075
Pm in
0.050
0.025
0.000
0 20 40 60 E_0 80 100 120 140
Invent ory in E E_max
3
2 Trading with spread
I assume that the spread S is given in percentage of the trade, and composed
of 2 different terms: fee spread Sf ee and liquidity spread Sliq , so
S = Sf ee + Sliq
The fee spread vanishes from the system (to cover costs, etc.) The liquidity
spread is returned to the reserve in order to reduce the price increase rate
r and increase liquidity over time. Each side of the reserve should get a
different fraction from the Sliq earnings. The ratio depends on the current
sizes of E and T , and their ratio to the total value of the reserve. In order
to determine the ratio α and the new rate r0 , we do the following process:
∆Enet = ∆E · (1 − S)
∆Tnet = ∆T (∆Enet )
Enet = E + ∆Enet
Tnet = T + ∆Tnet
4. Calculate how to divide the extra gain between the E and T reserves.
In order to do that, we solve a system of 2 equations:
r · Enet
r0 =
Enet + α∆Eextra
0
Z Emax
1
dE = Tnet + (1 − α)∆Textra
Enet +α∆Eextra P (Enet )
4
0 1 Pmax
Where Emax = r0
ln Pmin
. After solving the above equations for α
we get
Enet (r(Tnet + ∆Textra ) − β)
α=
β · ∆Eextra + r · Enet · ∆Textra
r · Enet
r0 =
Enet + α∆Eextra
1 1
where β = P (Enet )
− Pmax
.
5. Now we can finally update the reserve with the extra amounts:
E = E + Enet + α · ∆Eextra
T = T + Tnet + (1 − α) · ∆Textra
5
0.200 Pmax
0.175
0.150
0.125
Price E/T
P0
0.100
0.075
Pmin
0.050
0.025
0.000
0 20 40 60 80 100 120 140 160
Inventory in E
Figure 2: The change in the price function after some volume was traded.
The gray line shows the original price function with rate r and the blue the
modified price with rate r0 and higher liquidity. The green point shows the
current price.