DPMM (Proactive Market Making)

# Introduction

Proactive Market Making (PMM), introduced by DODO for spot trading, is adapted by Deri Protocol for its derivative-oriented PMM paradigm: Deri Proactive Market Making, abbreviated as DPMM.
Perpetual futures and everlasting options are just two special cases of the general form of funding-fee-based perpetual derivatives requiring one long position to pay one short position [MARK-I(S)] as funding fee, where I(S) is a general “intrinsic value” function of the underlier price S. Another instance of such funding-fee-based perpetual derivatives is the so-called Power Perpetuals.
The DPMM of Deri V3 has unified the funding and pricing mechanisms for all funding fee-based perpetual derivatives. That is, the DPMM of Deri V3 is designed to universally handle funding-fee-based perpetual derivatives rather than respectively handling perpetual futures or everlasting options. This has led to a major architectural simplification of the Deri V3 DPMM: the DPMM of Deri V3 has only one general-purpose trading pool (i.e. one single smart contract) implementing the pricing and funding fee logic.

# DPMM of Perpetual Futures

With Deri's PMM algorithm, when the net position is 0 (the equilibrium state; long positions equals short position), the mark price equals the index price fed by the oracle. Whenever there is a trade, it pushes the mark price toward the specific trading direction (i.e. a buying trade pushes the price up while a selling pushes it down). The price change due to the trade is proportional to the trade size.
For example, if the current mark price is P and someone places a trade of size x, then the mark price is pushed to P + ∆P, where ∆P = a • x, with a determined by the pool liquidity and the pool parameters. Since mark price is the trading price for a trade of infinitesimal size as of the current state, the trading price of the trade of size x is the average from P to P + ∆P, roughly P ∆P/2. The precise trading price is calculated by the trading cost as an integral from P to P + ∆P
As the trading volume pushes the mark price linearly, the price spread and the mark price are determined by the total net position, as follows:
$∆P/i = a(l — s),$
$P = i[1 a(l — s)]$
where i is the index price, / and s are the total long and short positions. Thus (1 — s) is the total net position, and a is a coefficient determined by the pool liquidity & parameters.>

## Example

Let's take the following example of BTCUSD perpetual futures to illustrate how this works numerically.
• The pool liquidity (in terms of BUSD): L = 1, 000, 000
• The total net position (in terms of BTC): l-s = 1
• The index price of BTCUSD: i = 50000
• a = 0.01
• f = 0.01/86400, where 86400=24*60*60 is the number of seconds per day. (Please note these are not real parameters - we purposely choose these numbers to make the example numerically easy to understand. Please refer to the specific smart contract for the respective real parameters)
Then we have the percentage premium of the mark price, over the index price, as follows:
That is, the mark price is 1% above the index price, which leads to
$\frac{P-i}{i}=a(l-s)=0.01$
$P=i(1+1\%)=50500$
resulting in, ∆P = 500.
And the funding fee of 1 long contract. paying 1 short contract per second is
$F = (0.01/86400) * 500 = (0.01/86400) * 0.01 * 1 * i$
which is equivalent to a daily funding fee being:
$F • 86400 = 500 = i • 0.01%$
That is, 1 long contract pays 0.01% of the contract value to 1 short contract per day.

# DPMM of Everlasting Options

For everlasting options, the DPMM (Deri Proactive Market Making) mechanism is adopted to carry out trades. For each everlasting option, DPMM takes two inputs from the oracle: the underlying price and volatility. It calculates then the theoretical price (
$i$
) for the option (refer to the whitepaper for the math of the pricing).
This theoretical price is used as the starting point of the DPMM pricing. When the net position is 0 (the equilibrium state), the option mark price equals the theoretical price
$i$
. Whenever there is a trade, it pushes the mark price toward the trading direction (i.e. a buying trade pushes the price up while a selling pushes it down). The price change due to the trade is proportional to the trade size.

## Example

Let's take the following example of BTCUSD-50000-C Everlasting Options to illustrate how this works numerically.
• The pool liquidity (in terms of BUSD): L = 1, 000, 000
• The total net position (in terms of BTC): l-s = 1
• The index price of BTCUSD: i = 55000
• The mark price of BTCUSD-50000-C: P=5300 (the mark price is derived from the everlasting option pricing formula and the DPMM model to reflect the long/short demand on the market.)
• The intrinsic value of BTCUSD-50000-C: I = 55000 - 50000 = 5000
• a = 0.01
• f = 0.01/86400, where 86400=24*60*60 is the number of seconds per day. (Please note these are not real parameters - we purposely choose these numbers to make the example numerically easy to understand. Please refer to the specific smart contract for the respective real parameters)
The funding fee is based on the premium of mark price over intrinsic value. In this case, the funding fee of 1 long contract paying 1 short contract per funding period (e.g. 1 week) is P-I = 5300-5000=300. This corresponds to a funding per second as
(P-I) / (7*24*3600) = 300 / (7*24*3600) = 0.000496