The following steps are followed to determine funding rate:
Fair Impact Bid/Ask
Calculate average fill prices for a set notional amount on both the bid and ask sides.
Fair Price
Take the median of:
Average of Fair Impact Bid/Ask
Average of best bid/ask
Last traded price
Index Price
A weighted average from several external exchanges.
Premium
Computed every second:
Premium = Fair_Price – Index_Price
Premium Rate
The median of
(Premium / Index_Price)
over the past minute.Updated every minute.
Capping the Rate
Limited to ±1% (configurable) to prevent extreme funding swings.
Funding Index
Tracks cumulative funding changes, starting at 0.
Updated every minute:
Funding_Index += Capped_Premium_Rate * (Index_Price) / (8 * 60)
Funding Payment
Triggered whenever a position changes size (due to trades, transfers, deposits, etc.).
If your position size was
Last_Position_Size
and the Funding Index isF
, then:Funding_Payment = -1 × (Last_Position_Size) × (F - Funding_Index_Start)
Afterward,
Funding_Index_Start
is updated to the current Funding Index if you still have a position, or reset to 0 if you fully closed it.