Author: 0xAlpha, Richard Chen
Last updated on 2024.08.28
In the previous paper, we introduced a new type of derivative, Gamma Swap. As discussed, the trading of Gamma swap depends on a composite trading venue consisting of two (virtual) primitive trading venues for power perps and perpetual futures. This paper explains the implementation of such a composite trading venue by the DPMM of Deri Protocol.
Following the terminology in the previous paper, in this paper, $i$ refers to the index price while $M$ refers to the different kinds of mark prices. The core role of DPMM is to determine the mark prices based on the index price input and the trading activities. Everything else (e.g., PnL, funding fees) is then based on the mark prices.
Internally, 1 unit of Gamma swap is treated as a portfolio of powers and perps. DPMM simultaneously keeps track of the power and perp positions and calculates their respective mark prices. When 1 unit of long Gamma swap is entered, the DPMM adds 1 unit of power and $-\frac{2i_0}{1-h_0T}$ units of perp to the two positions, respectively. One could also enter a Gamma swap position with a specified entry price $i_s$. In that case, DPMM would add 1 unit of power and $-\frac{2i_s}{1-h_0T}$ units of perp to the two positions, respectively. Denote the total net position of power as $n$ and total net position of perp as $m$, then DPMM calculates the mark price of perp as follows:
$$ \frac{M_{perp}-i}{i}=k_{perp}\left(n\cdot\frac{2i}{1-hT}+m\right)=k_{perp}m' $$
where $i$ is the index price of the underlying, and $m'=n\cdot\frac{2i}{1-hT}+m$. Please note that:
And the mark price of power is:
$$ \frac{M_{power}-i_{power}}{i_{power}}=k_{power}n $$
where $i_{power}$ is the theoretical price of the power, calculated just like that in the power perp DPMM:
$$ i_{power}=\frac{i^2}{1-hT} $$
Now we have a composite DPMM that, at any point, takes the state variables $(n, m, i, \sigma)$ to determine $(M_{perp}, M_{power})$ and hence gives $M_{gamma}$ as
$$ M_{gamma}=M_{power}-\frac{2i_0}{1-h_0T}M_{perp}+\frac{i_0^2}{1-h_0T} $$
$M_{gamma}$ determines the trading cost of every trade and consequently determines PnL.