Funding
Overview
The funding rate for Diamonde crypto perpetual contracts is a mechanism used to ensure that the contract price is close to the price of the underlying asset.
The funding rate is a periodic fee paid by one party to a contract (long or short) to the other party. Funding is entirely peer-to-peer and there are no fees for payments.
The interest rate is calculated based on the difference between the contract price and the spot price of the underlying asset. To be consistent with CEX, the interest rate portion is predetermined at 0.01% every 8 hours, or 0.00125% per hour, or 11.6% APR paid to shorts. This represents the difference in the cost of borrowing USD versus spot cryptocurrency.
The premium component fluctuates based on the difference between the perpetual contract price and the underlying spot oracle price. If the contract price is higher than the oracle price, the premium and the funding rate will be positive, and long positions will pay short positions. Conversely, if the contract price is lower than the spot price, the funding rate will be negative, and short positions will pay long positions.
The funding rate on Diamonde is paid every hour. The funding rate is added or subtracted from the balance of the contract holder during the funding interval.
The funding rate is designed to prevent the price difference between the perpetual contract and the underlying asset from becoming too large. When the funding rate is high, it can incentivize traders to take opposing positions and help bring the contract price closer to the spot price of the underlying asset.
Technical Details
The financing design on Diamonde closely matches the process used by centralized perpetual exchanges.
The funding rate formula is for an 8-hour funding rate. However, funding is paid out every hour at one-eighth of the hourly calculated rate.
The specific formula is Funding Rate (F) = Average Premium Index (P) + clamp (interest rate - Premium Index (P), -0.0005, 0.0005)
. The premium is sampled every 5 seconds and averaged over the hour.
As described in the clearing house section, each validator calculates the oracle price as the weighted median of the CEX spot prices for each asset, with the weights depending on the liquidity of the CEX.
premium = impact_price / oracle_price - 1
where
impact_price = max(impact_bid_px - oracle_px, 0) - max(oracle_px - impact_ask_px, 0)
and impact_bid_px
and impact_ask_px
are the average execution prices to tradeimpact_notional_usd
on the bid and ask sides, respectively. See the contract specifications for the impact notional used, as well as other contract specific parameters.
Funding on Diamonde is capped at 4%/hour. Note that this is much less aggressive capping than CEX counterparts. The funding cap and funding interval do not depend on the asset.
Note that the funding payment at the end of the interval is position_size * oracle_price * funding_rate
. In particular, the spot oracle price is used to convert the position size to notional value, not the mark price.
Numerical Example
Here is an explicit example computation:
The interest rate is 0.01% (fixed).
The perpetual contract is trading at a premium, with the impact bid price being $10,100, and the spot price at $10,000.
The premium index is calculated as the difference between the two prices, which is $100 in this case.
The funding interval is 1 hour.
You hold a long position of 10 contracts, each representing 1 BTC.
First, calculate the premium:
Premium = (Impact bid price - Spot Price) / Spot Price = ($10,100 - $10,000) / $10,000 Premium = 0.01 (or 1%)
Next, clamp the interest rate minus the premium rate at 0.05%:
Clamped Difference = min(max(Interest Rate - Premium Rate, -0.05%), 0.05%)
Clamped Difference = min(max(0.01% - 1%, -0.05%), 0.05%)
Clamped Difference = min(max(-0.99%, -0.05%), 0.05%) Clamped Difference = -0.05%
Now, calculate the funding rate:
Funding Rate = Premium Rate + Clamped Difference Funding Rate = 1% + (-0.05%)
Funding Rate = 0.95%
Last updated