# Funding Rate

### **Overview**

The **funding rate** is a mechanism used in perpetual contracts to keep their prices aligned with the spot market. Unlike traditional futures contracts, which converge to the spot price at expiration, **perpetual contracts have no expiration or delivery**. Instead, they use the **funding rate** to maintain price anchoring.

### **Funding Fee Settlement Rules**

* Funding is settled every 8 hours:
  * 00:00 GMT+8
  * 08:00 GMT+8
  * 16:00 GMT+8
* Only traders **holding a position at the time of settlement** are subject to funding fees.
* **Funding direction**:
  * If the funding rate F > 0:\
    Longs **pay** funding fees, and Shorts **receive**
  * If the funding rate F < 0:\
    Shorts **pay** funding fees, Longs **receive**

> The platform does **not charge** any funding fees. All fees are **peer-to-peer**.

#### **Funding Fee Calculation**

$$
\text{Funding Fee} = \text{Position Value} \times \text{Funding Rate}
$$

$$
\text{Position Value} = \text{Position Size} \times \text{Contract Size} \times \text{Mark Price}
$$

### **Funding Rate Components**

#### 1. **Composite Rate**

For a contract pair (e.g., BTC/USDT):

* Underlying asset: BTC
* Quote asset: USDT

$$
\text{Composite Rate} = \frac{r\_q - r\_u}{N}
$$

Where:

* r<sub>q</sub>​: Quote currency interest rate
* r<sub>u​</sub>: Underlying currency interest rate
* N: Number of funding settlements per day

**Example**:

$$
r\_q = 0.06%, \quad r\_u = 0.03%, \quad N = 3
$$

$$
\text{Composite Rate} = \frac{0.06% - 0.03%}{3} = 0.01%
$$

#### 2. **Funding Rate Basis Rate**

This reflects the decay of the funding impact over the settlement cycle:

$$
\text{Basis Rate} = F \times \left( \frac{t}{T} \right)
$$

Where:

* F: Funding rate of the current period
* t: Time remaining until next settlement (in minutes)
* T: Total duration of the funding cycle (480 minutes)

**Example**:

$$
F = 0.01%, \quad t = 450, \quad T = 480
$$

$$
\text{Basis Rate} = 0.01% \times \left( \frac{450}{480} \right) = 0.009375%
$$

#### 3. **Reasonable Price**

$$
\text{Reasonable Price} = P\_{\text{index}} \times (1 + \text{Basis Rate})
$$

**Example**:

$$
P\_{\text{index}} = 10,000, \quad \text{Basis Rate} = 0.005%
$$

$$
\text{Reasonable Price} = 10,000 \times (1 + 0.00005) = 10,000.5
$$

### **Depth-Weighted Prices**

Let:

* P<sub>b</sub>​: Depth-weighted bid price (buy orders)
* P<sub>a​</sub>: Depth-weighted ask price (sell orders)
* P<sub>r​</sub>: Reasonable price

### **Premium Index Calculation**

$$
\text{Premium Index} = \frac{\max(0, P\_b - P\_r) - \max(0, P\_r - P\_a)}{P\_{\text{index}}} + \text{Basis Rate}
$$

#### **Cases**:

1. If P<sub>a</sub> ≥ P<sub>r</sub> ≥ P<sub>b</sub>​, then:

Premium Index=Basis Rate\text{Premium Index} = \text{Basis Rate}Premium Index=Basis Rate

$$
\text{Premium Index} = \text{Basis Rate}
$$

2. If P<sub>b</sub> > P<sub>r</sub>​, then:

$$
\text{Premium Index} = \frac{P\_b - P\_r}{P\_{\text{index}}} + \text{Basis Rate}
$$

3. If P<sub>r</sub> > P<sub>a</sub>​, then:

$$
\text{Premium Index} = \frac{P\_a - P\_r}{P\_{\text{index}}} + \text{Basis Rate}
$$

### **Average Premium Index**

The **average premium index** at time ttt is the **arithmetic mean** of all premium index values from t - 60 minutes to t.

### **Final Funding Rate Formula**

The final **funding rate** is constrained within predefined bounds:

$$
F = \text{clamp} \left( \text{AvgPremium} + \text{clamp}(C - \text{AvgPremium}, D\_{\text{max}}, D\_{\text{min}}), F\_{\text{max}}, F\_{\text{min}} \right)
$$

Where:

* F: Final funding rate
* C: Composite rate
* D<sub>max</sub>, D<sub>min</sub>​: Premium deviation bounds
* F<sub>max</sub>, F<sub>min</sub>: Funding rate bounds

#### **Clamp Function**:

$$
\text{clamp}(x, \text{max}, \text{min}) = \begin{cases} \text{max}, & \text{if } x > \text{max} \ \text{min}, & \text{if } x < \text{min} \ x, & \text{otherwise} \end{cases}
$$
