Overview
Funding payments anchor perpetual contract prices to spot. They are exchanged hourly, directly between long and short holders. The exchange does not take a cut. If the perp trades at a premium to spot, longs pay shorts. If at a discount, shorts pay longs.Funding Rate Formula
Each funding period, the rate is computed from sampled premiums: Where:Premium Sampling
Each sample interval (configurable, typically every few seconds):-
Compute the depth-weighted bid and ask prices by sweeping a fixed notional amount through the book:
P_bid = sweep(sell, size)P_ask = sweep(buy, size)- where
size = notional / mid
-
Get the oracle price
P_o - Compute the premium:
P_mu = SMA(Pi)over the configured window
Funding Payment
For each position at funding time:- Long (
Q > 0) with positiveF: pays funding (payment deducted from margin) - Short (
Q < 0) with positiveF: receives funding (payment added to margin) - Signs reverse when
Fis negative