Your team needs a reliable, programmatic way to fetch, chart, and compare the Switzerland 10-year government bond yield across intraday and historical horizons. By the end of this guide, you’ll be able to pull the latest CH 10Y, backfill specific dates, build a Swiss yield curve, compute cross-country spreads, and quantify fluctuations — all via the Bonds API, ready to embed in dashboards, quant models, and production services.
What you get from the Bonds API for Switzerland (CH)
The Bonds API delivers sovereign bond yields as concise JSON over HTTPS. For Switzerland (ISO2: CH), you can query:
- Latest yields for one or multiple maturities (e.g., 2Y and 10Y in a single call).
- Historical yields for a specific date (business days and holidays respected).
- Time series between two dates (e.g., to feed charts or estimators).
- Intraday snapshots for market-aware analytics.
- Spreads versus a benchmark country (e.g., CH vs US at 10Y in basis points).
- The full on-the-day Swiss yield curve across bills and bonds.
- Fluctuation statistics — change, min, max — over a chosen window.
Units and formats:
- Yield fields are in percentage points (e.g., 4.52 means 4.52%).
- Spreads are reported as spread_bps in basis points (1 bp = 0.01%).
- Dates are Y-m-d (e.g., 2026-11-19). Timestamps in intraday responses are ISO 8601 with UTC timezone.
Operational notes for production:
- Swiss business days and market holidays affect data availability; historical and timeseries endpoints return data for actual trading days.
- Latest yields update on market days; intraday snapshots provide multiple points across the UTC day with meta.timezone = UTC.
- Cache non-intraday endpoints per symbol-date to reduce latency and mitigate rate limits; consider short-lived caches (e.g., 30–90 seconds) for /latest during trading hours.
Explore the documentation and platform at bonds-api.com, or open the developer console at MCP. When you’re ready, use the Register link to get an API key.
Latest Switzerland yields (including CH 10Y)
Use this to fetch current Swiss yields for selected maturities. You can query multiple maturities in a single call to build a partial curve or power a dashboard card.
Endpoint
GET https://bonds-api.com/api/v1/latest
Required: countries (ISO2 comma-separated). Optional: maturities (e.g., 2Y,10Y). Authentication via X-API-Key header.
cURL
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
Python (requests)
import requests
resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "CH", "maturities": "2Y,10Y"}
)
data = resp.json()
# Access CH 10Y yield (percent) and date (Y-m-d)
ch_10y_yield = data["data"]["CH"]["10Y"]["yield"]
ch_10y_date = data["data"]["CH"]["10Y"]["date"]
print("CH 10Y:", ch_10y_yield, "on", ch_10y_date)
JavaScript (fetch)
async function fetchLatestCH() {
const url = new URL("https://bonds-api.com/api/v1/latest");
url.searchParams.set("countries", "CH");
url.searchParams.set("maturities", "2Y,10Y");
const res = await fetch(url.toString(), {
method: "GET",
headers: { "X-API-Key": "YOUR_API_KEY" }
});
const json = await res.json();
const ch10 = json.data.CH["10Y"];
console.log(`CH 10Y ${ch10.yield}% on ${ch10.date}`);
}
fetchLatestCH();
PHP (file_get_contents)
<?php
$opts = [
"http" => [
"method" => "GET",
"header" => "X-API-Key: YOUR_API_KEY\r\n"
]
];
$context = stream_context_create($opts);
$url = "https://bonds-api.com/api/v1/latest?countries=CH&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
$ch10 = $data["data"]["CH"]["10Y"];
echo "CH 10Y {$ch10["yield"]}% on {$ch10["date"]}\n";
JSON response (sample)
{
"success": true,
"date": "2026-11-19",
"rates": {
"US_10Y": 5.075
},
"dates": {
"US_10Y": "2026-11-19"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "66112815-97f3-4f76-a53f-6e1bef2e5f3a",
"timestamp": "2026-11-19T01:04:05+00:00"
}
}
How to read this:
- yield: percentage value (4.52 means 4.52%).
- date: the market date in Y-m-d for which the yield applies.
- source: provenance metadata; “official” indicates an official source.
Yield on a specific date (point-in-time CH 10Y)
Backfill or audit historical data using the historical endpoint for a single country-maturity-date combination.
Endpoint
GET https://bonds-api.com/api/v1/historical
Required: country (ISO2), maturity (e.g., 10Y), date (Y-m-d).
cURL
Python (requests)
import requests
params = {"country": "CH", "maturity": "10Y", "date": "2025-06-15"}
resp = requests.get("https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
hist = resp.json()
print(hist["country"], hist["maturity"], hist["date"], hist["yield"])
JavaScript (fetch)
async function getCH10YOnDate(d) {
const url = new URL("https://bonds-api.com/api/v1/historical");
url.searchParams.set("country", "CH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", d);
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const json = await res.json();
return json;
}
getCH10YOnDate("2025-06-15").then(console.log);
PHP (file_get_contents)
<?php
$params = http_build_query([
"country" => "CH",
"maturity" => "10Y",
"date" => "2025-06-15"
]);
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$context = stream_context_create($opts);
$url = "https://bonds-api.com/api/v1/historical?$params";
$json = file_get_contents($url, false, $context);
echo $json;
JSON response (sample)
Use this to validate backtests, reconcile end-of-day values, or anchor a research note to a known print.
Time series for Switzerland 10Y
Query a continuous series of CH 10Y yields between two dates. The series contains business-day observations where available.
Endpoint
GET https://bonds-api.com/api/v1/timeseries
Required: country (ISO2), maturity, start (Y-m-d), end (Y-m-d).
cURL
Python (requests)
import requests
params = {
"country": "CH",
"maturity": "10Y",
"start": "2025-11-19",
"end": "2026-11-19"
}
r = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
series = r.json()["series"]
# Example: compute average yield over the window
avg = sum(pt["yield"] for pt in series) / len(series)
print("Obs:", len(series), "Avg:", round(avg, 3))
JavaScript (fetch)
async function getCH10YSeries(start, end) {
const url = new URL("https://bonds-api.com/api/v1/timeseries");
url.searchParams.set("country", "CH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("start", start);
url.searchParams.set("end", end);
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" }});
return res.json();
}
getCH10YSeries("2025-11-19", "2026-11-19").then(console.log);
PHP (file_get_contents)
<?php
$q = http_build_query([
"country" => "CH",
"maturity" => "10Y",
"start" => "2025-11-19",
"end" => "2026-11-19"
]);
$context = stream_context_create([
"http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]
]);
echo file_get_contents("https://bonds-api.com/api/v1/timeseries?$q", false, $context);
JSON response (sample)
Each series element provides date (Y-m-d) and yield (percent). Use this to feed charts, regressions, or rolling analytics (e.g., z-scores, realized vol).
Intraday snapshots for CH 10Y
For market-aware applications, pull multiple CH 10Y snapshots collected throughout a given date. Timestamps are UTC.
Endpoint
GET https://bonds-api.com/api/v1/intraday
Required: country (ISO2), maturity, date (Y-m-d).
cURL
Python (requests)
import requests
from datetime import datetime
p = {"country": "CH", "maturity": "10Y", "date": "2026-11-19"}
r = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p)
j = r.json()
for s in j["snapshots"]:
ts = datetime.fromisoformat(s["fetched_at"].replace("Z","+00:00"))
print(ts.isoformat(), s["yield"], s["source"])
JavaScript (fetch)
async function intradayCH10Y(date) {
const url = new URL("https://bonds-api.com/api/v1/intraday");
url.searchParams.set("country", "CH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", date);
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" }});
const json = await res.json();
json.snapshots.forEach(s => console.log(s.fetched_at, s.yield));
}
intradayCH10Y("2026-11-19");
PHP (file_get_contents)
<?php
$q = http_build_query([
"country" => "CH",
"maturity" => "10Y",
"date" => "2026-11-19"
]);
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$ctx = stream_context_create($opts);
echo file_get_contents("https://bonds-api.com/api/v1/intraday?$q", false, $ctx);
JSON response (sample)
Use fetched_at for sequencing; yields are in percent. Intraday data is ideal for pricing widgets or execution context around macro events.
Spread vs benchmark (CH 10Y vs US 10Y)
Compare Switzerland to a benchmark country at a chosen maturity (default 10Y). The response includes spread in basis points and the underlying yields.
Endpoint
GET https://bonds-api.com/api/v1/spread
Required: country (ISO2), benchmark (ISO2). Optional: maturity (default 10Y).
cURL
Python (requests)
import requests
args = {"country": "CH", "benchmark": "US", "maturity": "10Y"}
r = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params=args)
s = r.json()
print("Spread (bps):", s["spread_bps"],
"CH:", s["country_yield"], "US:", s["benchmark_yield"])
JavaScript (fetch)
async function spreadCHvsUS(maturity="10Y") {
const url = new URL("https://bonds-api.com/api/v1/spread");
url.searchParams.set("country", "CH");
url.searchParams.set("benchmark", "US");
url.searchParams.set("maturity", maturity);
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" }});
return res.json();
}
spreadCHvsUS().then(console.log);
PHP (file_get_contents)
<?php
$q = http_build_query([
"country" => "CH",
"benchmark" => "US",
"maturity" => "10Y"
]);
$h = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
echo file_get_contents("https://bonds-api.com/api/v1/spread?$q", false, stream_context_create($h));
JSON response (sample)
Interpretation: spread_bps = 215 means CH 10Y is 2.15% above the US 10Y in this sample. Use basis points for stable UI formatting and risk rules (e.g., alert at ±25 bps moves).
Full Switzerland yield curve
Pull the on-the-day Swiss yield curve across liquid maturities. Great for curve visualization, slope measures, and spread ladders.
Endpoint
GET https://bonds-api.com/api/v1/curve
Required: country (ISO2). Optional: date (Y-m-d; defaults to latest available).
cURL
Python (requests)
import requests
r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "CH"})
curve = r.json()
tenor_curve = curve["curve"] # dict like {"1M": 5.31, ..., "10Y": 4.52}
print("Date:", curve["date"], "Inverted:", curve["inverted"])
print("10Y:", tenor_curve.get("10Y"))
JavaScript (fetch)
async function getCHCurve(date) {
const url = new URL("https://bonds-api.com/api/v1/curve");
url.searchParams.set("country", "CH");
if (date) url.searchParams.set("date", date);
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" }});
return res.json();
}
getCHCurve().then(console.log);
PHP (file_get_contents)
<?php
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$ctx = stream_context_create($opts);
echo file_get_contents("https://bonds-api.com/api/v1/curve?country=CH", false, $ctx);
JSON response (sample)
Fields:
- inverted: boolean marker if short rates exceed long rates based on provided points.
- curve: tenor-yield mapping, all yields in percent.
To build a curve chart, iterate tenors in ascending order: 1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y. Cache at a daily granularity for end-of-day reports.
Fluctuation over a window (change, min, max)
Use this for quick performance and range summaries, risk checks, and report tables.
Endpoint
GET https://bonds-api.com/api/v1/fluctuation
Required: countries (comma-separated ISO2), maturity, start (Y-m-d), end (Y-m-d).
cURL
Python (requests)
import requests
p = {
"countries": "CH",
"maturity": "10Y",
"start": "2025-11-19",
"end": "2026-11-19"
}
j = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p).json()
ch = j["data"]["CH"]
print("Start:", ch["start_yield"], "End:", ch["end_yield"],
"Change:", ch["change"], "Min:", ch["min"], "Max:", ch["max"])
JavaScript (fetch)
async function fluctuationCH10Y(start, end) {
const u = new URL("https://bonds-api.com/api/v1/fluctuation");
u.searchParams.set("countries", "CH");
u.searchParams.set("maturity", "10Y");
u.searchParams.set("start", start);
u.searchParams.set("end", end);
const res = await fetch(u, { headers: { "X-API-Key": "YOUR_API_KEY" }});
return res.json();
}
fluctuationCH10Y("2025-11-19", "2026-11-19").then(console.log);
PHP (file_get_contents)
<?php
$q = http_build_query([
"countries" => "CH",
"maturity" => "10Y",
"start" => "2025-11-19",
"end" => "2026-11-19"
]);
$h = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
echo file_get_contents("https://bonds-api.com/api/v1/fluctuation?$q", false, stream_context_create($h));
JSON response (sample)
All values are in percent. change is end_yield - start_yield in the same units (percentage points).
Production details: maturities, business days, caching, and curves
- Maturities: Bills and bonds from 1M through long tenors (e.g., 30Y). For CH, the curve endpoint returns a standard set you can chart directly.
- Business days and holidays: Historical and timeseries endpoints return data for available market dates. Some holidays will yield gaps; handle forward/backfill in your application if needed.
- Update frequency: /latest is intended for near real-time on trading days; /intraday provides timestamped snapshots you can poll less frequently (e.g., every 5–10 minutes) and aggregate.
- Caching: Cache per (country, maturity, date) for historical, timeseries, fluctuation; cache per (country) for curve and per (country, maturity) for latest/intraday. Set short TTLs for live endpoints to balance freshness and rate efficiency.
- Building a yield curve: If you only need a subset of points, query /latest with multiple maturities to assemble a partial curve. For the comprehensive set, use /curve, which also provides inverted for quick diagnostics.
Visit bonds-api.com for broader coverage details or to explore other countries you may want to compare against Switzerland.
Error handling and resilience
Error responses share a common shape with success=false and an error message. Handle these at the transport and application layers:
- 401: Missing or invalid X-API-Key — verify the header name and value.
- 403: Account quota exceeded — back off, alert, and review usage.
- 404: No data for the requested combination — check ISO2, maturity, and date.
- 422: Invalid parameter — ensure date format Y-m-d and valid ISO2 codes.
- 429: Rate limit exceeded — apply exponential backoff and caching.
- 500: Server error — retry with jitter; implement circuit breakers.
OFFICIAL sample block
The following official sample is provided as-is for reference and should be copied verbatim when you need to reproduce the same demonstration request/response pair.
Use cases for CH 10Y data
- Financial dashboards: Display headline CH 10Y, intraday changes, and daily chart using /latest, /intraday, and /timeseries.
- Portfolio risk: Monitor spread moves vs US or DE via /spread and trigger alerts in basis points.
- Economic research: Build weekly notes with /curve for slope, /fluctuation for ranges, and specific date prints from /historical.
- Quant analytics: Feed factor models with normalized time series and curve features (e.g., 2s10s, 5s30s, curvature) computed from /latest or /curve.
End-to-end example: assemble a Swiss daily overview
Steps
- Query /latest for CH at 2Y, 5Y, 10Y to show a mini curve and headline CH 10Y.
- Query /intraday for CH 10Y today to plot a sparkline with UTC timestamps.
- Query /spread with CH vs US at 10Y to show cross-market context in bps.
- Query /fluctuation for CH 10Y over the month to show range and change.
- Optionally, query /curve to compute slope metrics (2s10s, 5s30s) and inversion.
This sequence powers a robust “Switzerland 10Y Overview” widget that updates smoothly with caching and graceful error handling.
FAQ
How are yields expressed in the API?
All yield fields are in percent (e.g., 4.52 means 4.52%). Spread values from the /spread endpoint are in basis points (spread_bps), where 1 bp = 0.01%.
What timezone should I assume for timestamps?
Intraday fetched_at timestamps are ISO 8601 in UTC and meta.timezone is UTC. Dates (e.g., in /latest, /historical, /timeseries, /curve) are market dates in Y-m-d.
How do I handle missing days or holidays?
Use /timeseries to retrieve only available business-day observations. If your app requires continuous series, forward- or backfill at the application level with clear labeling.
Can I request multiple maturities at once?
Yes, with /latest you can specify maturities=2Y,5Y,10Y to fetch multiple points in one call. For a complete on-the-day curve, use /curve for Switzerland (CH).
What’s the best way to compute and display spreads?
Use /spread, which returns spread_bps plus the underlying country_yield and benchmark_yield. Display spreads in basis points for readability and consistent alert thresholds.
Ready to integrate the Switzerland 10-year bond yield into your stack? Get your key and start querying in minutes: Register. You can also explore the API interactively via the MCP console, and find additional references at bonds-api.com.