# Fetching a Swap Curve

A swap curve shows **par swap rates** (fixed rates) across different maturities. When you request a swap rate:

* You specify an **index** (e.g., `6M EURIBOR`, `SOFR`, `SONIA`)
* The API returns the **fixed rate** that makes the swap fair value at inception
* The index determines what floating rate the swap is referenced against

{% hint style="info" %}
**Key Concept:** The index represents the floating leg reference. The rate you receive is the **fixed leg rate** — this is what you'd pay (or receive) on the fixed side of a swap.
{% endhint %}

***

## Example: EUR Swap Curve

For Euro swap curves, use `6M EURIBOR` — the standard floating benchmark for EUR interest rate swaps:

```python
import requests

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

params = {
    "index": "6M EURIBOR"
}

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

print(f"Index: {curve['index_name']}")
print(f"Start Date: {curve['start_date']}")
print(f"\nSwap Rates:")
for point in curve['swap_rates']:
    print(f"  {point['tenor']:>4}: {point['swap_rate']:.2f}%")
```

```bash
curl -X GET "https://api.bluegamma.io/v1/get_swap_curve?index=6M%20EURIBOR" \
  -H "x-api-key: your_api_key_here"
```

**Example Output:**

```
Index: 6M EURIBOR
Start Date: 2025-12-15

Swap Rates:
    1Y: 2.21%
   18M: 2.24%
    2Y: 2.30%
    3Y: 2.41%
    4Y: 2.50%
    5Y: 2.58%
    6Y: 2.65%
    7Y: 2.72%
    8Y: 2.79%
    9Y: 2.85%
   10Y: 2.90%
   15Y: 3.11%
   20Y: 3.19%
   25Y: 3.21%
   30Y: 3.20%
```

***

## Understanding the Response

```json
{
  "index_name": "6M EURIBOR",
  "start_date": "2025-12-15",
  "floating_leg_frequency": "6M",
  "floating_leg_day_count": "Actual360",
  "fixed_leg_frequency": "12M",
  "fixed_leg_day_count": "Thirty360BondBasis",
  "valuation_time": "2025-12-11T09:44:14.838799",
  "swap_rates": [
    {"tenor": "1Y", "swap_rate": 2.21, "timestamp": "2025-12-11T09:43:59"},
    {"tenor": "2Y", "swap_rate": 2.30, "timestamp": "2025-12-11T09:43:59"},
    {"tenor": "5Y", "swap_rate": 2.58, "timestamp": "2025-12-11T09:43:59"},
    {"tenor": "10Y", "swap_rate": 2.90, "timestamp": "2025-12-11T09:43:59"}
  ]
}
```

| Field                    | Description                               |
| ------------------------ | ----------------------------------------- |
| `index_name`             | The floating rate index used              |
| `start_date`             | Settlement date for the swaps             |
| `floating_leg_frequency` | Payment frequency of the floating leg     |
| `floating_leg_day_count` | Day count convention for the floating leg |
| `fixed_leg_frequency`    | Payment frequency of the fixed leg        |
| `fixed_leg_day_count`    | Day count convention for the fixed leg    |
| `swap_rates`             | Array of tenor/rate pairs                 |
| `swap_rate`              | The par swap rate as a percentage         |

***

## Visualizing the Curve

<figure><img src="/files/WvhDVqGVh9z6G504MLQn" alt="EUR 6M EURIBOR Swap Curve"><figcaption><p>EUR 6M EURIBOR swap curve showing par swap rates across tenors</p></figcaption></figure>

***

## Which Index for Which Currency?

| Currency | Index        | Description                          | Use Case                          |
| -------- | ------------ | ------------------------------------ | --------------------------------- |
| **EUR**  | `6M EURIBOR` | 6-Month Euro Interbank Offered Rate  | Standard EUR interest rate swaps  |
| **EUR**  | `ESTR`       | Euro Short-Term Rate                 | EUR overnight indexed swaps (OIS) |
| **USD**  | `SOFR`       | Secured Overnight Financing Rate     | Standard USD swaps (post-LIBOR)   |
| **GBP**  | `SONIA`      | Sterling Overnight Index Average     | Standard GBP swaps                |
| **CHF**  | `SARON`      | Swiss Average Rate Overnight         | Standard CHF swaps                |
| **JPY**  | `TONAR`      | Tokyo Overnight Average Rate         | Standard JPY swaps                |
| **CAD**  | `CORRA`      | Canadian Overnight Repo Rate Average | Standard CAD swaps                |
| **AUD**  | `6M BBSW`    | 6-Month Bank Bill Swap Rate          | Standard AUD swaps                |

{% hint style="info" %}
**EUR Note:** Most EUR interest rate swaps reference **6M EURIBOR** on the floating leg. Use `ESTR` only if you specifically need overnight indexed swap (OIS) rates.
{% endhint %}

{% hint style="success" %}
**Want to try the API?** Get a key and test it in minutes. [Book a demo →](https://app.lemcal.com/@alivohra/website-demo?back=1)
{% endhint %}

***

## Historical Swap Curves

Add `valuation_time` to fetch the curve as of a past date:

```python
params = {
    "index": "6M EURIBOR",
    "valuation_time": "2024-06-30T16:00:00Z"
}

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

```bash
curl -X GET "https://api.bluegamma.io/v1/get_swap_curve?index=6M%20EURIBOR&valuation_time=2024-06-30T16%3A00%3A00Z" \
  -H "x-api-key: your_api_key_here"
```

***

## Alternative: Fetch Individual Swap Rates

If you need more control over leg conventions, use the `/swap_rate` endpoint for individual tenors:

```python
url = "https://api.bluegamma.io/v1/swap_rate"

params = {
    "index": "6M EURIBOR",
    "start_date": "0D",
    "maturity_date": "10Y",
    "fixed_leg_frequency": "1Y",
    "floating_leg_frequency": "6M",
    "fixed_leg_day_count": "30360",
    "floating_leg_day_count": "Actual360"
}

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

```bash
curl -X GET "https://api.bluegamma.io/v1/swap_rate?index=6M%20EURIBOR&start_date=0D&maturity_date=10Y&fixed_leg_frequency=1Y&floating_leg_frequency=6M&fixed_leg_day_count=30360&floating_leg_day_count=Actual360" \
  -H "x-api-key: your_api_key_here"
```

**Response:**

```json
{
  "index": "6M EURIBOR",
  "start_date": "2025-12-15",
  "maturity_date": "2035-12-17",
  "swap_rate": 2.90,
  "fixed_leg_frequency": "1Y",
  "floating_leg_frequency": "6M"
}
```

***

## Swap Curves vs Government Bond Curves

A common question is: **"What's the difference between a swap curve and a government bond curve?"**

|                        | Swap Curve                                      | Government Bond Curve                         |
| ---------------------- | ----------------------------------------------- | --------------------------------------------- |
| **What it represents** | Fixed rate in an interest rate swap             | Yield on sovereign debt                       |
| **Risk profile**       | Interbank/counterparty credit risk              | Sovereign credit risk                         |
| **Common use**         | Hedging floating-rate debt, derivatives pricing | Risk-free rate benchmark, credit spread basis |
| **Typical spread**     | Swaps trade at a spread over government bonds   | Considered the "risk-free" reference          |

**Example Comparison (EUR):**

| Tenor | 6M EURIBOR Swap Rate | German Bund Yield | Swap Spread |
| ----- | -------------------- | ----------------- | ----------- |
| 2Y    | 2.30%                | 2.19%             | +11 bps     |
| 5Y    | 2.58%                | 2.50%             | +8 bps      |
| 10Y   | 2.90%                | 2.90%             | 0 bps       |

> 💡 **Tip:** The swap spread (difference between swap rate and government bond yield) reflects credit and liquidity factors in the interbank market.

***

## Complete Example: Building a Swap Curve DataFrame

```python
import requests
import pandas as pd

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

response = requests.get(url, headers=headers, params={"index": "6M EURIBOR"})
curve = response.json()

df = pd.DataFrame(curve['swap_rates'])
df['swap_rate'] = df['swap_rate'].round(4)

# Filter to key tenors
key_tenors = ['1Y', '2Y', '3Y', '5Y', '7Y', '10Y', '15Y', '20Y', '30Y']
df_filtered = df[df['tenor'].isin(key_tenors)]

print(f"EUR 6M EURIBOR Swap Curve - {curve['valuation_time'][:10]}")
print(df_filtered[['tenor', 'swap_rate']].to_string(index=False))
```

```bash
curl -X GET "https://api.bluegamma.io/v1/get_swap_curve?index=6M%20EURIBOR" \
  -H "x-api-key: your_api_key_here"
```

**Output:**

```
EUR 6M EURIBOR Swap Curve - 2025-12-11
tenor  swap_rate
   1Y     2.2109
   2Y     2.3032
   3Y     2.4128
   5Y     2.5830
   7Y     2.7229
  10Y     2.8996
  15Y     3.1082
  20Y     3.1913
  30Y     3.2020
```

***

## See Also

* [Available Indices](/documentation/integrations/available-indices.md) — Full list of supported indices
* [Fetching a Swap Rate](/documentation/integrations/api/how-to-guides/fetching-a-swap-rate.md) — Get individual swap rates with custom conventions
* [Fetching Historical Swap Rates](https://github.com/Blue-Gamma/BlueGammaUI/blob/development/bluegamma-docs/integrations/api/how-to-guides/fetching-historical-swap-rates.md) — Time series of swap rates

***

**Need an API key?**\
📩 <support@bluegamma.io> | 📅 [Book a call](https://app.lemcal.com/@alivohra/website-demo?back=1)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bluegamma.io/documentation/integrations/api/how-to-guides/fetching-a-swap-curve.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
