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

# Funding Rate

Funding rates are periodic payments exchanged between long and short position holders. They serve to keep the perpetual contract price anchored to the underlying spot price.

## Overview

* When the funding rate is **positive**, long positions pay short positions.
* When the funding rate is **negative**, short positions pay long positions.
* Funding is settled automatically — no action is required from the trader.

## Funding Interval

The default funding interval for most trading pairs is **4 hours** (every 4 hours), with settlement occurring at fixed intervals. Some assets may use a different interval (e.g., 1 hour for certain pairs). See [Supported Assets](/trading-rules/supported-assets.md) for per-pair details.

## Funding Rate Formula

The funding rate consists of two components: the **Interest Rate** and the **Premium Index**.

```
Funding Rate (F) = { Average Premium Index (P) + clamp[ Interest Rate (I) - Average Premium Index (P), 0.05%, -0.05% ] } / (8 / N)
```

Where:

* **I** (Interest Rate) = 0.01% (fixed, regardless of the funding interval).
* **N** = Funding interval in hours (e.g., 4 for a 4-hour interval, 1 for a 1-hour interval).
* **P** = Time-weighted Average Premium Index over the funding period.

### Funding Rate Cap

The funding rate is capped at **±2%** per interval for most crypto assets and **±0.375%** for commodity pairs (XAU, XAG).

## Premium Index

The Premium Index measures the deviation of the perpetual contract price from the Oracle Price.

```
Premium Index = [ Max(0, Impact Bid Price - Oracle Price) - Max(0, Oracle Price - Impact Ask Price) ] / Oracle Price
```

Where:

* **Impact Bid Price** = The average execution price to sell the "Impact Value" notional on the bid side of the order book.
* **Impact Ask Price** = The average execution price to buy the "Impact Value" notional on the ask side of the order book.
* **Impact Value** = 200 × Max Leverage for the pair (currently 20,000 USDC for most pairs).

### Time-Weighted Average

The Premium Index is sampled every 5 seconds. The Average Premium Index is computed as a time-weighted average where more recent samples carry greater weight:

```
Average Premium Index (P) = (P_1 × 1 + P_2 × 2 + ... + P_n × n) / (1 + 2 + ... + n)
```

For a 1-hour interval with 5-second sampling, n = 720. For a 4-hour interval, n = 2,880.

## Funding Fee Calculation

```
Funding Fee = Oracle Price × Position Size × Funding Rate
```

The funding fee is calculated at each settlement time based on your position size and the Oracle Price at that moment. Funding fees are automatically debited from or credited to your account balance.

## Example

Assume you hold a 1 BTC long position with Oracle Price at 100,000 USDC and the funding rate is +0.01%:

```
Funding Fee = 100,000 × 1 × 0.0001 = 10 USDC
```

Since the rate is positive and you are long, you pay 10 USDC. This amount is distributed to short position holders.


---

# 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:

```
GET https://docs.afx.xyz/trading-rules/funding-rate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
