# Funding

A perpetual has no expiry, so **funding** is the mechanism that keeps its price tethered to the underlying spot (index) price. It is a payment exchanged **directly between traders**. The protocol takes no cut.

## Which way it flows

![Funding direction: longs pay shorts when the perp trades above index, shorts pay longs when below](/docs/perps/images/funding-direction.png)

Funding direction depends on whether the perpetual is trading above or below the index price:

| Market condition           | Who pays             | Why                                                 |
| -------------------------- | -------------------- | --------------------------------------------------- |
| Perp price **above** index | **Longs pay shorts** | Long demand is high, so holding a long costs more   |
| Perp price **below** index | **Shorts pay longs** | Short demand is high, so holding a short costs more |

So funding is not always a cost: the side leaning *against* the crowd tends to **receive** it. If you hold no position, funding does not affect you.

## When it settles

Funding does **not** debit or credit your position margin on a fixed hourly schedule. It accrues to your position and is banked into your margin only when the position's size changes, you change leverage, or the position is liquidated:

* **The market's funding accrues every hour.** Each hour the funding rate advances a market-wide funding index; your position accrues funding against it in proportion to its **size** and **side**.
* **In between, it is unrealized funding.** The accrued-but-not-yet-banked amount is your **unrealized funding**. Like unrealized PnL it is **part of your equity**, so it moves you toward or away from liquidation continuously (see [Liquidation](/docs/perps/mechanics/liquidation)).
* **It is realized into your margin when the position changes**: when you increase, decrease, or close it, change its leverage, or it is liquidated. The accrued amount is then added to or subtracted from your margin and the accrual resets.
* Funding is commonly **quoted on an 8-hour basis** by convention; on Elysia Perps the quoted rate is converted to the hourly amount that is actually applied.

So a position you never touch banks nothing into its margin, yet its **unrealized funding still drifts its equity** the whole time: positive when funding is in your favor (you receive it), negative when it is against you (you pay). This is the drift noted in [Positions](/docs/perps/trading/positions).

## How the rate is set

The rate has two parts:

* **Premium**: how far the perpetual is trading from the index, measured against realistic fill prices (order-book depth), sampled **once a minute** and averaged over the hour.
* **Interest rate**: a small baseline component.

The combined rate is **clamped** to a capped range so a single volatile moment cannot produce an extreme funding charge. The detailed formula lives in the protocol's funding policy and is not needed for everyday trading.

> The settlement interval, quote convention, and clamp range are platform-wide settings today; the interest-rate baseline is set per market. On Elysia Perps, funding accrues hourly. As with every parameter, the module's direction is for a market to configure these itself.

## Where to go next

* How funding interacts with position margin: [Positions](/docs/perps/trading/positions).
* The price funding is measured against: [Mark & Oracle Price](/docs/perps/mechanics/mark-and-oracle).
