Building a Historical Time Series
How to retrieve historical swap rate data using the BlueGamma API, whether you need daily end-of-day snapshots or intraday granularity.
If you need a time series of swap rates over days, weeks, or months, the BlueGamma API offers two approaches depending on the granularity you need.
Option 1: Daily snapshots with /historical_swap_rates
The /historical_swap_rates endpoint returns daily swap rates for a given index and tenor across a date range in a single call. This is the simplest way to build a time series.
import requests
url = "https://api.bluegamma.io/v1/historical_swap_rates"
headers = {"x-api-key": "your_api_key_here"}
params = {
"index": "SOFR",
"tenor": "5Y",
"start_date": "2026-03-23",
"end_date": "2026-03-27"
}
response = requests.get(url, headers=headers, params=params)
data = response.json()
for point in data["swap_rates"]:
print(f"{point['date']}: {point['rate']:.4f}%")Response:
Parameters
index
Yes
Interest rate index (e.g., SOFR, SONIA, 6M EURIBOR)
tenor
Yes
Swap tenor (e.g., 1Y, 5Y, 10Y)
start_date
Yes
Start of the date range, inclusive (ISO 8601 format: YYYY-MM-DD)
end_date
Yes
End of the date range, inclusive (ISO 8601 format: YYYY-MM-DD)
Response fields
index_name
The index requested
currency
Currency of the swap
fixed_leg_day_count
Day count convention used for the fixed leg
floating_leg_day_count
Day count convention used for the floating leg
fixed_leg_frequency
Payment frequency of the fixed leg
floating_leg_frequency
Payment frequency of the floating leg
swap_rates
Array of rate snapshots, each with rate, date, and tenor
Option 2: Intraday time series with /swap_rate + valuation_time
If you need rates at specific times during the day, use the /swap_rate endpoint with the valuation_time parameter. Each call returns a single rate, so you loop through your desired timestamps.
Response:
Which approach should I use?
/historical_swap_rates
/swap_rate + valuation_time
Granularity
Daily
Any (hourly, per-minute, etc.)
API calls
1 call per date range
1 call per timestamp
Best for
End-of-day charts, trend analysis, reporting
Intraday monitoring, precise point-in-time valuations
Conventions
Uses market-standard conventions for each index
You specify leg frequencies and day counts
Date range
Any historical range
Any historical timestamp
Practical example: 1-year daily chart

Related Endpoints
A single live swap rate
A full swap curve (all tenors)
Forward rate curves
Need an API key? Book a demo | support@bluegamma.io
Last updated
Was this helpful?

