How to Arbitrage
The DPMM of Deri Protocol is designed around the arbitrage mechanism to offset the net position of the trading pool. This article explains the details of the mechanism.
The basic idea of arbitrage is straightforward: per the DPMM mechanism, the funding fee is paid from the majority side to the minority side. Therefore, a very simple arbitrage strategy is to take the minority side of the pool to earn the funding fee. At a high level, this involves the following steps:
Read the current funding rate of the pool. when it is at some positive (negative) threshold, enter a short (long) position.
Accordingly, hedge your short/long position outside (e.g. hold a spot position or take a futures position on a centralized exchange as you wish).
Sit back and enjoy collecting the funding earning (i.e. negative funding fee).
Close your position when it stops paying the funding fee (i.e. the sign of the funding rate flips).
The tricky part is steps 1 and 4, for which you pay transaction fees (i.e. your cost of the arbitrage). However, if you properly choose the timing of steps 1 and 4 (the entry and closing points), you can compensate your transaction cost with the “negative slippage” of your trades so that the whole procedure from steps 1 to 4 is guaranteed to make profits. The key is to take advantage of the spread between mark price and index (determined by the DPMM based on the total net position). For example, if we are to arbitrage with the BTCUSD perpetual futures with a transaction fee of 0.1% of the national, then we can choose the entry and closing points as follows (denoting index price and mark price as and ).
Assume I = 40000, and the total position is positive, pushing the mark price up to M = I* (1+0.4%) = 40160 Open a short position to pull the mark price to M = I* (1+0.2%) = 40160. Your transaction fee is around 40 and your average trading price of opening the position is around I*(1+0.3%) = 40120 .
hedge your long position somewhere else.
Collect the funding earning of your short position.
Due to other traders’ activities, the total net position becomes 0, and thus the mark price becomes at par with the new index price (then you stop receiving funding earnings). Let’s assume now the index price I’=50000. Close your short position, which would push the mark price to M = I’*(1+0.2%) = 50100. Your transaction fee is around 50 and your average trading price of closing the position is around I’*(1+0.1%) = 50050.
As long as you are perfectly hedged, your total (negative) slippage from steps 1 and 4 would be -(I+I’)* 0.1% = -90, which is a profit perfect compensating the total transaction fees 90. Therefore, the funding fees that you earn from step 3 are pure profits. In practice, you would also take into account the possible cost on the hedging side. But this depends on where and how you do it. Under certain circumstances and with specific strategies, this cost could be zero or even negative.
A sample code of taking arbitrage with Deri Protocol can be found here on Github. Please note this code is for demo purposes only. You will use it at your own risk.
Last updated