# Funding Rate Structure

### **1. Conceptual Framework:**

* **Objective**: To ensure the mark price of OPZ-DEX perpetual contracts meticulously mirrors the underlying asset's spot price.
* **Core Mechanism**: Implement a funding exchange system where long and short position holders periodically settle payments, thereby aligning the perpetual contract price with the spot market price, exclusively tailored for OPZ-DEX users.

### **2. Funding Rate Components:**

* **Premium Index (P):** Reflects the difference between the perpetual contract price and the spot price.
* **Interest Rate Differential (I):** Accounts for the cost of capital considering different interest rates for base and quote currencies.

### **3. Premium Index Calculation (P):**

* **Formula:**$$P = \frac{\text{Mark Price} - \text{Spot Price}}{\text{Spot Price}}$$
* **Frequency:** Calculated every minute to ensure up-to-date data.
* **Mark Price Determination:** Use a Time-Weighted Average Price (TWAP) over the past 3 minutes to mitigate price manipulation.

### **4. Interest Rate Differential (I):**

* **Base:** Interest rate paid by open long or short perpetual positions based on the current market conditions.
* **Formula:** $$I=Base Rate−Quote Rate$$

### **5. Final Funding Rate Calculation (F):**

* **Formula:** $$F=P+I$$
* **Rate Limits:** Implement a strategic cap and floor for the funding rate to safeguard against extreme market volatility, ensuring a balanced trading environment.

### **6. Funding Interval:**

* **Interval Duration:** Payments are exchanged every 8 hours to align with industry standards and ensure predictability for traders.

### **7. Oracle and Price Data Feeds:**

* Decentralized Oracle network for robust and tamper-proof market data.
* Prices are aggregated from multiple reputable exchanges to calculate the Spot Price.
* The data feed mechanism is transparent and resistant to single points of failure.

### **8. Monitoring and Adjustment:**

* Continuously monitor the funding rate mechanism's performance and the market's response.
