For the complete documentation index, see llms.txt. This page is also available as Markdown.

Funding Rate

Perpetual futures never expire, so a periodic cash transfer between longs and shorts — funding — anchors the contract's mark price to the oracle (spot) price. During each funding interval the Exchange samples the instantaneous premium index (PmarkPoracle)/Poracle(P_{mark} - P_{oracle})/P_{oracle} and accumulates it weighted by the time elapsed since the previous sample. At any point in the interval the funding rate is the time-weighted average premium, clamped to a symmetric cap ±c\pm c. At settlement, each position pays or receives an amount proportional to its notional value at the mark price: with a positive rate, longs pay shorts; with a negative rate, shorts pay longs. The construction is exactly zero-sum between matched long and short open interest.

The funding rate is a fan-in of the premium accumulator and the interval clock, and settlement feeds back both into a fresh accumulator and into the positioning pressure that moves the next premium.

The funding rate is a fan-in of the premium accumulator and the interval clock, and settlement feeds back both into a fresh accumulator and into the positioning pressure that moves the next premium.

Setting

Symbol
Name
Description
Units
Domain

PoracleP_{oracle}

oracle_price

External index (oracle) price of the underlying asset. Samples with a non-positive oracle price are skipped by the implementation, so the effective domain is strictly positive.

USDX per unit of asset

(0, ∞)

PmarkP_{mark}

mark_price

The Exchange's mark price for the perpetual market at the sample or settlement time.

USDX per unit of asset

(0, ∞)

Δt\Delta t

time_delta_secs

Seconds elapsed since the previous sample in the interval. Samples at or before the previous sample time are ignored, so the effective domain is strictly positive. Derived in code from millisecond timestamps divided by 1000.

seconds

(0, ∞)

AA

accumulated_premium

Running sum of premium-index samples weighted by their time deltas, ipiΔti\sum_i p_i \, \Delta t_i, over the current funding interval. Reset to zero at each interval boundary.

dimensionless-seconds (premium × seconds)

unbounded

TT

total_time_secs

Total elapsed time in the current interval, from the interval start to the most recent sample. Derived, not stored: when zero (no samples yet) the implementation short-circuits and returns a zero rate rather than dividing.

seconds

(0, ∞)

cc

funding_rate_cap

Per-market symmetric cap on the funding rate, stored in market parameters. The specified value is 0.5% per settlement window.

dimensionless (fraction per funding interval)

(0, ∞)

ff

funding_rate

The clamped funding rate applied to positions at settlement; always lies in [c,+c][-c, +c].

dimensionless (fraction per funding interval)

[-0.0075, 0.0075]

SS

size

Absolute position size in units of the underlying asset (always non-negative; direction is carried separately by the position side).

units of asset

[0, ∞)

σ\sigma

side_sign

Direction indicator for the position: +1+1 for a long position, 1-1 for a short position. Encodes the match on position side in the implementation.

dimensionless

[-1, 1]

The mechanism

Premium Index Sampling

Each oracle tick produces one sample of the instantaneous premium index: the relative deviation of the mark price from the oracle price. A positive premium means the perpetual trades rich to the index (longs are crowded); a negative premium means it trades cheap. The implementation skips any sample whose oracle price is not strictly positive, leaving the interval state unchanged, so the division is always well defined.

p=PmarkPoraclePoracle(F.1)p = \frac{P_{mark} - P_{oracle}}{P_{oracle}} \tag{F.1}

Samples arrive at an irregular cadence, so each premium index (F.1) is weighted by the time elapsed since the previous sample before being added to the interval accumulator AA. This makes the accumulator the exact time integral of the (piecewise-constant) premium index over the interval, independent of sampling frequency: 1-minute and 5-second cadences produce identical averages for the same premium path. Samples with a timestamp at or before the previous sample time are ignored, so Δt\Delta t is strictly positive.

AA+pΔt(F.2)A \leftarrow A + p \cdot \Delta t \tag{F.2}

Funding Rate

The funding rate at any point in the interval is the time-weighted average premium — the accumulator (F.2) divided by the total elapsed time TT — clamped to the symmetric per-market cap ±c\pm c. The clamp bounds the wealth transfer per settlement window regardless of how dislocated the mark price becomes. When no time has elapsed in the interval (T=0T = 0, i.e. no samples yet), the implementation returns zero rather than dividing by zero. The predicted funding rate published mid-interval is defined to be this same value: the current average is the best estimate of the final rate.

f=clamp ⁣(AT,  c,  +c)(F.3)f = \operatorname{clamp}\!\left(\frac{A}{T},\; -c,\; +c\right) \tag{F.3}

Funding Payments

At settlement each open position exchanges cash proportional to its notional value at the mark price. The signed amount is the position's notional SPmarkS \cdot P_{mark} times the funding rate (F.3), with the sign flipped for shorts via σ\sigma. The convention is: a positive amount means the account pays; a negative amount means the account receives. So with a positive rate (f>0f > 0, perpetual rich to index) longs pay and shorts receive, and with a negative rate shorts pay and longs receive. For equal long and short size at the same mark and rate, the two amounts cancel exactly.

Π=σSPmarkf(F.4)\Pi = \sigma \cdot S \cdot P_{mark} \cdot f \tag{F.4}

Invariants

  • The funding rate is always bounded: cf+c-c \le f \le +c for every interval state ((F.3)).

  • Zero premium implies zero rate: if Pmark=PoracleP_{mark} = P_{oracle} for the whole interval, then A=0A = 0 and f=0f = 0.

  • When not clamped, the sign of the rate matches the sign of the average premium: a perpetual trading rich to the index yields f>0f > 0, trading cheap yields f<0f < 0.

  • Funding is exactly zero-sum for matched open interest: for equal long and short size at the same mark price and rate, Πlong+Πshort=0\Pi_{long} + \Pi_{short} = 0 ((F.4)); verified by property-based testing across the full rate range.

  • Payments are linear in position size: tripling SS triples Π\Pi exactly.

  • The rate is well defined at all times: with no samples in the interval (T=0T = 0) the rate is exactly 00, never a division error.

  • Samples with non-positive oracle price or non-increasing timestamps leave the interval state unchanged.

  • The TWAP is sampling-cadence invariant for a constant premium: any positive sampling frequency yields ff equal to the constant premium index (when below the cap).

Worked example

Consider the BTC perpetual over one 8-hour funding interval with the oracle steady at Poracle=50,000P_{oracle} = 50{,}000. For the first 4 hours the mark price is 50,02050{,}020, a premium index of p1=20/50,000=0.0004p_1 = 20/50{,}000 = 0.0004 per (F.1); for the last 4 hours the mark is 50,03550{,}035, so p2=35/50,000=0.0007p_2 = 35/50{,}000 = 0.0007. Sampling once per minute, each phase contributes its premium times its duration to the accumulator per (F.2): A=0.0004×14,400+0.0007×14,400=5.76+10.08=15.84A = 0.0004 \times 14{,}400 + 0.0007 \times 14{,}400 = 5.76 + 10.08 = 15.84 premium-seconds.

The interval spans T=28,800T = 28{,}800 seconds, so the raw time-weighted average premium is A/T=15.84/28,800=0.00055A/T = 15.84 / 28{,}800 = 0.00055. With a cap of c=0.0075c = 0.0075 this is far inside the band, so the clamp in (F.3) does not bind and the settled funding rate is f=0.00055f = 0.00055 — exactly the duration-weighted mean of the two premium phases, (0.0004+0.0007)/2(0.0004 + 0.0007)/2.

Now settle a 2 BTC long at mark 50,03550{,}035. Its notional is 2×50,035=100,0702 \times 50{,}035 = 100{,}070 USDX, so per (F.4) the payment is Π=+1×100,070×0.0005555.04\Pi = +1 \times 100{,}070 \times 0.00055 \approx 55.04 USDX — positive, so the long pays. A 2 BTC short at the same mark has Π55.04\Pi \approx -55.04 USDX and receives the same amount: the transfer is exactly zero-sum. Had the market instead sustained a 10% premium all interval, the raw average 0.100.10 would have been clamped to the cap and every position would settle at f=cf = c.

Analysis

Sensitivity

Elasticities ε = (∂y/∂x)·(x/y), computed numerically from the verified expressions at each worked-example point. |ε| > 1 means the output moves more than proportionally with that input.

Expression
Input
Elasticity ε

premium_index

mark_price

1.43e+03

premium_index

oracle_price

-1.43e+03

sample_contribution

mark_price

1.43e+03

sample_contribution

oracle_price

-1.43e+03

sample_contribution

time_delta_secs

1

funding_rate

accumulated_premium

1

funding_rate

total_time_secs

-1

funding_rate

funding_rate_cap

0

funding_payment

side_sign

1

funding_payment

size

1

funding_payment

mark_price

1

funding_payment

funding_rate

1

Sensitivity tornado — Premium index
Sensitivity tornado — Funding rate (clamped TWAP)
Sensitivity tornado — Funding payment

Response curves

The instantaneous premium index is linear in the mark price and crosses zero exactly where mark equals the fixed $50,000 oracle price.

The instantaneous premium index is linear in the mark price and crosses zero exactly where mark equals the fixed $50,000 oracle price.

Over a full 8-hour interval (T = 28,800 s) the funding rate rises linearly with the accumulated premium until the average hits the ±0.0075 cap, where it saturates.

Over a full 8-hour interval (T = 28,800 s) the funding rate rises linearly with the accumulated premium until the average hits the ±0.0075 cap, where it saturates.

At a positive 0.05% rate and $50,000 mark price, payments scale linearly with size and are exactly mirrored between long and short, so matched open interest nets to zero.

At a positive 0.05% rate and $50,000 mark price, payments scale linearly with size and are exactly mirrored between long and short, so matched open interest nets to zero.

Parameter space

Joint parameter effects evaluated from the verified expressions over 2-D grids.

The clamp carves wedge-shaped saturation zones where |accumulated premium / time| exceeds the ±0.75% cap, so short accumulation windows saturate at far smaller premiums; cap held at 0.0075.

The clamp carves wedge-shaped saturation zones where |accumulated premium / time| exceeds the ±0.75% cap, so short accumulation windows saturate at far smaller premiums; cap held at 0.0075.

The bilinear size × rate interaction produces hyperbolic level sets of equal payment, with the sign flip at rate = 0 splitting payers from receivers; mark price held at 50,000 for a long position.

The bilinear size × rate interaction produces hyperbolic level sets of equal payment, with the sign flip at rate = 0 splitting payers from receivers; mark price held at 50,000 for a long position.

References

  • Derived from and adversarially verified against the Exchange's Rust implementation and its test suite.

  • Sibling model: insurance-fund

  • Sibling model: liquidation-engine

  • Sibling model: margin-math

  • Sibling model: oracle

  • Sibling model: order-book

  • Sibling model: position-tracker

  • Sibling model: settlement

Last updated