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

# Funding

Funding rates are periodic payments between long and short position holders. They keep perpetual futures prices aligned with the underlying spot price by incentivizing the less popular side.

## Overview

* **Positive funding rate**: Longs pay shorts. This happens when there is more long open interest than short (market is skewed long).
* **Negative funding rate**: Shorts pay longs. This happens when there is more short open interest than long (market is skewed short).
* **Zero rate**: No payment. Open interest is balanced.

Funding is peer-to-peer. The protocol does not collect funding payments.

## Funding rate calculation

The funding rate is based on the imbalance between long and short open interest:

```
Funding Rate = (Long OI - Short OI) / Total OI x Max Funding Rate
```

Where:

* `Long OI` and `Short OI` are the total long and short open interest in the market
* `Total OI = Long OI + Short OI`
* `Max Funding Rate = 0.75%` per 8-hour interval

The rate is capped at 0.75% per 8-hour interval in either direction.

### Example

* Long OI: 100 TAO, Short OI: 60 TAO, Total OI: 160 TAO
* Skew: (100 - 60) / 160 = 0.25
* Funding Rate: 0.25 x 0.75% = 0.1875% per 8 hours
* Longs pay shorts at this rate

## Payment timing

Funding accrues continuously while a position is open. The accumulated funding is applied when the position is modified or closed.

The rate displayed is the 8-hour rate. The actual cost depends on how long you hold:

```
Funding Payment = Position Notional x Oracle Price x Funding Rate x (Time Held / 8 hours)
```

Maximum accumulation is capped at 32 hours (4 funding intervals). If funding hasn't been updated for longer than that, only the last 32 hours count.

## Interest fee

Separate from the directional funding rate, an interest fee is charged to **both** long and short positions based on vault utilization. This compensates vault depositors for capital at risk.

```
Interest Rate = 20% x utilization^2 + 0.01%
```

Where `utilization = total mark-to-market exposure / available reserves`. The interest rate is capped at 80%.

Unlike funding, interest is always a cost to the position holder regardless of direction.

## Impact on P\&L

Both funding and interest reduce your margin over time:

```
Net P&L = Price P&L - Funding Paid + Funding Received - Interest Paid - Trading Fees
```

For long-held positions, funding and interest can become significant costs. Check the current rates on each market before opening a position.


---

# 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.megatao.com/trading/funding.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.
