Lecture 12: Derivatives: Perpetual Futures
Instructor: Yu Feng, UCSB
CS190: Blockchain Programming and Applications
Lecture 12 — This lecture explores perpetual futures, the dominant financial instrument in cryptocurrency derivatives. We will demystify the core mechanisms that make them work, including the funding rate that anchors them to reality and the leverage that makes them both powerful and risky
The Problem: Trading an Echo
Why Derivatives Exist
Building financial systems with volatile assets like Bitcoin and Ether is like using a measuring tape that stretches unpredictably. Stablecoins provided the first solution—a fixed, reliable unit of account.
But stability is only half the story. Mature markets need tools to manage and speculate on volatility itself. This is where derivatives enter the picture.

Key Insight: Instead of trading the asset directly, you trade a contract that derives its value from the asset. You're trading the echo, not the object itself.
Derivatives enable sophisticated strategies like hedging—protecting holdings from price drops—and leveraged speculation, allowing traders to amplify their market exposure.
Spot vs. Futures vs. Perpetuals
To understand what makes perpetual futures special, we need to compare the three main trading models. Each has distinct characteristics that determine how traders interact with assets.
Spot Trading
The simplest form of trading. Buy 1 BTC, own 1 BTC. It's a direct exchange for immediate ownership with no expiration or complex mechanics.
Traditional Futures
A contract to buy or sell at a set price on a future date. Like pre-ordering a phone—price agreed today, transaction happens later. The fixed expiration forces price convergence.
Perpetual Futures
The crypto innovation. A futures contract that never expires. Hold positions indefinitely with high leverage. But without expiration, what anchors the price to reality?
The Core Mechanism: The Funding Rate
Keeping the Echo in Sync
The lack of expiration is perpetuals' greatest strength and greatest challenge. Without a settlement date, the perpetual contract price (Pperp) could drift far from the actual spot price (Pspot). The contract would become meaningless—an echo completely disconnected from its source.
The funding rate is the elegant solution: a periodic payment between traders that creates financial incentives to pull the perpetual price back toward spot.
The Solution: A Financial Tug-of-War
The funding rate is a periodic payment exchanged directly between long and short position holders. The exchange facilitates but doesn't profit. Its sole purpose: create incentives that anchor perpetual prices to spot prices.
Pperp > Pspot
Market is bullish with more longs. Funding becomes positive. Longs pay shorts, making long positions expensive and shorts profitable. This pushes the perpetual price down toward spot.
Pperp < Pspot
Market is bearish with more shorts. Funding becomes negative. Shorts pay longs, punishing short positions and rewarding longs. This pushes the perpetual price up toward spot.
This continuous balancing act prevents the perpetual price from drifting away from reality, maintaining the contract's relevance and utility for traders.
The Funding Rate Formula
Funding payments are calculated periodically, typically every 8 hours. The amount depends on position size and the funding rate itself.
\text{Funding Payment (USD)} = \text{Position Notional (USD)} \times \text{Funding Rate (\%)}
Two Components
F = I + P
Interest (I): A small fixed rate (typically 0.01% per 8-hour period) accounting for interest rate differences between base and quote currencies.
Premium (P): The crucial part measuring percentage difference between perpetual and spot prices, averaged over time to prevent manipulation.
Premium Calculation
P = \text{TWAP}\left(\frac{P_{\text{perp}} - P_{\text{spot}}}{P_{\text{spot}}}\right)

When perpetual price consistently exceeds spot (positive premium), P is positive, creating positive funding. When perp trades below spot, P becomes negative.
The Interest component balances borrowing cost differences. Holding a BTC long conceptually means "borrowing" USD to buy BTC, which has a cost. Even when prices align perfectly (P = 0), longs pay shorts this 0.01% interest, reflecting the cost of holding leveraged positions.
Example 1: Positive Funding Rate
Let's walk through a detailed calculation for a BTC/USD perpetual with an 8-hour funding period, showing how bullish sentiment translates into funding payments.
01
Setup
  • Position: Long 1 BTC
  • Spot Price: $100,000
  • Perpetual Price: $100,120 (bullish premium)
  • Position Notional: $100,120
  • Interest (I): 0.01%
02
Calculate Premium
P = \frac{100{,}120 - 100{,}000}{100{,}000} = \frac{120}{100{,}000} = 0.0012 = 0.12\%
03
Calculate Funding Rate
F = P + I = 0.12\% + 0.01\% = 0.13\%
04
Calculate Payment
\text{Payment} = 100{,}120 \times 0.13\% \approx \$130.16
The positive funding rate means our long trader pays $130.16 to a short-position holder. This cost incentivizes selling, pushing Pperp back toward Pspot.
Example 2: Negative Funding Rate
Now consider a bearish market where the perpetual trades at a discount to spot, demonstrating how funding payments reverse direction.
Scenario
  • Position: Long 1 BTC
  • Spot Price: $100,000
  • Perpetual Price: $99,900 (bearish discount)
  • Position Notional: $99,900
  • Interest (I): 0.01%
Calculations
P = \frac{99{,}900 - 100{,}000}{100{,}000} = \frac{-100}{100{,}000} = -0.1\% F = P + I = -0.1\% + 0.01\% = -0.09\% \text{Payment} = 99{,}900 \times (-0.09\%) \approx -\$89.91
The negative result indicates a payment received. With negative funding, shorts must pay longs. Our long trader receives $89.91 from short-position holders, incentivizing buying and pushing Pperp back up toward Pspot.
The Double-Edged Sword
Leverage and Liquidation
To understand perpetuals' power and peril, let's follow trader Alice through an entire position lifecycle, from entry to potential liquidation.
Leverage: Amplifying Your Bet
The main attraction of perpetuals is leverage—controlling large positions with small capital deposits called margin.
Alice's Setup
  • Capital (Margin): $3,000
  • Leverage: 20x
  • Position Size: $60,000
  • BTC Price: $100,000
  • Position: 0.6 BTC
5% Price Rise
BTC → $105,000
Position value: $63,000
Profit: $3,000 (100% gain)
5% Price Drop
BTC → $95,000
Position value: $57,000
Loss: $3,000 (100% loss)
Liquidation: The Automated Stop-Loss
What happens when the market moves against Alice? The exchange cannot allow losses to exceed her deposit. To protect itself, exchanges implement automated liquidation.
1
Entry: $100,000
Alice opens her 20x long position with $3,000 margin, controlling $60,000 worth of BTC.
2
Price Falls to $97,500
Position value drops to $58,500. Alice's margin is now $1,500—half her initial capital.
3
Critical Point: $95,000
A 5% drop creates 100% loss (20x × 5% = 100%). Position value: $57,000. Margin: $0.
4
Liquidation Triggered
The exchange's liquidation engine forcibly closes Alice's position. She loses her entire $3,000 margin.

In reality, exchanges maintain a buffer (maintenance margin), triggering liquidation slightly before the zero-point (e.g., $95,100) to cover fees and ensure the exchange doesn't lose money.
The Liquidation Cascade
Individual liquidation is manageable, but when thousands of traders cluster at similar price points, liquidation becomes a systemic risk that can trigger market-wide crashes.
Cascading Liquidations: The Death Spiral
Imagine 1,000 traders all made Alice's 20x long trade, entering between $99,500 and $100,500. Their liquidation prices cluster tightly around $95,000, creating a "liquidation wall."
01
Initial Trigger
Normal selling pushes price to $95,000, hitting the liquidation wall.
02
Mass Liquidation
All 1,000 traders (600+ BTC total) are liquidated simultaneously.
03
Forced Market Selling
Exchange dumps 600+ BTC instantly as market sell orders.
04
Price Crashes Further
Massive supply overwhelms buyers. Price crashes to $90,000.
05
Next Wave Triggers
New price hits the next liquidation cluster, perpetuating the cycle.
This feedback loop—where one liquidation cluster triggers price drops that activate the next cluster—causes the sudden, violent crashes characteristic of crypto markets.
Case Study: Decentralized Perpetuals
GMX vs. Hyperliquid
Decentralized perpetuals exchanges face a fundamental design challenge: creating fast, liquid, and secure markets without centralized control. Different platforms have pioneered distinct architectural approaches.
We'll compare two influential models that represent opposite ends of the design spectrum, each making different tradeoffs between decentralization, performance, and user experience.
GMX: The "Trader vs. Pool" Model
GMX pioneered on-chain perpetuals on Layer 2 networks like Arbitrum using a pooled liquidity model centered around the GLP token, eliminating the need for traditional order books.
What is GLP?
A multi-asset liquidity pool where users deposit BTC, ETH, and USDC into a single basket. They receive GLP tokens representing their share of the entire pool.
Trading Mechanism
Traders trade directly against the GLP pool. Liquidity providers collectively act as the single counterparty—the "house"—for every trade on the platform.
Oracle-Based Pricing
GMX doesn't discover prices internally. It relies on high-speed oracles like Chainlink that aggregate prices from major centralized exchanges.
GMX: Zero Slippage Example
The pooled model enables a distinctive feature: traders can execute large orders without price impact, unlike traditional order book exchanges.
Scenario
A trader wants to open a 100 ETH long position—a substantial order that would typically move markets.
Process
  1. GMX queries the Chainlink oracle
  1. Oracle reports current VWAP: $3,000
  1. GMX opens 100 ETH position at exactly $3,000
Zero slippage execution: Whether trading 1 ETH or 1,000 ETH, traders receive the exact oracle price. No order book depth concerns.
Profit and Loss
  • Trader wins: Profits paid directly from GLP pool assets
  • Trader loses: Losses added to GLP pool
LPs are collectively betting that traders will lose more than they win in aggregate, earning fees and trader losses as yield.
Hyperliquid: On-Chain Order Book
Hyperliquid represents a new generation, running a Central Limit Order Book (CLOB) directly on its own application-specific blockchain—bringing traditional exchange mechanics fully on-chain.
What is a CLOB?
The traditional model used by centralized exchanges and stock markets. A public ledger of all buy and sell orders at different price levels, visible to all participants.
Trader-to-Trader
Traders match against each other directly. Buy orders must find corresponding sell orders. Market makers provide liquidity by placing bids and asks.
Native Price Discovery
Prices are discovered on-platform through order matching. Market price equals the last matched trade where highest bid meets lowest ask.

To handle thousands of orders per second required by a CLOB, Hyperliquid built its own custom blockchain optimized specifically for high-frequency order matching.
Hyperliquid: Order Book Example
The same 100 ETH trade executes very differently on an order book, demonstrating the tradeoff between autonomous pricing and execution guarantees.
01
Order Placed
Trader submits market buy order for 100 ETH. System examines the sell-side order book.
02
Order Book State
  • 20 ETH available @ $3,000.00
  • 50 ETH available @ $3,000.10
  • 50 ETH available @ $3,000.20
03
Sequential Matching
System buys cheapest first: 20 ETH @ $3,000.00, then 50 ETH @ $3,000.10, then 30 ETH @ $3,000.20 to complete the order.
04
Execution Result
Average fill price: $3,000.11
Slippage: $0.11 per ETH
Total slippage cost: $11
The price difference between best visible price ($3,000) and actual average execution price ($3,000.11) represents slippage—the cost of consuming order book depth.
The Core Trade-Off
These models represent fundamentally different approaches to decentralized perpetuals, each optimizing for different properties and accepting different compromises.
GMX: Trader vs. Pool
Strengths
  • Zero slippage on all trades
  • Simple LP participation
  • Capital efficient design
  • Predictable execution prices
Weaknesses
  • No native price discovery
  • Oracle dependency risk
  • LPs bear all trader P&L risk
  • Prices imported, not discovered
Hyperliquid: On-Chain CLOB
Strengths
  • Native price discovery
  • Traditional market dynamics
  • No oracle dependency
  • Real-time order matching
Weaknesses
  • Slippage on large orders
  • Requires market maker presence
  • Thin books → high slippage
  • Complex infrastructure needs
Model Comparison Summary
Neither model is strictly superior—they optimize for different use cases. GMX excels for traders prioritizing execution certainty. Hyperliquid appeals to those valuing traditional market mechanics and autonomous price formation.
References
  1. Hyperliquid. 2024. Hyperliquid: Docs. Available at: https://hyperliquid.gitbook.io/hyperliquid-docs. Accessed: 2025-10-01.
  1. BitMEX. 2024. Perpetual Contracts Guide. Available at: https://www.bitmex.com/app/perpetualContractsGuide. Accessed: 2025-09-27.
  1. Chainlink. 2017. Chainlink: A Decentralized Oracle Network. Whitepaper available at: https://chain.link/whitepaper. Accessed: 2025-09-27.
Additional Resources:
  • GMX Documentation: Understanding pooled liquidity models
  • Academic papers on funding rate mechanisms in perpetual swaps
  • Historical data on cascading liquidation events in crypto markets