# Funding Fee Mechanism Explained

The **Funding Fee** in YUBIT perpetual contracts is a mechanism that helps keep contract prices anchored to the spot market price. It is **not charged by the platform**, but rather a cost exchange **settled directly between users holding positions**.

***

#### 1. Purpose of Funding Fees

* To adjust and minimize the difference between perpetual contract prices and spot market prices.
* When the funding rate is **positive**: **longs pay shorts**.
* When the funding rate is **negative**: **shorts pay longs**.
* Only users holding positions **at the settlement time** are subject to funding fees. Closing your position beforehand means no funding is charged.

***

#### 2. Settlement Cycle and Timing

Funding settlement frequency may vary by contract:

* Commonly every **8 hours** (e.g., 08:00, 16:00, 24:00 HKT)
* Some contracts settle every **4 hours**

⚠️ Note: Settlement does not always occur at the exact hour mark. It is triggered automatically within a short window around the scheduled time.

***

#### 3. Funding Fee Calculation

**Formula:**\
Funding Fee = Position Value × Current Funding Rate

**Funding Rate Calculation:**\
Funding Rate = Clamp( MA( (Bid1 + Ask1)/2 – Spot Index Price ) / Spot Index Price – Interest, a, b )

* **Interest** is currently set to 0.
* **Clamp(a, b)** restricts the rate within the range \[a, b].
* **MA** represents a moving average function.

***

#### 4. Funding Fee Deduction Rules

**Cross Margin Mode**

* Deducted directly from **available cross margin balance**.
* If balance is insufficient, the system cancels all related orders (spot, cross, isolated).
* Deduction stops once balance reaches **maintenance margin + closing fee**.

**Isolated Margin Mode**

* First deducted from **available transferable balance** in cross margin.
* If insufficient, related isolated orders are cancelled.
* Final deduction comes from the isolated margin until it reaches **maintenance margin + closing fee**.

**Practical Limitation**

* The actual funding you receive depends on the counterparty’s ability to pay.
* YUBIT does **not** take any funding fees. It is purely a **peer-to-peer transfer**.

***

#### 5. Multiple Positions – Deduction Priority

If you hold multiple contracts across different tokens (within a single-asset or cross-asset margin account), the system deducts fees in a preset priority order until your margin balance reaches an acceptable level.

***

#### 6. Important Notes

* If a contract is delisted before the settlement time, no funding fee will be charged or received for that period.
* The funding fee mechanism is designed to stabilize the market and reduce price deviations.
* ⚠️ Funding fees are **not a guarantee of profit**.
