TradingFunding

Funding

Funding rates are the mechanism that anchors perpetual contract prices to the underlying spot price. When the perpetual trades at a premium to spot, longs pay shorts; when at a discount, shorts pay longs.

Funding Rate Parameters

ParameterValue
Base interest rate0.01% per 8 hours (11.6% APR)
Settlement frequencyEvery hour (1/8 of the 8-hour rate)
Maximum rate (per 8h)0.10% (10 bps)
Maximum rate (per hour)4%
Premium sampling intervalEvery 5 seconds
Premium clamp range-0.05% to +0.05%

Funding Rate Formula

The funding rate for each 8-hour interval is:

premium = (mark_price - index_price) / index_price
funding_rate = clamp(premium, -0.10%, +0.10%)

In integer arithmetic (basis points):

rate_bps = clamp((mark_price - index_price) * 10,000 / index_price, -10, +10)

Premium Sampling

The premium is not computed from a single snapshot. Instead:

  1. Every 5 seconds, the premium is sampled: (mark_price - index_price) / index_price
  2. These samples are averaged over the funding interval
  3. The average premium is clamped to the [-0.05%, +0.05%] range
  4. The clamped premium plus the base interest rate forms the funding rate

Funding Payment Calculation

For each account with an open position:

payment = position_size * mark_price * funding_rate_bps / 10,000
  • Positive rate (mark > index): Longs pay, shorts receive
  • Negative rate (mark < index): Shorts pay, longs receive

The payment is deducted from (or added to) the account’s collateral and tracked cumulatively in the position’s funding_accumulated field.

Settlement Timing

Although the canonical funding rate is defined per 8-hour interval, settlements occur every hour:

hourly_payment = 8h_funding_rate / 8

This smooths funding payments and reduces the impact of funding on margin calculations at interval boundaries.

Impact Prices

The premium component uses impact prices rather than simple mid-prices to resist manipulation:

impact_bid = weighted average execution price for selling $N at market
impact_ask = weighted average execution price for buying $N at market
mid_impact = (impact_bid + impact_ask) / 2
premium = (mid_impact - oracle_price) / oracle_price
MarketImpact Notional ($N)
BTC-USD, ETH-USD$20,000
All other markets$6,000

Using impact prices ensures that thin order books or manipulative limit orders at the top of the book do not distort the funding rate.

Edge Cases

  • Zero index price: If the oracle price is zero (should not occur in production), the funding rate defaults to 0
  • Extreme deviation: The clamp to +/- 10 bps per 8h interval prevents runaway funding during market dislocations
  • Empty positions: Accounts with no open position in a market are skipped during funding settlement

Prelaunch Market Funding

Prelaunch perpetual markets use a reduced funding rate to account for the absence of a reliable spot market:

prelaunch_funding = standard_funding_rate * 100 / 10,000    // 1% of normal rate

This ensures minimal funding impact while the market is in prelaunch phase. See Prelaunch Markets.