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

# Funding Rates

> How Decibel funding works at the protocol layer and in the current public product

Funding rates keep perpetual prices close to the underlying spot price. When perp trades above spot, longs pay shorts. When perp trades below spot, shorts pay longs.

At the protocol layer, Decibel supports two funding modes:

* **Continuous funding** when `fundingPeriodS = 0`
* **Periodic funding** when `fundingPeriodS > 0`

In the current public product, markets are presented with an hourly funding cadence in the UI and API responses.

## Protocol Modes

### Continuous Funding

Continuous funding updates the funding state as prices move, without waiting for a fixed settlement window. This is the protocol mode represented by `fundingPeriodS = 0`.

### Periodic Funding

Periodic funding uses a configured interval such as 1 hour. Funding still tracks the premium between perp and spot, but realization happens on a defined cadence instead of an every-update basis.

## Current Public Behavior

The current public Decibel product uses an hourly funding presentation:

* The market header shows a countdown to the next funding boundary
* UI APR displays annualize the hourly funding rate
* The API exposes `funding_period_s`, so clients can distinguish hourly and continuous modes

This page intentionally distinguishes between protocol capability and the current public network presentation. Do not assume every market on every deployment uses the same funding mode.

| Exchange          | Funding Interval |
| ----------------- | ---------------- |
| Binance           | 8 hours          |
| dYdX              | 8 hours          |
| HyperLiquid       | 1-4 hours        |
| Decibel public UI | 1 hour           |

## How Funding Is Calculated

Funding rate has two components:

```
Funding Rate = Premium Index + Interest Rate (clamped)
```

### Premium Index

The premium index measures how far the perp price deviates from the spot (oracle) price. It's calculated using impact bid/ask prices, which represent the price to trade a specific notional amount.

When perp > spot: Premium is positive, longs pay shorts
When perp \< spot: Premium is negative, shorts pay longs

### Interest Rate

The interest rate is a small constant (0.01% per 8 hours) that longs pay shorts when the premium is near zero. This component is clamped within a dead zone (±0.05%) so it doesn't dominate when premium is small.

## When Funding Is Realized

Funding affects your position over time and is realized through the protocol's funding mode for that market. In either mode, while your position is open:

* Accrued funding appears in your unrealized PnL
* It affects your account equity (and liquidation threshold)
* You don't pay or receive actual USDC

When you reduce or close your position:

* Funding is realized proportionally to the size reduction (e.g., closing half your position realizes half the accrued funding)
* A full close realizes all accrued funding
* Your USDC balance reflects the net amount

## Trader Implications

### For Long-Term Holders

If you hold a position through extended periods of high positive funding:

* Your unrealized PnL decreases over time
* You move closer to liquidation even if price doesn't change
* Consider the funding cost as part of your position sizing

### For Short-Term Traders

Funding mode changes how you think about timing:

* Continuous mode minimizes discrete settlement windows
* Periodic mode makes the configured interval visible and easier to monitor in the UI
* In both cases, funding should be treated as part of position cost and risk management

### Monitoring Funding

Track funding through:

* The trading interface shows current rate and accrued amount
* API endpoints provide historical rates
* WebSocket streams push real-time updates

## Technical Details

The system tracks funding through a Cumulative Funding Index (CFI). Each position stores the CFI at entry. Your accrued funding is:

```
Accrued Funding = Position Size × (Current CFI - Entry CFI)
```

The exact update path depends on whether the market is in continuous or periodic mode, but the same index-based accounting model applies:

```
CFI_new = CFI_prev + (Funding_Rate × Oracle_Price × Time_Elapsed)
```

This allows efficient funding calculation without iterating through every position.

## Related

<CardGroup cols={2}>
  <Card title="Margin" href="/for-traders/margin">
    How funding affects your equity
  </Card>

  <Card title="Liquidations" href="/for-traders/liquidations">
    Why monitoring funding matters for liquidation risk
  </Card>
</CardGroup>
