Funding Mechanism

Overview

The funding rate mechanism in Bulk Exchange is designed to anchor the price of a perpetual contract to the underlying spot index price. It facilitates periodic payments between traders holding long and short positions. These payments, known as funding, are exchanged directly between traders and do not incur any fees from the exchange.

Funding is calculated and exchanged every hour. The core principle is that if the perpetual contract trades at a premium to the spot price, long position holders will pay short position holders, incentivizing a return to parity. Conversely, if the contract trades at a discount, shorts will pay longs.

Funding Rate Calculation

The funding rate is determined by a formula that incorporates both an interest rate component and a premium component. This calculation is performed at the end of each hourly funding period.

The formula for the funding rate is:

Funding Rate = Average Premium + clamp(Interest Rate - Average Premium, ±0.05%)

Components:

  • Interest Rate: A fixed base rate of 0.01% per 8 hours. This component is a standard in the perpetual futures market.

  • Premium: This variable component reflects the deviation of the mark price from the oracle price. The ClearingHouse periodically samples this premium and feeds it to the FundingRateCalculator. The calculator then computes the simple average of these samples over the hour-long funding period to determine the Average Premium.

  • Clamping: To ensure stability and prevent excessive divergence, the clamp function is applied. The difference between the Interest Rate and the Average Premium is clamped, with a bound set to 0.05%. This limits the influence of this part of the formula on the final funding rate.

State and Lifecycle

The FundingRateCalculator is central to this process and manages the state throughout each funding period.

  • A list of premium_samples is maintained during the funding interval.

  • At the end of every hour, the calculate_funding_rate function is triggered. This function computes the new funding rate based on the collected samples.

  • Following the calculation, the list of samples is reset for the next cycle. The last_funding_ts (timestamp) and next_funding_ts are also updated.

  • The system is designed to align funding timestamps to the top of the hour, ensuring a predictable and consistent schedule for all market participants.

Last updated