> 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

## What is Funding?

Funding is a common feature of perpetual trading. It entails small, regular payments exchanged between traders with long and short positions. This mechanism helps keep the perpetual contract's price close to the asset's real market (spot) price.&#x20;

A funding rate is calculated at regular intervals. The sign of the funding rate tells our system which side is “over-represented” or “under-represented”. When the rate is below zero, it means the contract is trading below the index price; shorts are effectively being subsidized to hold their position and must pay the funding fee to longs.

{% hint style="info" %}
If the funding rate is **positive**, traders holding **long** positions pay those holding **short** positions.

If the funding rate is **negative**, traders holding **short** positions pay those holding **long** positions.&#x20;
{% endhint %}

## Why is Funding Important?

Perpetual contracts, unlike traditional derivatives, have no expiry date. Without expiration, there is no natural mechanism to force the contract price to align to the spot price. If the prices diverge too far, it can cause instability, making the product less useful, trustworthy and fair for users. When there is a large number of traders on either the long or short side, funding realigns the contract price with the spot price by making it more costly to remain in the majority trade. This stabilizes the market by preventing significant price deviations.&#x20;

## How is Funding Calculated?

Funding at Rails is a 3-step process as described below.&#x20;

{% stepper %}
{% step %}

### Premium Calculation

In financial trading, "premium" gauges the difference between long and short positions in a perpetual contract. It indicates the deviation of the perpetual contract's price from the spot index. Calculated every minute, the premium utilizes this formula:

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

Where $$\text{Rails Bid Price}$$ is the entry price of your trade and $$\text{CCData Index Price}$$ is pulled from our [Index Price](/trading/index-price-sources.md) source data.
{% endstep %}

{% step %}

### Funding Rate Calculation

The funding rate is determined hourly, using the 1-hour average premium. This average is computed from 60 individual premiums, calculated each minute as outlined in Step 1.

$$
\text{Funding Rate} =  \frac{\text{Average Premium}}{\text{Time Factor}} + \text{Interest Rate Component}
$$

To prevent excessively high or negative funding payments, the funding rate is capped between a maximum and minimum funding rate. All parameters are defined here:

<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>1</td><td>This normalization factor adjusts the funding rate to match the time interval between funding payments (i.e. 1 hour), ensuring traders are charged or credited fairly for the actual period their positions are open.</td></tr><tr><td>Interest Rate Component</td><td>0.00125%</td><td>A fixed value added to the funding rate to reflect the cost of holding a leveraged position, similar to paying interest on borrowed capital. </td></tr><tr><td>Minimum Funding Rate</td><td>-0.04</td><td>This is the minimum funding rate value to prevent excessively negative funding rates.</td></tr><tr><td>Maximum Funding Rate</td><td>0.04</td><td>This upper bound is used to cap high funding rates. </td></tr></tbody></table>
{% endstep %}

{% step %}

### Funding Value Calculation

The funding value is calculated hourly when the funding rate updates. Payments are instantly credited to your account after calculation. A negative Position Size is used for Short positions.&#x20;

$$
\text{Funding Value (Short)} = -1 \times \text{Position Size} \times \text{CCData Index Price} \times \frac{\text{Funding Rate}}{100}
$$

$$
\text{Funding Value(Long)} =  \text{Position Size} \times \text{CCData Index Price} \times \frac{\text{Funding Rate}}{100}
$$
{% endstep %}
{% endstepper %}

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


---

# 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://help.rails.xyz/trading/perpetuals/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.
