BlueGamma
  • Getting Started
  • Setting up your account
  • Features Overview
  • Interest Rate Swaps
    • Overview
    • Calculating a Swap Rate
    • Calculating the MtM of a Swap
    • Refinancing a Swap
    • Advanced
      • Download a Custom Table of Swap Rates
      • Benchmarking a Swap Rate with a Bank
    • FAQs
      • How Forward Rates Are Calculated
      • How Discount Factors Are Calculated
  • Forward Curves
    • Overview
    • Downloading a Forward Curve
    • Downloading Historic Forward Curves
    • Advanced
      • How to Access BRL Forward Curves and Download TLP Forecasts
    • FAQs
  • Government Bonds
    • Accessing Bond Yields
    • Accessing Forward Starting Bond Yields
  • Foreign Exchange
    • Downloading FX Forward Rates
  • Cross Currency
    • Overview
    • Pricing a Cross-Currency Swap
  • Integrations
    • Excel Add-in
      • Installation & Setup
      • Get Swap Rates
      • Get Discount Factors
      • Get Forward Rates
      • Get Swap Rate by ID
    • API
      • API Reference
      • How to Guides
        • Fetching a Swap Rate
        • Fetching Historical Swap Rates
        • Getting Forward Rates
        • Getting a Forward Curve
        • Getting Discount Factors
        • Validating BlueGamma API Data Against Bloomberg or Other Platforms
  • Accounts and Plans
    • Adding and removing seats
  • FAQs
    • Currency-Specific FAQs
    • Where does your data come from?
Powered by GitBook
On this page
  1. Integrations
  2. API
  3. How to Guides

Fetching a Swap Rate

Use the /swap_rate endpoint to calculate the par rate for a vanilla interest rate swap, given an index, start/maturity, and leg conventions.

PreviousHow to GuidesNextFetching Historical Swap Rates

Last updated 1 month ago

This is the most common use case for pulling current or historical market swap rates directly into your software or spreadsheet. For more details:

✅ Example: Live 10Y SOFR Swap Rate

import requests

url = "https://api.bluegamma.io/v1/swap_rate"
headers = {"x-api-key": "your_api_key_here"}
params = {
    "index": "SOFR",
    "start_date": "0D",                 # Today
    "maturity_date": "10Y",            # 10 years from today
    "fixed_leg_frequency": "1Y",
    "floating_leg_frequency": "1Y",
    "fixed_leg_day_count": "Actual360",
    "floating_leg_day_count": "Actual360"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

Returns the par swap rate based on today's curve.

📆 Example: Historical Swap Rate

Add valuation_time to calculate the swap rate as it would have been on a past date/time.

params["valuation_time"] = "2025-04-15T12:00:00Z"

This returns the rate using the market data from that exact point in time (in UTC).

🧠 Tips

  • Use "0D" for today, or "2025-12-31" for a fixed date

  • Make sure fixed and floating legs are consistent with your internal pricing

Supported indices include: SOFR, SONIA, 6M EURIBOR, 3M NIBOR, and more. See a full list here

https://bluegamma.apidocumentation.com/reference
https://bluegamma.apidocumentation.com/reference