Funding Fees
The funding fee is a mechanism designed to promote balance between long and short positions. The core logic is that the side with a larger position (Whether long or short) pays funding fees to the side with a smaller position, incentivizing market equilibrium.
1. Dynamic Adjustment Rules for Funding Rate
- Funding rate is dynamically adjusted based on the long-short OI ratio over time:
- If the long position size exceeds the short position size, the funding rate paid by the long side to the short side gradually increases. This continues until falls below a set threshold or the funding rate reaches its upper limit.
- If more short positions are opened or long positions are closed, causing the short position size to exceed the long position size, the funding rate paid by the long side decreases until the long-short difference is below the threshold.
- If the short position size exceeds the long position size, the funding rate adjusts in reverse, requiring the short side to pay funding fees to the long side until the long-short difference returns to the balanced range.
2. Funding Fee Calculation Formula
- Position Difference Calculation:
- LongOI: Total long position size (in USD).
- ShortOI: Total short position size (in USD).
- TotalOI: Total position size (LongOI + ShortOI).
- Funding Rate Per Second:
- FundingFeeBaseRate: The base funding fee rate, fixed at 0.00000001, corresponding to an APR of 31%.
- Direction of Funding Fee Payment:
- If , the long side pays the short side.
- If , the short side pays the long side.
- Periodic Funding Fee:
F: funding exponent factor, default value is 1. When the OI deviation exceeds 80%, the funding exponent factor will increase in proportion to the excess.
- Delta Calculation for Per-Quantity Funding Fee:
If
If
- Updating Delta in the Market:
3. Funding rate Updates and Funding fees Collection
- The fundingTokenAmountPerQty of the current market is updated whenever any user opens or closes a position, based on the funding fee calculation formula.
Scenario 1: Collecting the First Funding Fee Upon Opening a Position
- Trigger Condition: A user opens a position using an increased order.
- Action:
- The system records the initial at the time of opening.
Scenario 2: Dynamic Funding Rate Calculation During The Holding Period
-
Trigger Condition: Users hold positions, and funding rates dynamically adjust with market changes.
-
Action:
- The system calculates unrealized funding fees (unrealisedFundingUSD) using the formula:
-
User Perspective:
Upon closing a position, the system settles all unrealized funding fees in a one-time operation and proportionally reflects them in the position history. Users can clearly see the final funding fee expenditure.
4. Examples
- Long Pays Short Example:
- Long Position Size: $150,000
- Short Position Size: $50,000
- Base Funding Fee Rate: 0.00000001
- Time Interval: 60 seconds
- Funding Exponent Factor: 1
- Currency: USDC
- Currency Price: $1
Calculation:
- Short Pays Long Example:
- Long Position Size: $50,000
- Short Position Size: $150,000
- Base Funding Fee Rate: 0.00000001
- Time Interval: 60 seconds
- Funding Exponent Factor: 1
- Currency: USDC
- Currency Price: $1
Calculation:
- Long and short reversal positions:
t0:
- Long Position Size: $150,000
- Short Position Size: $50,000
- Base Funding Rate: 0.00000001
- Time Interval: 60 seconds
- Funding Exponent Factor: 1
- Currency: USDC
- Currency Price: $1
Calculation:
t1:
After User Adds $200,000 to Short Position
- Long Position Size: $150,000
- Short Position Size: $250,000
- Base Funding Rate: 0.00000001
- Time Interval: 60 seconds
- Funding Exponent Factor: 1
- Currency: USDC
- Currency Price: $1
Calculation: