Understanding Interest Rate Swaps
A comprehensive guide to how interest rate swaps work in the Rate Swap Protocol.
What is an Interest Rate Swap?
An Interest Rate Swap (IRS) is a financial derivative where two parties exchange interest payment obligations. In traditional finance:
- One party pays a fixed rate (e.g., 5% annually)
- The other pays a floating rate (e.g., SOFR + 1%)
- Exchanges happen periodically over the swap's lifetime
- Used for hedging, speculation, or managing interest rate risk
How Rate Swap Protocol Works
The protocol implements on-chain, margined IRS with these characteristics:
Margined Positions
Instead of full notional exchange, traders post collateral:
- Initial Margin: Required to open position
- Maintenance Margin: Minimum to avoid liquidation
- More capital efficient than traditional swaps
Mark-to-Market Settlement
Positions are continuously valued:
- Funding Index: Tracks cumulative rate movements
- MTM Calculation: Real-time unrealized P&L
- Settlement: Periodic funding adjustments
Oracle-Based Rates
Rates come from trusted oracles:
- Rate Index: E.g., perp funding, borrow APR
- Updates: Authority-controlled, regular intervals
- Staleness Checks: Ensures fresh data
Position Mechanics
Entry
When you open a position:
- Specify notional and direction
- AMM quotes implied fixed rate
- Initial margin checked
- Position created with entry rate and funding index snapshot
During Position Lifetime
As rates fluctuate:
- Funding settles:
funding_delta = notional × (F_now - F_last) - MTM updates: Based on current rate vs entry rate
- Health monitored:
health = collateral + MTM - maintenance_requirement
Exit
Close position by:
- Executing opposite swap (reverses notional to zero)
- Realizes P&L into collateral balance
- Releases margin requirements
P&L Calculation
Funding P&L
Cumulative_Funding_PnL = notional_wad × (Current_F - Entry_F)Where F is the cumulative funding index.
Mark-to-Market P&L
MTM_PnL = (current_rate - entry_rate) × notional × time_to_maturity / SECONDS_PER_YEARTotal P&L
Total_PnL = Funding_PnL + MTM_PnLExample Trade
Scenario: You expect rates to rise
Open Position:
- Notional: +100,000 (pay fixed, receive floating)
- Entry Rate: 5% fixed
- Initial Margin: $5,000 (5% of notional)
Rates Rise to 6%:
- MTM Profit:
(0.06 - 0.05) × 100,000 × time_factor ≈ $1,000 - Health improves due to unrealized gain
- MTM Profit:
Funding Settlements:
- As floating rate index increases, you receive funding
- Realized P&L accumulates in collateral balance
Exit:
- Close position at 6% rate
- Realize profits + release margin
Risk Factors
Market Risk
- Rates move against your position
- MTM losses reduce health
- Potential liquidation if health < 0
Funding Risk
- Adverse funding settlements drain collateral
- High rate volatility increases funding payments
Liquidity Risk
- Large positions may have price impact
- Pool liquidity constrains available notional
Oracle Risk
- Stale oracle data halts trading
- Oracle manipulation could affect settlement
Advanced Concepts
DV01
Dollar Value of a Basis Point: How much position value changes per 0.01% rate move.
DV01 ≈ notional × time_to_maturity / (100 × SECONDS_PER_YEAR)Used for risk management and position sizing.
Convexity
Interest rate positions have convexity (non-linear P&L). Large rate moves have accelerated P&L impact.
Curve Trading
Future enhancement: Trade swaps across different maturities to express curve views (steepening, flattening).
Next Steps
- Risk Management - Manage your exposure
- Engineering Architecture - Technical implementation
- Business Risk Framework - Protocol-level risk