> ## Documentation Index
> Fetch the complete documentation index at: https://docs.derivadex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Funding Rate Logic

> How the DerivaDEX funding rate is calculated: average premium-rate input, a ±5 bps dead zone, a ±50 bps clamp, mark-price-based payments, and 8-hour settlement.

DerivaDEX funding is the periodic USDC transfer between longs and shorts that keeps a perpetual swap close to the index price.

## Funding rate inputs and limits

The funding rate starts from the average premium rate across the funding window, then applies a dead zone and a hard clamp.

| Parameter                |                                          Value | Notes                                                            |
| ------------------------ | ---------------------------------------------: | ---------------------------------------------------------------- |
| Funding input            | Average premium rate across the funding window | Computed from the recorded price checkpoints for the market      |
| Zero-band upper bound    |                             `0.0005` (`5` bps) | Positive average premiums inside the band settle to zero funding |
| Zero-band lower bound    |                           `-0.0005` (`-5` bps) | Negative average premiums inside the band settle to zero funding |
| Funding-rate upper bound |                             `0.005` (`50` bps) | Hard cap on one funding result                                   |
| Funding-rate lower bound |                           `-0.005` (`-50` bps) | Hard floor on one funding result                                 |
| Positive rate direction  |                               Longs pay shorts | Debited and credited in USDC                                     |
| Negative rate direction  |                               Shorts pay longs | Debited and credited in USDC                                     |

## Rate calculation

The dead zone removes the first `5` bps of premium on either side of zero. A premium inside that band produces zero funding.

```text theme={null}
average_premium_rate = average(premium_rate(checkpoint_1 ... checkpoint_n))

if -0.0005 <= average_premium_rate <= 0.0005:
  funding_rate = 0
else:
  funding_rate = clamp(average_premium_rate - sign(average_premium_rate) × 0.0005,
                       -0.005,
                       0.005)
```

| Average premium rate | Funding result |
| -------------------: | -------------: |
|             `0.0003` |            `0` |
|             `0.0009` |       `0.0004` |
|            `-0.0012` |      `-0.0007` |
|             `0.0090` |       `0.0050` |
|            `-0.0200` |      `-0.0050` |

## Funding payment

Funding is paid against the current **mark price** (the fair-risk price used for margin and liquidation) for each open position.

```text theme={null}
long_payment  = -funding_rate × position_size × mark_price
short_payment =  funding_rate × position_size × mark_price
```

| Position | Funding rate | Result      |
| -------- | -----------: | ----------- |
| Long     |     Positive | USDC debit  |
| Short    |     Positive | USDC credit |
| Long     |     Negative | USDC credit |
| Short    |     Negative | USDC debit  |

Funding payments are itemized by symbol, then applied to the strategy's USDC collateral balance. If the payment pushes a strategy underwater, liquidation can follow in the same settlement cycle.

## Worked payment cases

These examples show one funding event for one open position.

| Position         | Mark price | Funding rate | Payment                               |
| ---------------- | ---------: | -----------: | ------------------------------------- |
| Long `2` ETHP    |    `2,000` |     `0.0004` | `-1.6` USDC (`-0.0004 × 2 × 2,000`)   |
| Short `2` ETHP   |    `2,000` |     `0.0004` | `+1.6` USDC (`0.0004 × 2 × 2,000`)    |
| Long `1.5` ETHP  |    `2,000` |    `-0.0007` | `+2.1` USDC (`0.0007 × 1.5 × 2,000`)  |
| Short `1.5` ETHP |    `2,000` |    `-0.0007` | `-2.1` USDC (`-0.0007 × 1.5 × 2,000`) |

## When funding is applied

Funding applies at settlement boundaries rather than on every fill.

| Parameter                      |                    Value | Notes                                                                                                |
| ------------------------------ | -----------------------: | ---------------------------------------------------------------------------------------------------- |
| Funding cadence                |          Every `8` hours | The public baseline runs funding once per settlement epoch                                           |
| Applied to                     | Open perpetual positions | Closed positions do not pay or receive funding                                                       |
| Balance updated                |      Strategy collateral | Funding is a `STRATEGY_UPDATE` with reason `FundingPayment`                                          |
| Price input for payment        |               Mark price | See [Price Feeds and Mark Price Inputs](/reference-public/price-feeds-and-mark-price-inputs)         |
| Relationship to PnL settlement |          Separate action | Funding is distinct from periodic PnL realization even when both happen in the same settlement cycle |

These parameters are governance-controlled and may change through DAO proposals.

## Related references

* [Price Feeds and Mark Price Inputs](/reference-public/price-feeds-and-mark-price-inputs)
* [PnL Realization and Settlement](/reference-public/pnl-realization-and-settlement)
* [Product and Trading Specifications](/reference-public/product-and-trading-specifications)
* [Trade Mining Parameters](/reference-public/trade-mining-parameters)
* [Order and Account Event Reference](/reference-public/order-and-account-event-reference)
