> For the complete documentation index, see [llms.txt](https://www.bluegamma.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.bluegamma.io/documentation/integrations/api/how-to-guides/fetching-compounded-rfr-rates.md).

# Fetching Compounded RFR Rates

Calculate compounded overnight rates (realised rates) for risk-free rate indices like SOFR, SONIA, and ESTR over any custom period.

The `/compounded_rate` endpoint calculates **realised compounded rates** for overnight risk-free rate (RFR) indices over a specified period. This is the rate you'd use to settle a floating-rate payment based on actual daily fixings.

***

## Example: 90-Day Compounded SOFR

```python
import requests

url = "https://api.bluegamma.io/v1/compounded_rate"
headers = {"x-api-key": "your_api_key"}

params = {
    "index": "SOFR",
    "start_date": "2025-09-17",
    "end_date": "2025-12-16"
}

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

```bash
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SOFR&start_date=2025-09-17&end_date=2025-12-16" \
  -H "x-api-key: your_api_key_here"
```

**Response:**

```json
{
  "start_date": "2025-09-17",
  "end_date": "2025-12-16",
  "index": "SOFR",
  "nominal": 1000000.0,
  "spread": 0.0,
  "day_counter": "Actual360",
  "calendar": "SOFR fixing calendar",
  "lookback_days": 0,
  "lockout_days": 0,
  "apply_observation_shift": false,
  "rate": 4.090541348035881,
  "amount": 10226.353370089702
}
```

| Field         | Description                                                  |
| ------------- | ------------------------------------------------------------ |
| `start_date`  | Start of the compounding period                              |
| `end_date`    | End of the compounding period                                |
| `index`       | The overnight index used                                     |
| `nominal`     | Notional amount (default: 1,000,000)                         |
| `spread`      | Spread added to the rate, as a decimal fraction (default: 0) |
| `day_counter` | Day count convention used                                    |
| `rate`        | The compounded rate as a percentage, including any spread    |
| `amount`      | Interest amount on the notional                              |

***

## Validating Against the New York Fed

The New York Fed publishes official [SOFR Averages](https://www.newyorkfed.org/markets/reference-rates/sofr-averages-and-index) for 30-, 90-, and 180-calendar day periods. You can use these to validate BlueGamma's calculations.

<figure><img src="https://3184259219-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmmQPefoflG1RwUnUKKBR%2Fuploads%2Fgit-blob-03016baf7d78f23ee82e12e8ec9383252aa6b5d8%2Fny-fed-sofr-averages.png?alt=media" alt="New York Fed SOFR Averages page"><figcaption><p>The New York Fed publishes daily SOFR averages for 30, 90, and 180 calendar day periods</p></figcaption></figure>

### Matching the Fed's 90-Day Average

The Fed's 90-day SOFR average for **December 16, 2025** is **4.09054%**.

To replicate this with the BlueGamma API, count back exactly 90 calendar days from December 16:

```python
params = {
    "index": "SOFR",
    "start_date": "2025-09-17",  # 90 days before 12/16
    "end_date": "2025-12-16"
}
```

**BlueGamma returns: `4.090541%`** — matching the Fed's published value.

| Source              | 90-Day Compounded SOFR |
| ------------------- | ---------------------- |
| NY Fed (12/16/2025) | 4.09054%               |
| BlueGamma API       | 4.090541%              |

{% hint style="success" %}
**Exact match.** BlueGamma uses the same compounding methodology as the Fed's SOFR Averages, so results should match when using the correct 90-calendar-day window.
{% endhint %}

***

## Supported Indices

| Index       | Currency | Description                          |
| ----------- | -------- | ------------------------------------ |
| `SOFR`      | USD      | Secured Overnight Financing Rate     |
| `SONIA`     | GBP      | Sterling Overnight Index Average     |
| `ESTR`      | EUR      | Euro Short-Term Rate                 |
| `CORRA`     | CAD      | Canadian Overnight Repo Rate Average |
| `SARON`     | CHF      | Swiss Average Rate Overnight         |
| `TONAR`     | JPY      | Tokyo Overnight Average Rate         |
| `SORA`      | SGD      | Singapore Overnight Rate Average     |
| `CDI`       | BRL      | Brazilian Interbank Deposit Rate     |
| `Fed Funds` | USD      | Federal Funds Effective Rate         |

***

## Optional Parameters

### Spread

Add a fixed spread to the compounded rate. `spread` is a **decimal fraction**: `0.005` adds 50 basis points, and `0.0025` adds 25. Values above 1 are rejected with a `422`. The returned `rate` already includes the spread.

```python
params = {
    "index": "SOFR",
    "start_date": "2025-09-17",
    "end_date": "2025-12-16",
    "spread": 0.005  # Add 50 basis points
}
```

```bash
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SOFR&start_date=2025-09-17&end_date=2025-12-16&spread=0.005" \
  -H "x-api-key: your_api_key_here"
```

### Nominal Amount

Calculate the actual interest amount on a specific notional:

```python
params = {
    "index": "SOFR",
    "start_date": "2025-09-17",
    "end_date": "2025-12-16",
    "nominal": 50000000  # $50 million
}
```

```bash
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SOFR&start_date=2025-09-17&end_date=2025-12-16&nominal=50000000" \
  -H "x-api-key: your_api_key_here"
```

**Response includes:**

```json
{
  "nominal": 50000000.0,
  "rate": 4.090541348035881,
  "amount": 511317.6685044851
}
```

### Lookback and Lockout

For ISDA-style conventions with lookback or lockout periods:

```python
params = {
    "index": "SOFR",
    "start_date": "2025-09-17",
    "end_date": "2025-12-16",
    "lookback_days": 5,    # Use rate from 5 days prior
    "lockout_days": 2      # Freeze rate 2 days before end
}
```

```bash
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SOFR&start_date=2025-09-17&end_date=2025-12-16&lookback_days=5&lockout_days=2" \
  -H "x-api-key: your_api_key_here"
```

***

## Use Cases

### Settling a Floating-Rate Loan Payment

Calculate the interest due on a SOFR-linked loan:

```python
# Loan details
notional = 10_000_000  # $10 million
spread_bps = 150       # SOFR + 150bps

params = {
    "index": "SOFR",
    "start_date": "2024-10-01",  # Interest period start
    "end_date": "2024-12-31",    # Interest period end
    "nominal": notional,
    "spread": spread_bps / 10000  # Decimal fraction: 150bp = 0.015
}

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

# `rate` already includes the spread
print(f"All-in rate (SOFR + 150bp): {data['rate']:.4f}%")
print(f"Interest due: ${data['amount']:,.2f}")
```

```bash
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SOFR&start_date=2024-10-01&end_date=2024-12-31&nominal=10000000&spread=0.015" \
  -H "x-api-key: your_api_key_here"
```

### Comparing SONIA vs SOFR

```python
# Same period for both indices
period_params = {
    "start_date": "2025-09-17",
    "end_date": "2025-12-16"
}

sofr = requests.get(url, headers=headers, params={**period_params, "index": "SOFR"}).json()
sonia = requests.get(url, headers=headers, params={**period_params, "index": "SONIA"}).json()

print(f"SOFR (90-day):  {sofr['rate']:.4f}%")
print(f"SONIA (90-day): {sonia['rate']:.4f}%")
print(f"Spread:         {(sofr['rate'] - sonia['rate']) * 100:.1f} bps")
```

```bash
# SOFR
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SOFR&start_date=2025-09-17&end_date=2025-12-16" \
  -H "x-api-key: your_api_key_here"

# SONIA
curl -X GET "https://api.bluegamma.io/v1/compounded_rate?index=SONIA&start_date=2025-09-17&end_date=2025-12-16" \
  -H "x-api-key: your_api_key_here"
```

***

## Related Endpoints

| If you need...            | Use                                                                                          |
| ------------------------- | -------------------------------------------------------------------------------------------- |
| Daily fixing (single day) | [`/fixing`](/documentation/integrations/api/how-to-guides/fetching-fixing-rates.md)          |
| Forward-looking rates     | [`/forward_rate`](/documentation/integrations/api/how-to-guides/getting-forward-rates.md)    |
| Full forward curve        | [`/forward_curve`](/documentation/integrations/api/how-to-guides/getting-a-forward-curve.md) |

***

Create a key under **API Keys** in the app sidebar. See [Authentication](/documentation/integrations/api/authentication.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.bluegamma.io/documentation/integrations/api/how-to-guides/fetching-compounded-rfr-rates.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
