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

# Funding

Funding rates are a mechanism to ensure that the price of a perpetual contract closely tracks that of its underlying spot market.

The funding rate is a periodic fee that is paid by open positions on one side of the contract (either long or short) to the other side. Crucially, this is peer-to-peer and the protocol does not collect any fees from this.

## Funding Rate Calculation

Every 3 seconds, Calabi calculates the premium of each market, which represents the deviation of the impact price from the oracle price for the corresponding market using the formula:

$$
premium_t = \frac{\max(0, \text{impact bid}_t - oracle_t) - \max(0, oracle_t - \text{impact ask}_t)}{oracle_t}
$$

where

* `impact_bid_t` / `impact_ask_t` are the VWAP execution prices for a fixed `impact_notional` walked against the bid/ask sides of the book at sample `t`
* `oracle_t` is the oracle price at that sample

#### Interest Rate Component

The interest rate is fixed at `0.01%` per 8-hour period (or `0.00125%` per hour), reflecting the relative cost of holding USD versus the underlying asset. It's blended against the realized premium and bounded by a clamp so it only matters near fair value:

$$
\text{funding rate}_\text{8h} = clamp( \text{interest rate} − \text{premium TWAP}, -c, +c )
$$

where `c` bounds the interest term's contribution and is equivalent to `±0.05%`

Funding fees are capped at `±3%` .


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.