Perpetual contracts are inspired by traditional futures contracts, but differ in that there is no expiry date and therefore no final settlement or delivery. Funding payments are therefore used to incentivize the price of the perpetual to trade at the price of the underlying.

Funding is calculated algorithmically based on the **Index Price** and sampled **Mid-Market Prices** for the perpetual. When the rate is positive (perpetual trades at a premium relative to index), traders who are long will make payments to traders who are short. When the rate is negative (perpetual trades at a discount relative to index), this is reversed and shorts will pay longs. Traders make or receive payments in proportion to the size of their market position. These payments are exchanged solely between traders, and are neither paid nor received by the exchange.

The purpose of the funding rate is to keep the price of each perpetual market trading close to its **Index Price**. When the price is too high, longs pay shorts, incentivizing more traders to sell / go short, and driving the price down. When the price is too low, shorts pay longs, incentivizing more traders to buy / go long, driving the price up.

Funding payments can be found by calling Get /v3/funding and the predicted funding rate can be found by calling Get v3/markets. Historical funding rates can be found by calling Get v3/historical-funding.

## Funding Interval

Funding payments are exchanged between long and short traders to encourage the price of a perpetual contract to trade close to the price of the underlying. Funding payments are made in USD (USDC). The payments are credited or debited at the **start of each hour**, and are included in the **Realized PNL** for the position. Thus, the dYdX funding rate is usually represented as a 1-hour rate, which represents the return a position may expect to earn or pay every hour.

When calculating the funding rate, the premium is scaled to have a realization period of 8 hours. That means, for example, that if a certain perpetual market trades consistently at a 0.1% premium relative to the underlying, long traders may expect to pay ~0.1% every 8 hours, and short traders may expect to earn a ~0.1% return every 8 hours (not accounting for the interest rate component).

## Funding Payment Calculation

At the start of each hour, an account receives USDC (if `F`

is positive) or pays USDC (if `F`

is negative) in an amount equal to:

F = (-1) × S × P × R

Where:

`S`

is the size of the position (positive if long, negative if short)`P`

is the oracle (index) price for the market`R`

is the funding rate (as a 1-hour rate)

## Funding Rate Calculation

The main component of the funding rate is a premium that takes into account market activity for the perpetual. It is calculated for each market, every minute (at a random point within the minute) using the formula:

Premium = (Max(0, Impact Bid Price - Index Price) - Max(0, Index Price - Impact Ask Price)) / Index Price

Where the impact bid and impact ask prices are defined as:

Impact Bid Price = Average execution price for a market sell of the impact notional value

Impact Ask Price = Average execution price for a market buy of the impact notional value

And the impact notional amount for a market is:

Impact Notional Amount = 500 USDC / Initial Margin Fraction

For example, at a 10% initial margin fraction, the impact notional value is 5,000 USDC.

At the end of each hour, the 1-hour premium is calculated as the simple average (i.e. TWAP) of the 60 premiums calculated over the course of the last hour. In addition to the premium component, each market has a fixed interest rate component that aims to account for the difference in interest rates of the base and quote currencies. The funding rate is then:

Funding Rate = (Premium Component / 8) + Interest Rate Component

Currently, the interest rate component for all dYdX markets is `0.00125%`

(equivalent to `0.01%`

per 8 hours). For markets with no interest rate component, the funding rate is simply the one-hour premium.

## Index Price for Funding

Funding payments based on funding rate calculations make use of an index price given by a relevant oracle for the asset (see contract specs for more detail on the index price inputs for each asset).

## Funding Rate Bounding

The minimum funding rate is -4.00% and the maximum funding rate is 4.00%. There is a limit to how quickly the admin can change the funding rate, but this does not take effect during normal operation.

## See Below for a Video Explaining the Above

You can read more about our authors here.