Skip to content

Trading Basics

Learn the fundamental concepts of trading interest rate swaps on the Rate Swap Protocol.

Interest Rate Swap Fundamentals

An Interest Rate Swap (IRS) is a derivative contract where two parties exchange interest rate cash flows. In the Rate Swap Protocol:

  • One side pays a fixed rate
  • The other side pays a floating rate (based on an oracle index)
  • Notional amount determines the size of payments
  • Positions are margined and mark-to-market

Position Types

Pay Fixed / Receive Floating (Long Rates)

  • Notional: Positive (notional > 0)
  • Profit: When rates rise above your entry rate
  • Loss: When rates fall below your entry rate
  • Use Case: You expect rates to increase

Receive Fixed / Pay Floating (Short Rates)

  • Notional: Negative (notional < 0)
  • Profit: When rates fall below your entry rate
  • Loss: When rates rise above your entry rate
  • Use Case: You expect rates to decrease

Market Structure

Each market is defined by three parameters:

  1. Rate Index: The underlying rate (e.g., perp funding rate, borrow APR)
  2. Quote Token: The collateral and settlement currency (e.g., USDC)
  3. Maturity: When the swap expires

Multi-Market Pools

A single pool can support up to 16 markets, all using the same quote token. This enables:

  • Multiple maturities for the same rate index
  • Different rate indices sharing liquidity
  • Efficient capital utilization for LPs

Pricing & AMM

The protocol uses an Automated Market Maker (AMM) to price swaps:

  • Rates adjust based on net pool exposure
  • Larger trades have greater price impact
  • Liquidity depth determines available notional

DV01-Based Liquidity

For risk-increasing trades (trades that increase the market's DV01):

  • Available liquidity is reduced by a DV01 reserve
  • The reserve protects the pool from rate movements
  • A utilization-based scalar may further reduce depth at high utilization

For risk-reducing trades:

  • Full allocated liquidity is available
  • No DV01 gating applies

Cash Flow Settlement

The protocol uses accounting-only settlement:

Rate_Settlement = notional × (Current_Index - Last_Index)
  • No token transfers during settlement
  • Settlement updates position.realized_pnl
  • Pool counterparty updates market.pool_rate_accumulator
  • Tokens only move on explicit deposit/withdraw

This is different from traditional systems where funding flows directly to/from collateral balances.

Mark-to-Market (MTM)

Your unrealized P&L is calculated as:

MTM = (Current_Rate - Entry_Rate) × Notional × Time_to_Maturity / Seconds_Per_Year

This MTM is used for:

  • Position health calculation
  • Liquidation risk assessment
  • Real-time P&L tracking

Execution Flow

  1. Select Market: Choose rate index, maturity
  2. Deposit Collateral: Add quote tokens (e.g., USDC) to your margin account
  3. Specify Trade: Direction and notional size
  4. Check Margin: Ensure sufficient initial margin
  5. Execute: AMM quotes rate and executes swap
  6. Monitor: Track funding settlements in realized_pnl and MTM

Circuit Breaker Awareness

Before trading, check market status:

  • Normal: All trades allowed
  • Closing-Only: Can only reduce positions
  • Halted: No trading (only liquidations)

Fees & Costs

Swap Fees

Swap_Fee = |notional_delta| × swap_fee_bps / 10000
  • Fee is deducted from your position.realized_pnl (accounting-only)
  • Fee is split between LPs and protocol based on protocol_fee_share_bps

Funding Payments

  • Based on rate oracle index changes
  • Accumulated in position.realized_pnl
  • Can be positive or negative depending on direction

Transaction Costs

  • Solana transaction fees (minimal)
  • No gas fees for settlement (accounting-only)

Position Management

Opening a Position

  1. Ensure margin account exists (or create one)
  2. Deposit sufficient quote tokens
  3. Call swap with positive notional_delta for pay-fixed
  4. Call swap with negative notional_delta for receive-fixed

Increasing Position

  • Same direction as existing: increases notional
  • Entry rate becomes weighted average
  • Must meet initial margin requirement

Reducing Position

  • Opposite direction from existing: reduces notional
  • Realized PnL includes closed portion
  • Risk-reducing trades have full liquidity access

Closing Position

  • Swap with opposite notional to net to zero
  • realized_pnl includes final settlement
  • Position slot freed for reuse

Realized vs Unrealized PnL

Realized PnL

Stored in position.realized_pnl_wad:

  • Funding settlements accumulate here
  • Closed position gains/losses added here
  • Swap fees deducted here
  • Can be withdrawn when position is closed

Unrealized PnL (MTM)

Computed on-the-fly:

  • Based on current rate vs entry rate
  • Changes with market movements
  • Contributes to equity for health calculation
  • Becomes realized when position is closed

Best Practices

  • Start with small positions to learn mechanics
  • Monitor health factor regularly
  • Understand margin requirements before trading
  • Keep extra collateral for market volatility
  • Watch market status for circuit breaker changes
  • Track realized_pnl for funding accumulation
  • Close positions before maturity to avoid settlement complexity

Example Trade

Opening a 100,000 USDC notional pay-fixed position:

  1. Deposit Margin: 10,000 USDC (10% for 5% initial margin + buffer)
  2. Execute Swap: swap(notional_delta = +100,000 × WAD)
  3. Position State:
    • notional_wad: +100,000 × WAD
    • entry_fixed_rate_wad: AMM execution rate
    • realized_pnl_wad: -swap_fee (accounting-only)
  4. Monitor: Watch health, MTM, and funding accumulation
  5. Close: swap(notional_delta = -100,000 × WAD) to exit

Next Steps

Released under the ISC License.