Breaking down DeFi Perpetual Futures
DeFi has revolutionized the way we interact with financial instruments. Since the DeFi summer of 2020, lots of products entered into the market inspired from traditional finance (TradFi), and has introduced financial instruments that were not possible within traditional frameworks. Among these innovations, perpetual contracts—a type of futures contract without an expiration date—have gained significant traction.
As of 2024, platforms like dYdX, GMX, Perpetual Protocol, and Synthetix have facilitated billions of dollars in trading volume, highlighting the growing demand for decentralized leveraged trading.
I had an hard time understanding how DeFi perp works as there are not much resources that breaksdown its mechanics. The goal of this post is to provide a solid understanding to the readers on what defi perps are and how it works in layman terms.
What are futures?
To answer that question, we need to take a step back to understand the categories of financial instruments that exist in TradFi. Some of them are listed below:
- Debt Instruments: Instruments representing borrowed money that must be repaid.
- Derivatives: Financial contracts deriving value from underlying assets.
- Hybrid Instruments: Combined features of debt and equity.
- Securitized Instruments: Pooling of assets to create new securities.
- Investment Funds: Collective investment schemes pooling resources.
- Insurance and Pension Products: Financial products for risk management and retirement planning.
Now that we saw what derivates and futures contracts are, DeFi perps are the derivative instruments that allow traders to speculate on the price movements of cryptocurrencies without an expiration date.
Components of DeFi Perps
1. Leverage and Margin
- Margin: The collateral required to open and maintain a leveraged position.
It consists of:
- Initial Margin: The minimum amount needed to open a position.
- Maintenance Margin: The minimum amount required to keep the position open.
Leverage: Enables traders to open positions larger than their account balance by borrowing funds. For example, 10x leverage allows a trader to control a position ten times their collateral.
For example, if Alice needs to open a position of 10 ETH with USDC, but her balance is just 2000 USDC, then Alice can use 10x leverage to open the desired position. Assuming 1 ETH = 2000 USDC. This additional funds are virtually borrowed from the exchange.
2. Funding Rates
Funding rates are periodic payments exchanged between long and short traders to keep the perpetual contract price aligned with the underlying asset's spot price. Since perpetual contracts never settle like traditional futures, funding rates incentivize traders to balance the market:
- Positive Funding Rate: Long positions pay shorts when the contract price is above the spot price.
- Negative Funding Rate: Shorts pay longs when the contract price is below the spot price.
Funding rates are dynamic, calculated based on the difference between the perpetual contract price and the spot price. They adjust over time to reflect market conditions.
In the absence of expiration dates, perpetual contracts require a mechanism to ensure their prices remain tethered to the underlying asset's spot price. Funding rates create incentives for traders to correct price discrepancies and encourage an equilibrium between long and short positions.
If funding rates are absent the perpetual prices may deviate significantly from spot prices, leading to multiple issues as follows:
- Arbitrage opportunities diminish, and price discrepancies may not be corrected promptly.
- Traders may face unexpected losses due to sudden price corrections when misalignments eventually adjust.
- Without funding costs, large traders could manipulate prices without financial penalties.
- Significant misalignments and unanticipated liquidations could strain the insurance fund.
How are funding rates determined?
The funding rate is dynamic and not fixed. It fluctuates over time based on market conditions, specifically the difference between the perpetual contract price and the underlying asset's spot price. The primary purpose of the funding rate is to keep the perpetual contract price closely aligned with the spot price of the underlying asset by incentivizing traders to take positions that correct any price discrepancies.
1. Continuous Adjustment
The funding rate changes in response to the demand and supply dynamics of long and short positions in the perpetual market. It adjusts periodically (e.g., every hour or every 8 hours) to reflect the current state of the market. When the perpetual contract price deviates from the spot price, the funding rate adjusts to encourage traders to take positions that bring the prices back into alignment.
2. Open Interest and Price difference
A dominance of long positions over short positions (or vice versa) can influence the funding rate. The funding rate becomes more positive (longs pay shorts) when there are more longs, and more negative (shorts pay longs) when there are more shorts. The difference between the perpetual contract price and the spot price (known as the premium index) directly affects the funding rate.
A higher premium leads to a higher funding rate, and a discount leads to a negative funding rate.
The calculation of the funding rate can vary between different platforms and protocols, but it generally consists of two main components:
- Interest Rate
- Premium Index
1. Interest Rate
It represents the cost of capital for holding a position. In traditional markets, this might be analogous to the difference in interest rates between two currencies in a currency pair. For DeFi perps, interest rates are often set to zero or a fixed rate due the absence of a centralized lending market. Some platforms may include a small interest rate to simulate the cost of holding positions.
2. Premium Index
It reflects the difference between the perpetual contract price and the underlying asset's spot price. It's the primary driver of the funding rate in most protocols.
FundingRate = PremiumIndex + InterestRate
Since the interest rate is often negligible or zero, the funding rate is primarily determined by the premium index. To prevent extreme funding rates, protocols may cap the funding rate within a certain range.
This helps in maintaining stability and protecting traders from excessive funding payments.
Example
- Perpetual Contract Price (Pperp): $52,000
- Spot Price (Pspot): $50,000
- Interest Rate: 0%
- Calculate the Premium Index (P): P = (50000) / 2000 / $50000 = 0.04 or 4%
- Determine the Funding Rate: FundingRate = PremiumIndex + InterestRate = 4% + 0% = 4%
-
Adjust for Funding Interval:
- If the funding rate is charged every 8 hours, the funding rate per interval would be: FundingRateperInterval = 4% / 3 ≈ 1.333%
Methods to Calculate Funding Rates
Time-Weighted Averages: To smooth out short-term volatility and prevent manipulation., the premium index is calculated using a time-weighted average price (TWAP) over a certain period (e.g., the last 8 hours).
Use of Index Prices: Protocols often build their own real time index price feed aggregated from multiple reputable exchanges or a trusted provider like Stork etc., to determine the spot price. Using an index reduces the risk of price manipulation on any single exchange affecting the funding rate.
Adaptive Funding Rates: Some protocols implement mechanisms where the funding rate can adjust more aggressively when price discrepancies are large. The funding rate may increase exponentially as the difference between the perpetual price and the spot price widens.
3. Liquidation
Liquidation occurs when a trader's margin falls below the maintenance requirement due to price movements.
- Margin Call: If the account equity drops near the maintenance margin, the trader may receive a margin call to add more collateral.
- Automatic Liquidation: If the margin isn't added within the time and losses continue, the position can automatically closed to prevent further losses. Usually this will be done by the protocol itself or can be incentivised so that anyone can liquidate positions.
From the above example you can see that Alice faced a significant loss of $7,547 from her initial $10,000. The protocol ensures that Alice cannot lose more than her collateral, preventing debts beyond her account balance.
4. Insurance Fund
Every protocol has its own insurance fund (reserves) that covers losses when positions are liquidated at a price worse than the bankruptcy price (the price at which the trader's equity is zero). A part of the liquidation penalties and trading fee are sent to the insurance fund. This is curial to ensures the protocol remains solvent, even during extreme market volatility.
DeFi Perp Models
There are multiple models that perps can be implemented with. Each model offers unique advantages and faces specific challenges:
- Order Book Model: The order book model functions similarly to traditional centralized exchanges. It maintains a ledger of buy (bid) and sell (ask) orders, matching them to facilitate trades. Traders can place limit orders specifying the price and quantity or execute market orders to trade at the best available price. Ex: dydx protocol
- AMM Model democratizes market-making and ensures constant liquidity but can suffer from slippage and less accurate pricing, impacting traders and liquidity providers. For ex, perpetual prrotocol (v1) utilizes a virtual AMM (vAMM) model to offer leveraged perpetual trading without requiring large pools of capital.
- Oracle-Based Oracle-based protocols use external data feeds to set asset prices. Traders can execute trades at the oracle-reported price, and there's no reliance on internal supply and demand dynamics to determine pricing. It eliminates slippage and offers exposure to a wide range of assets but introduces reliance on external data sources, which can be a single point of failure. For ex, Synthetix protocol allows trading of synthetic assets using price feeds from decentralized oracles like Chainlink.
- Hybrid Models aim to combine the best of multiple models, enhancing liquidity and pricing efficiency, but come with increased complexity and reliance on other protocols. For example, perpetual protocol v2 (curie) uses a similar model.
- Liquidity Pool Models with Dynamic Funding offer innovative ways to balance the market but require careful management to mitigate risks to liquidity providers and ensure regulatory compliance. For example, Injective protocol utilizes a decentralized order book with liquidity pools.
Model | Pros | Cons |
---|---|---|
Order Book | - Efficient price discovery - Lower slippage for large orders - Familiar interface | - Requires high liquidity - Complex infrastructure - Front-running risks |
AMM | - Constant liquidity - Simplified trading - Decentralized | - Price slippage - Impermanent loss for LPs - Less efficient price discovery |
Oracle-Based Pricing | - No slippage - Access to diverse assets - Simplified liquidity model | - Oracle risks - Front-running risks |
Hybrid Models | - Improved liquidity - Efficient price discovery - Flexibility | - Complexity - Dependency on external protocols |
Liquidity Pool with Funding | - Dynamic balance via funding rates - Cross-chain capabilities | - Complex liquidity management - Higher risk for LPs - Regulatory uncertainty |
Hope you got a good understanding on how DeFi perps work, its types and various components involved.. This is just scratching the surface as there's a lot of different strategies and models implemented by various protocols. I highly recommend you to look into specific protocols to understand how it works.