Skip to main content

Overview

Funding rates in Drift Protocol perpetuals ensure the mark price stays anchored to the oracle price. Funding payments are exchanged between longs and shorts every hour based on the difference between the mark TWAP and oracle TWAP.

Funding Rate Formula

The funding rate is calculated based on the Time-Weighted Average Price (TWAP) spread:
Where:
  • markTwap - Time-weighted average mark price
  • oracleTwap - Time-weighted average oracle price
  • Division by 24 converts to hourly rate (from daily)

Precision Constants

Calculate Live Funding Rate

Example

Formatted Funding Rate

Get human-readable funding rate information:

Example

TWAP Calculations

Mark Price TWAP

Oracle Price TWAP

Similar calculation using oracle price data from market.amm.historicalOracleData.

Funding Payment Calculation

Calculate funding payment for a position:

Formula

Positive funding payment means the user receives funding. Negative means they pay funding.

Example

Funding Pool

The protocol maintains a funding pool to cover imbalances:

Max Price Divergence

Funding rate is capped based on contract tier:

Funding Rate with Offset

The protocol applies a small offset to encourage arbitrage:

Asymmetric Funding

When there’s an imbalance between longs and shorts, funding rates can be asymmetric:
When open interest is imbalanced, the smaller side may receive more funding than the larger side pays due to the funding pool mechanism.

Practical Examples

Monitor Funding Rates

Calculate Expected Funding Payment

Historical Funding Analysis