> For the complete documentation index, see [llms.txt](https://docs.reya.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reya.xyz/developers/devnet/pricing-and-funding/funding.md).

# Funding

Perpetual funding keeps the order book trading near the index price. Reya recalculates the funding rate every **5 seconds** and accrues funding continuously into position PnL.

## How the funding rate is computed

```
premium   = (reference − index) / index
rate_8h   = premium + clamp( interestRate_8h − premium, ±interestClamp )
dailyRate = clamp( rate_8h × 3, ±dailyRateCap )
```

* **`reference`** — the composite [impact price](/developers/devnet/pricing-and-funding/mark-price.md) when available, or the Stork CEX-mark feed when the composite impact price is unavailable because the book is too thin or EMA-VWAP has not yet been primed by a trade.
* **`premium`** — how far the book trades from the index, as a fraction of the index.
* **`interestRate_8h`** — a fixed per-8h interest term. When the premium is small the interest term dominates; when the premium is large the `clamp` absorbs the interest term.
* **`dailyRate`** — the on-chain convention is a **daily** rate (`rate_8h × 3`), bounded by `dailyRateCap`.

**Sign:** `dailyRate > 0` ⇒ **longs pay shorts**; `dailyRate < 0` ⇒ shorts pay longs.

The rate is recomputed from the current book and index every 5 seconds, with no time-weighted averaging.

### Worked-example parameters

| Parameter          | Value                                               |
| ------------------ | --------------------------------------------------- |
| `interestRate_8h`  | 0.01% (`0.0001`)                                    |
| `interestClamp`    | ±0.05% (`0.0005`)                                   |
| `dailyRateCap`     | 96% / day (`0.96`) — a safety bound, rarely binding |
| Recompute interval | 5 s                                                 |

These values illustrate the calculation below; they are not a live parameter feed or defaults for every market. API 3.4.0 does not expose the configured interest term, clamp or daily cap. Read the current `fundingRate` from `GET /v2/perpMarket/{symbol}/summary` or the market-summary WebSocket channel; see [public configuration and live values](/developers/devnet/reference/markets-and-assets.md#public-configuration-and-live-values). Use the reported rate for your integration rather than recomputing it from this example. The API rate's hourly percentage units are explained below.

## How funding is charged

Funding uses a capped daily rate and accrues per side as:

```
fundingValueDelta = dailyRate × markPrice × elapsedDays × baseMultiplier
```

Your position's share is folded into its **realised PnL** on every position update — there is no separate funding transfer to track. Note that funding accrues against the **mark price**, not the index.

## Funding freshness and outages

Reya checks funding-rate freshness before allowing new trades.

**Stale funding pauses new trading — not your positions.** Each market has a staleness window (a small multiple of the 5 s push cadence). If no fresh funding rate arrives within that window, opening or changing a position is temporarily rejected until a new rate is pushed. Liquidations and auto-deleveraging keep working throughout, and viewing margin, adding collateral, and withdrawing are unaffected.

**An outage is never charged retroactively.** Funding accrues on-chain from the timestamp of the last pushed rate, so a gap in pushes does not silently accumulate. When pushes resume, the market charges **at most one staleness window** of funding — a short, bounded amount — at the newly-pushed rate, and **forgives the rest of the gap**. There is no backfill or catch-up charge for the missed period. This is a fixed, pre-committed policy: the on-chain outcome is final and is **not** reconciled or adjusted off-chain afterwards.

## Worked example

ETH index = **$3,000**, book reference (impact) price = **$3,030** — the book is trading 1% rich:

* `premium = ($3,030 − $3,000) / $3,000 = +1.00%`
* `interestRate_8h − premium = 0.01% − 1.00% = −0.99%`, clamped to **±0.05%** → **−0.05%**
* `rate_8h = 1.00% + (−0.05%) = 0.95%`
* `dailyRate = 0.95% × 3 = 2.85% / day` (well inside the 96%/day cap)

Because `dailyRate > 0`, **longs pay shorts**. Holding a 10 ETH long (\~$30,000 notional) for one hour at this rate accrues ≈ `$30,000 × 2.85% ÷ 24 ≈ $35.6` paid (illustrative — the rate is recomputed every 5 s, so it varies over the hour).

## What the API reports

Funding-rate history is not yet available for integration. See [Under Development](/developers/devnet/under-development/whats-next.md#funding-rate-history).

The mechanism above works in a **daily** rate, but the off-chain API normalises what it returns. The `fundingRate` value in market data is an **hourly** rate, **already expressed as a percentage** — the service takes the on-chain daily rate, divides by 24, and multiplies by 100 (`fundingRate = dailyRate ÷ 24 × 100`). So the `2.85% / day` from the worked example above surfaces as a `fundingRate` of `≈ 0.119` (i.e. ≈ 0.119% per hour); multiply by 24 to recover the daily percentage used in the accrual formula.
