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

# Funding Mechanism

## What is funding?

Funding is a common feature of perpetual trading. It consists of small, regular payments between traders with long and short positions. This mechanism keeps a perpetual contract’s price close to the asset’s spot price.

This encourages positions that bring the perpetual price in line with the index price.

Funding is paid automatically between traders. The funding rate is calculated every hour, and determines who pays and who receives:

* A **positive** funding rate means the perpetual trades above the index price. Traders with long positions pay traders with short positions.
* A **negative** funding rate means the perpetual trades below the index price. Traders with short positions pay traders with long positions.

## Why is funding important?

Perpetual contracts have no expiry date, unlike traditional derivatives. Without expiry, no natural mechanism aligns the contract price with the spot price. Large price divergences can cause instability. This makes the product less useful, trustworthy, and fair. When traders concentrate on either side, funding makes the majority trade more costly. This realigns the contract price with the spot price and prevents significant price deviations.

## How is funding calculated?

Rails calculates funding in three steps.

{% stepper %}
{% step %}

### Premium Calculation

In perpetual trading, premium measures the difference between executable perpetual-market prices and the index price. It uses impact prices, which reflect the average execution price for a fixed impact notional. This reduces the influence of small top-of-book orders. Rails calculates the premium every minute using this formula:

$$
\text{Premium} = \frac{\max\left(0, \text{Impact Bid Price} - \text{Index Price}\right) - \max\left(0, \text{Index Price} - \text{Impact Ask Price}\right)}{\text{Index Price}}
$$

Here, $$\text{Impact Bid Price}$$ is the average price to sell the [impact notional](/trading/perpetuals/perps-metrics-guide.md#impact-notional) into available bids. $$\text{Impact Ask Price}$$ is the average price to buy the impact notional from available asks. $$\text{Index Price}$$ comes from [Index Price](/trading/index-and-forward-price-sources.md) source data.

The premium is positive when the Impact Bid Price exceeds the Index Price. This means the perpetual trades above spot. It is negative when the Index Price exceeds the Impact Ask Price. This means the perpetual trades below spot. It is zero when the Index Price sits between the Impact Bid and Impact Ask prices. This is the normal case.
{% endstep %}

{% step %}

### Funding Rate Calculation

Rails calculates the funding rate every hour using the average premium from the previous hour. Rails settles funding payments every hour using that funding rate.

$$
\text{Funding Rate} = \operatorname{clamp}\left(\frac{\text{Average Premium}}{8} + \text{Interest Rate Component}, -0.005, +0.005\right)
$$

The funding rate is capped between minimum and maximum values. This prevents excessive funding payments. The parameters are:

<table><thead><tr><th width="151.77557373046875">Parameter</th><th width="106.2974853515625">Value</th><th>Description</th></tr></thead><tbody><tr><td>Time Factor (in hours)</td><td>8</td><td>Funding is calculated hourly. Dividing the average premium by 8 normalizes the hourly rate.</td></tr><tr><td>Interest Rate Component</td><td>0.00125%</td><td>A fixed hourly value added to the funding rate. It reflects the cost of holding a leveraged position, similar to interest on borrowed capital. It is added after the previous hour’s average premium is divided by 8.</td></tr><tr><td>Minimum Funding Rate</td><td>-0.5%</td><td>The lower bound on the funding rate.</td></tr><tr><td>Maximum Funding Rate</td><td>0.5%</td><td>The upper bound on the funding rate.</td></tr></tbody></table>
{% endstep %}

{% step %}

### Funding Value Calculation

Rails calculates and pays the funding value every hour. Funding payments are automatically credited or debited from your account. A positive Position Size represents a long position. A negative Position Size represents a short position.

$$
\text{Funding Payment} = \text{-Position Size} \times \text{Index Price} \times \text{Funding Rate}
$$

Funding rates use decimal fractions. For example, `0.0001` equals `0.01%`.

{% hint style="success" %}

#### Where to see funding on Rails

Rails shows your position's current funding in the [Trade Summary tab](/trading/perpetuals/overview.md#trade-summary-tabs) on the Perpetuals Trade page, and in your Perps Portfolio Overview, in the [Funding Tab](/manage-account/portfolio-statements-and-exports/portfolio-dashboard.md#funding-tab-perpetuals-only).
{% endhint %}
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**Still need help?** See our [troubleshooting tips](/support/troubleshooting-guide.md#trading).
{% endhint %}
