Arbitrage

# 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. We take Perpetual Futures as an example, and the arbitrage with Everlasting Options would be similar.
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:
1. 1.
Read the current funding rate of the pool. when it is at some positive (negative) threshold, enter a short (long) position.
2. 2.
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).
3. 3.
Sit back and enjoy collecting the funding earning (i.e. negative funding fee).
4. 4.
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
$I$
and
$M$
).
1. 1.
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 .
2. 2.
hedge your long position somewhere else.
3. 3.
Collect the funding earning of your short position.
4. 4.
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.

# Is trading on Deri Protocol risk-free?

Trading Margins & Contracts on Deri Protocol includes but is not limited to - a high level of risk, and may not be suitable for all kinds of investors. The enormous degree of leverage can work in favor of you as well as against you. Before making the decision to invest using Deri Protocol, you should carefully consider your level of experience, investment objectives and risk appetite. There is a possibility that you may lose part of your investment or all of your initial investment. You should be aware of all the risks associated with trading contracts and margin. Deri Protocol will not be responsible for any losses, damages or claims arising from events falling within the scope of the events mentioned above. We urgently advise you not to invest money that you cannot afford to lose and we also recommend you to seek advice from an independent financial adviser, If you have any questions or doubts!