> For the complete documentation index, see [llms.txt](https://docs.nexus.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexus.xyz/exchange/trading/perpetuals/funding-rates.md).

# Funding Rates

Funding rates are a core mechanism in perpetual futures markets designed to keep the price of the perpetual contract aligned with its underlying spot index. Funding will be computed and settled natively inside NexusCore.

### **How Funding Works**

Funding reflects the basis between the perpetual mid-price and the underlying index price:

* **Positive funding** → longs pay shorts
* **Negative funding** → shorts pay longs

Each market will display its current hourly funding rate at the top of the trading interface.

### **Implementation**

The Nexus Exchange funding mechanism will charge roughly every hour, with the calculation period spanning the full hour and settlement occurring at the end of each hour.

As the network progresses through mainnet phases, the cadence will become increasingly consistent.

### **Basis Calculation**

The system will calculate the basis (premium or discount) by comparing the market's mid-price (average of best bid and ask) with the underlying spot price provided by the oracle.

$$
\text{basis} = \frac{\text{mid\_price} - \text{spot\_price}}{\text{spot\_price}}
$$

These samples will be taken at fixed intervals to capture representative market conditions.

### **Rate Determination**

At the end of each hour, the collected basis measurements will be averaged to form the hourly rate.

For positive rates:

$$
\text{rate} = \min(\text{clamp}(\text{average\_basis}) + \text{baseline\_rate},\ \text{cap})
$$

For negative rates:

$$
\text{rate} = \max(\text{clamp}(\text{average\_basis}) + \text{baseline\_rate},\ -\text{cap})
$$

### **Settlement Logic**

Funding payments are exchanged between longs and shorts based on the final computed rate:

* Positive Funding (Market Trading Above Index)
  * Longs pay shorts proportional to position size, rate, and index price
* Negative Funding (Market Trading Below Index)
  * Shorts pay longs using the same proportional model

All settlements will occur atomically within the Core block processing the end-of-interval boundary.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nexus.xyz/exchange/trading/perpetuals/funding-rates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
