Funding rate

The funding rate is how the price of a perpetual swap is kept close to the price of the underlying asset. It works by sending periodic payments between long and short traders. This is critical: a poorly designed funding rate makes perpetual swaps riskier, more volatile, and costlier.

For perpetual swap products, the funding rate is levied and updated approximately every 8 hours worth of blocks (mainnet = 1920 blocks; kovan = 7200 blocks. This difference is due to the roughly 15 second block time on mainnet vs roughly 4 second block time on kovan). The funding rate interval can be modified via DerivaDAO governance.

You can view the funding rate at the top of the interface, and you can see your individual funding-rate payments in the "Order History" table at the bottom of the interface.

Funding rate calculation

The funding rate is computed in the following manner:

  1. Obtain the last 8 hours worth of premium rates, which is actually just the EMA component of the price feed (premium_rates). This premium rate essentially tracks the magnitude of the difference between the underlying composite index the perpetual swap is tracking and the DerivaDEX order book itself. Please refer to Price feed to better understand what this term refers to.

  2. Take a simple average of these EMA values. avg_premium_rate = avg(premium_rates)

  3. Compute the unclamped funding rate. Any avg_premium_rate value between the funding_zero_lower_bound (-0.0005) and the funding_zero_upper_bound (0.0005) will become 0. unclamped_funding_rate = max(funding_zero_upper_bound, avg_premium_rate) + min(funding_zero_lower_bound, avg_premium_rate)

  4. Compute the clamped funding rate. Any unclamped_funding_rate value below the funding_lower_bound (-0.005) and the funding_upper_bound (0.005) will be capped at either of those respective bounds. funding_rate = min(funding_upper_bound, max(funding_lower_bound, unclamped_funding_rate))

Funding rate distribution

At the boundaries of the funding rate window, users will either be credited or debited the funding fee depending on their open position size. The magnitude of the funding fee for any individual trader can be computed as funding_rate * position_notional. When the DerivaDEX perpetual swap is trading above the composite index it's tracking, the funding rate will be positive, meaning long traders will pay the funding fee and short traders will receive the funding fee, thus bringing the perpetual swap's price down back in line with the underlying. Conversely, when the DerivaDEX pereptual swap is trading below the composite index it's tracking, the funding rate will be negative, meaning long traders will receive the funding fee and short traders will pay the funding fee, thus taking the perpetual swap's price up back in line with the underlying.

For more information about funding rates, see this in-depth introduction.

Last updated