Funding
What Are Funding Rates?
Funding rates are periodic payments exchanged between traders in perpetual futures markets to keep the contract price close to the spot price. They help balance long and short positions.
How Funding Works on Our Exchange
- Funding is calculated every hour.
- The interest rate is always 0.00125% per hour (i.e., 0.0000125 as a decimal, about 11.6% APR).
- Funding payments are made between longs and shorts depending on the funding rate sign.
How is the Average Premium Index Calculated?
The Average Premium Index is the average difference between the perpetual contract's market price and the index price over the last hour.
Every 5 seconds, both the market price and the index price are recorded.
The premium at each interval is calculated as:
textPremium = (Market Price - Index Price) / Index PriceThe Average Premium Index (P) is the average of all these premium values over the past hour (i.e., 720 samples per hour).
Maximum Funding Rate per Token
Each token/market on the exchange has a defined maximum funding rate. This cap ensures that funding payments do not become excessively high during periods of extreme market conditions.
- The maximum funding rate is set individually for each token.
- If the calculated funding rate exceeds the maximum for that token, it is capped at the token's maximum value.
- This protects traders from unusually large funding payments and helps maintain market stability.
Example:
For BTC-PERP, the maximum funding rate might be set to 0.005 per hour (0.5%).
Funding Rate Formula
Funding Rate (F) = Average Premium Index (P) + clamp(interest rate - Average Premium Index (P), -0.0005, 0.0005)| Symbol | Description |
|---|---|
| P | Average Premium Index (see above) |
| interest rate | Always 0.00125% per hour (0.0000125 as a decimal) |
| clamp(x, min, max) | Restricts x to be within the range [min, max] |
Example Calculation (Clamp Reduces Funding)
Suppose:
- Average Premium Index (P): 0.0015
- Interest rate: 0.0000125
Then:
interest rate - P = 0.0000125 - 0.0015 = -0.0014875clamp(-0.0014875, -0.0005, 0.0005) = -0.0005(since -0.0014875 < -0.0005)Funding Rate (F) = 0.0015 + (-0.0005) = 0.0010(or 0.10%)
Funding Checkpoint (Funding Accumulator)
To efficiently track funding payments without requiring every user to settle funding at every interval, our system uses a funding checkpoint (also called a funding accumulator):
- The funding checkpoint is a variable that accumulates the total funding USD value per lot over time.
- Every time a new funding rate is calculated (e.g., hourly), the funding per lot (in USD) is added to the global funding checkpoint.
- Each user's position stores its own checkpoint value from the last time funding was settled for that position.
- When a user interacts (trades, closes, or manually settles), the difference between the global checkpoint and the user's checkpoint is used to calculate the user's funding payment.
- This allows funding to be settled asynchronously and efficiently, without requiring every user to settle at every funding event.
Benefits
- Users can settle funding at any time, not just at funding intervals.
- Reduces on-chain computation and transaction costs.
- Ensures accurate and fair funding payments for all users.
Example: How Funding Checkpoint Accumulates Funding
Suppose:
- At hour 0, the global funding checkpoint is 0.
- At hour 1, the funding rate is 0.0010 (0.10%), and the funding per lot is 0.0010. The global checkpoint becomes 0.0010.
- At hour 2, the funding rate is 0.0008 (0.08%), and the funding per lot is 0.0008. The global checkpoint becomes 0.0010 + 0.0008 = 0.0018.
- At hour 3, the funding rate is 0.0012 (0.12%), and the funding per lot is 0.0012. The global checkpoint becomes 0.0018 + 0.0012 = 0.0030.
A user opens a position at hour 1. Their user funding checkpoint is 0.0010 (the global value at that time).
- At hour 3, the user closes their position. The global checkpoint is now 0.0030.
- The user's funding payment is
0.0030 - 0.0010 = 0.0020per lot.
This means the user pays (or receives) funding based on the accumulated funding since they opened their position, regardless of when they actually close or interact.
User Funding Checkpoint
Each user's position also stores its own user funding checkpoint. This value represents the global funding checkpoint at the time the user last settled funding (e.g., when opening a position, closing, or manually settling).
When a user interacts with their position, the system calculates the difference between the current global funding checkpoint and the user's funding checkpoint.
This difference represents the total accumulated funding (per lot) since the user last settled.
The user's funding payment (or receipt) is then:
textFunding Payment = (Global Funding Checkpoint - User Funding Checkpoint) × Position Size (in lots)After settlement, the user's funding checkpoint is updated to match the global funding checkpoint.
INFO
This mechanism ensures that each user only pays or receives funding for the period they actually held their position, regardless of when they choose to settle.
The funding checkpoint tracks the accumulated USD value per lot (not just the raw funding rate). This ensures funding is always settled in terms of actual value, regardless of price changes or lot size.
Why Funding Rates Matter
- If the funding rate is positive, longs pay shorts.
- If the funding rate is negative, shorts pay longs.
- This mechanism keeps the perpetual price in line with the spot price.