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

# Funding

Funding fees are periodic payments exchanged between long and short positions to keep the perpetual contract price anchored to the spot market.

### Overview

<table><thead><tr><th width="191.85546875">Aspect</th><th width="516.8984375">Detail</th></tr></thead><tbody><tr><td>Settlement Frequency</td><td>Every 1, 4, or 8 hours (depends on the specific contract)</td></tr><tr><td>Who Pays Whom</td><td>Determined by the funding rate at settlement time</td></tr><tr><td>Eligibility</td><td>Only traders holding positions at the exact settlement timestamp pay or receive funding</td></tr></tbody></table>

<table><thead><tr><th width="202.8125">Funding rate</th><th width="264.375">Long Positions</th><th width="277.39453125">Short Positions</th></tr></thead><tbody><tr><td><strong>Positive</strong> (perp > spot)</td><td>Pay funding to shorts</td><td>Receive funding from longs</td></tr><tr><td><strong>Negative</strong> (perp &#x3C; spot)</td><td>Receive funding from shorts</td><td>Pay funding to longs</td></tr></tbody></table>

{% hint style="info" %}
When the perp trades above spot (positive funding), longs pay shorts to incentivize more short selling and pull the price back down. The inverse applies for negative funding.
{% endhint %}

### Funding payment calculation

```
Funding Payments = Position Size * Mark Price * Funding Rate
```

Where:

* `Position Size` = Absolute size in base asset (e.g., BTC, ETH)
* `Mark Price` = Fair value at settlement time (see [Mark Price](/perp/mark-price-and-oracle-price.md))
* `Funding Rate` = Rate at settlement time (see below)

**Sign convention:**

* Positive payment = You pay (debited from margin)
* Negative payment = You receive (credited to margin)

### Funding rate calculation

```
Funding Rate = clamp (F, max, min)
```

Where `clamp()` limits the result to prevent extreme values during volatile periods.

#### Base Funding Rate (F)

```
F = P + clamp (I - P, 0.05%, −0.05%)
```

Where:

* `P` = Average Premium Index
* `I` = Interest Rate

#### Average Premium Index (P)

The Premium Index measures how much TxFlow's perpetual price deviates from the Oracle Price. It is sampled every 5 seconds over an 8-hour window (5,760 samples total):

```
P = Time-Weighted Average of Premium Index over 8 hours
```

Each sample:

```
Premium Index = (Impact Mid Price − Oracle Price) ÷ Oracle Price
```

```
Impact Mid Price = (Impact Bid Price+Impact Ask Price) ÷ 2
```

* **Impact Bid Price** = average price to sell the Impact Margin Notional (execute against bids)
* **Impact Ask Price** = average price to buy the Impact Margin Notional (execute against asks)
* **Impact Margin Notional (IMN)** = `$200 × Max Leverage (Tier 1)`

#### Interest Rate (I)

The Interest Rate represents the cost-of-carry differential between USD and the crypto asset.

```
I = 0.01% per 8-hour period (annualized: ~10.95%)
```

This rate is fixed and reflects standard funding practices on major CEXs.

#### Funding Rate Caps

<table><thead><tr><th width="112.12890625">Cap</th><th width="209.3359375">Value</th><th width="592.44140625">Purpose</th></tr></thead><tbody><tr><td>Maximum</td><td>+0.05% per 8 hours</td><td>Prevents excessive costs during extreme bullish sentiment</td></tr><tr><td>Minimum</td><td>-0.05% per 8 hours</td><td>Prevents excessive costs during extreme bearish sentiment</td></tr></tbody></table>

**Example:** If calculated `F = 0.08%`, the actual funding rate applied is capped at `0.05%`.

### Related Pages

<table><thead><tr><th width="247.296875">Pages</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/lWdZgI2P4YIODQ7uazsl">Mark Price and Oracle Price</a></td><td>Calculation of Mark Price and Oracle Price</td></tr></tbody></table>


---

# 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.txflow.com/perp/funding.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.
