Funding Payments

Periodic funding payments are the most common mechanism used by exchanges to do perpetual swaps. Funding payments act to converge the mark price (the price on Perpetual Protocol) and the index price (the average price from major exchanges).

Perpetual Protocol calculates funding payments every hour.

Find historical funding rates on Perpetual Protocol here.

Perpetual Protocol follows FTX's method to calculate the funding payments, which is done according to the formula below:

$fundingPayment = positionSize * fundingRate$

The fundingRate in the formula above is calculated by, firstly, subtracting the hourly time-weighted average price (TWAP) of the index price from the hourly TWAP of the mark price, and secondly, dividing the result from the previous step by 24.

$fundingRate = {TWAP_{perpetual} - TWAP_{index} \over 24}$

We use the price feed from Chainlink as the data source for the index price because it is currently the most battle-tested Oracle solution on the market. Other oracles will be added as needed.

If the fundingRate is positive, long position holders need to pay the funding payment while short position holders will receive the funding payment, and vice versa if the rate is negative.

The funding payment happens at the end of each hour on Perpetual Protocol.

Sound complicated? Let's take a look at another example.

Example

Similar to the example from the previous section, 100 ETH/USDC and 10,000 USDC are set as the initial state in our vAMM at launch. Both Alice and Bob use 100 USDC as the margin to open long positions with 2x leverage, one after the other. And right after Bob opens his position, Alice closes her long position and realizes a profit of 7.84012298 USDC.

 Action (Chronological) ETH/USDC (x) USDC (y) Mark Price *Calculation Initial State 100 10,000 100 ​ Alice gets 1.96 long position 98.0392156862745* 10,200 104.04 100*10,000/10,200 Bob gets 1.89 long position 96.1538461538461* 10,400 108.16 98.0392156862745*10,200/10,400 Alice closes her position 98.1146304675716 10,192.1598770177* 103.880123 96.1538461538461*10,400/98.1146305

If we draw a line chart with the mark price from each action above on the y-axis and each chronological action on the x-axis, below is what we'll get:

Supposing there isn't any action after Alice closing her position and now the time is close to the end of the hour in which all of those actions have happened.

We can imagine two distinct scenarios depending on the difference between the TWAP of the mark price and the TWAP of the index price.

TWAP of the Mark Price > TWAP of the Index Price (Positive Funding Rate)

In this scenario, the long position holders need to pay the funding payment whereas the short holders can receive the funding payment. Participants in our ecosystem will respond in different ways to this situation:

• Bob might want to close his position or part of his margin will be used to pay the funding payment

• Arbitrageurs might want to come in and open a short position so they can receive funding payment from the long position holders

TWAP of the Mark Price < TWAP of the Index Price (Negative Funding Rate)

In this scenario, the short position holders need to pay the funding payment whereas the long holders can receive the funding payment. Participants in our ecosystem will behave differently in this situation:

• Alice might feel frustrated because she could have received the funding payment if she didn't close her position

• Arbitrageurs might want to come in and open a long position so they can receive funding payment from the short position holders