---
# System prepended metadata

title: Funding rate and skew formula

---

## Kwenta
- LV denotes the volume of long positions
- SV denotes the volume of short positions
- s denotes the skew and is defined as `s = LV - SV`
- f denotes the funding rate and is calculated as `df = dr/dt = c*skew`, normally we consider df as a daily rate (see example) where c is the constant factor, which in kwenta is set to 0.000003
- In practice it works as follows, consider the following example
- At hour 0:
    - LV = 300 ETH
    - SV = 150 ETH
    - s = LV - SV = 300 - 150 = 150
- At hour 10:
    - LV = 500 ETH (this increases the skew, which in turn also the funding rate but more slowly)
    - SV = 150 ETH
    - s = LV - SV = 500 - 150 = 350
- At hour 15
    - LV = 500 ETH
    - SV = 300 ETH 
    - s = 200 
- From hour 0 to hour 10:
    - df = 0.000003 * s = 0.000003 * 150 = 0.00045, which is 0.045% per day
    - Suppose that funding rate starts at 0
    - funding rate at hour 10 is then 0 + 0.00045/24 * 10 = 0.0001875 (increasing linearly until hour 10)
- From hour 10 to hour 15
    - df = 0.000003 * s = 0.000003 * 350 = 0.00105 
    - funding rate at hour 15 is then 0.0001875 + 0.00105/24*5 = 0.00028125
- Now each user will pay/receive the funding as positionValue * funding rate
- On kwenta this funding is paid out per hour

## GMX
- Funding fees for the larger side is calculated as `(funding factor per second) * (open interest imbalance) ^ (funding exponent factor) / (total open interest)`.

- For example if the funding factor per second is 1 / 50,000, and the funding exponent factor is 1, and the long open interest is 150,000 USD and the short open interest is 50,000 USD then the funding fee per second for longs would be `(1 / 50,000) * 100,000 / 200,000 => 0.00001 => 0.001%`.

- The funding fee per second for shorts would be `-0.00001 * 150,000 / 50,000 => 0.00003 => -0.003%`.

- It is also possible to set a stableFundingFactor, this would result in the specified funding factor being used instead of the dynamic funding factor.

## dYdX
- F denotes the funding rate
- 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`
    - 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)

- 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.
- 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). 
- 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.
