Funding periods are typically one to eight hours. Over that period the difference between the perpetual price and the underlying index price is measured every few seconds to a minute. Over the funding period previously sampled differentials imply an accrued funding. To correct for this exchanges can either pay out funding every time it is sampled if feasible or adjust for this basis. Let’s dig in.

## tl;dr

- This is only an issue when funding payments do not happen at a high frequency such as every minute or block.
- Basis adjustments create a more accurate representation of the index price by incorporating accrued funding.
- Funding rates are typically only paid out every one to eight hours. The rate used at the end of each funding period is the averaged observed rate.
- Premiums sampled earlier in a funding period create an implied payment that will be made at the end of a period. This makes one side of the market (long or short) more attractive as it will receive a payment from the other side.
- The result is a bias away from strict convergence.

The solution is to adjust the index price by the amount of accrued funding. **We recommend making different adjustments to the index price used for margin and liquidations, and the index price used for funding. Margining and liquidations should represent the true value of the contract, while funding should adjust the incentives to always target the underlying price level.**

Adjusting the index price used for margin and liquidations creates unrealised P&L for expected funding continuously which makes the funding framework much less sensitive to the length of the funding period.

# Capturing Intra-Period Previously Sampled Funding

The role of the funding rate is to incentivise trades that bring the perp market price closer to the underlying index price. This requires a subtle adjustment to account for accrued funding.

Consider the simple example of a market where the funding period is one day and the funding rate is sampled twice over that period, half way through and at the end.

To simplify, elements such as the interest rate component and dealing with impact prices are ignored in this example. These do not change the logic. The simplified funding rate formula is thus:

\(fundingRate = \frac{marketPrice-indexPrice}{indexPrice}\)and

\(fundingPayment = fundingRate \times positionSize = \frac{marketPrice-indexPrice}{indexPrice} \times positionSize\)Therefore in the example with two samples in each funding period:

\(fundingRate = \frac{1}{2} \frac{marketPrice_1 – indexPrice_1}{indexPrice_1} + \frac{1}{2} \frac{marketPrice_2 – indexPrice_2}{indexPrice_2}\)and

\(fundingPayment = \frac{1}{2} \frac{marketPrice_1 – indexPrice_1}{indexPrice_1} \times positionSize + \frac{1}{2} \frac{marketPrice_2 – indexPrice_2}{indexPrice_2} \times positionSize\)Half way through the day when the sample is taken imagine the market price is $101 and the index price is $100. Then for this funding period:

\(fundingRate = 0.5\% + \frac{1}{2} \frac{marketPrice_2 – indexPrice_2}{indexPrice_2}\)and

\(fundingPayment = 0.5\% \times positionSize + \frac{1}{2} \frac{marketPrice_2 – indexPrice_2}{indexPrice_2} \times positionSize\)At the end of the day longs are going to pay shorts 0.5% + half whatever the funding rate happens to be at the end of the period. This 0.5% has effectively already been earned.

Fast forward to the end of the day and funding period. Rational actors should be willing to put on short positions beyond the point where the markets are in line. They will receive the funding from the first half of the day and should be willing to give up some funding from the second half for that.

Ideally the index used to compute the funding rate should be increased to incentivise trades that would bring the perp market exactly in line with its underlying index. Because the funding accrued from the first half of

Generalising this logic to a funding period with *n* samples, if at some point *i* in the period, the average funding rate observed over the period so far is *r* then:

And therefore the impact of prices in the remaining funding rate period affect the final funding payment by:

\(r_j \times \frac{n-i}{n} \div fundingInterval \text{. Where rj is the funding rate observed over the remainder of the funding period.}\)In an ideal world the expected value of rj is zero. This is done by increasing the index price by the observed funding rate over the funding period so far weighted by the amount of time left in the funding period. Formally:

\(indexPriceFunding = indexPrice ( 1 + expectedFundingRate \times \frac{timeUntilFunding}{fundingInterval} )\)Where *expectedFundingRate *is the average funding rate observed in the current period so far.

When adjusted like this the index price used for funding is continuous and smooth while gradually incentivising convergence to the underlying index price rather than oscillations around it.

## Basis Adjustment for Margin and Liquidations

The fact that funding payment only happens at the end of a funding period does not change the fact that funding is constantly happening. To make the length of a funding period effectively arbitrary we recommend including accrued funding in the index price used for margin and liquidations.

This creates unrealised P&L for funding payments that have not been processed yet keeping portfolio values in line with their true value. Doing this reduces the risk of highly leveraged accounts creating bad debts as a result of a funding payment.

Adding this amount to the market price incorporates the rational behaviour of arbitrageurs described above. If we define the *expectedFundingRate *as the average funding rate over the funding interval to date then the specific adjustment is:

Basis adjustments are mathematically equivalent to making actual funding payments each sampling period without the burden of actually processing payments each time. On typical exchanges where funding is sampled every 1 to 5 minutes this improves the user experience significantly.

# Conclusion

To most accurately measure the value of a perpetual contract, the index price used for margining and liquidations should be adjusted by accrued funding.

The index used for funding rates however should be left as the price of the underlying index. This creates the most likely conditions for unbiased funding premiums and empowers the funding interest rate to do its job.