Teams analyzing Taiwan’s sovereign curve often hit the same roadblocks: inconsistent sources, missing holidays, gaps on non-trading days, and formats that don’t drop cleanly into code. By the end of this article, you’ll be able to pull historical and real-time Taiwan (ISO2: TW) bond yields, build and compare yield curves, compute spreads, and integrate the data directly into dashboards or models using the Bonds API.
What you can fetch for Taiwan with the Bonds API
Bonds API provides end-to-end coverage of Taiwan government bond yields across maturities (from bills to long bonds), with endpoints for current values, specific historical dates, continuous time series, spreads, and intraday snapshots. All endpoints are HTTP GET at https://bonds-api.com/api/v1/ and are authenticated with an X-API-Key header. Yields are returned as percentages unless noted otherwise; spreads are in basis points (bps). Dates are Y-m-d and timestamps are in ISO 8601 UTC.
Key endpoints you’ll use for Taiwan (TW):
- /latest — most recent yields by country and maturity
- /historical — yield on a specific date
- /timeseries — continuous series between two dates
- /spread — spread vs a benchmark (e.g., US 10Y) in bps
- /curve — the full yield curve for a given day
- /intraday — same-day yield snapshots with timestamps
- /fluctuation — change, min, max over a range
Visit the documentation and tools any time at bonds-api.com and explore our MCP for interactive tests.
Endpoint: Latest Taiwan government bond yields
Use /latest to fetch the most recent available yields. Specify Taiwan via ISO2 TW. You can filter by specific maturities or request all available maturities for that country. Values are percentages (e.g., 4.52 means 4.52%).
cURL
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
JSON response
{
"success": true,
"date": "2026-11-23",
"rates": {
"US_10Y": 4.948
},
"dates": {
"US_10Y": "2026-11-23"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "e8099bba-2254-43c6-932e-47d6368b3902",
"timestamp": "2026-11-23T00:05:27+00:00"
}
}
How to read it:
- yield: percentage value
- date: trading date in Y-m-d for which the yield is valid
- source: origin label (e.g., official)
Python (requests)
import requests
resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "TW", "maturities": "2Y,10Y"}
)
data = resp.json()
tw_2y = data["data"]["TW"]["2Y"]["yield"]
tw_10y = data["data"]["TW"]["10Y"]["yield"]
asof = data["data"]["TW"]["10Y"]["date"]
print("TW 2Y:", tw_2y, "TW 10Y:", tw_10y, "as of", asof)
JavaScript (fetch)
const url = new URL("https://bonds-api.com/api/v1/latest");
url.searchParams.set("countries", "TW");
url.searchParams.set("maturities", "2Y,10Y");
fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(json => {
const tw = json.data.TW;
console.log("TW 2Y", tw["2Y"].yield, "TW 10Y", tw["10Y"].yield, "as of", tw["10Y"].date);
});
PHP (file_get_contents)
<?php
$ctx = stream_context_create([
"http" => [
"method" => "GET",
"header" => "X-API-Key: YOUR_API_KEY\r\n"
]
]);
$query = http_build_query(["countries" => "TW", "maturities" => "2Y,10Y"]);
$json = file_get_contents("https://bonds-api.com/api/v1/latest?$query", false, $ctx);
$data = json_decode($json, true);
echo "TW 10Y: " . $data["data"]["TW"]["10Y"]["yield"] . "\n";
Endpoint: Historical yield on a specific date
Use /historical when you need the Taiwan yield for one maturity on one date. This is useful for backfilling, point-in-time studies, and benchmark alignment. Yields are percentages; the date you provide is Y-m-d.
cURL
JSON response
Fields:
- country: ISO2 (TW)
- maturity: tenor (e.g., 10Y)
- date: requested day (Y-m-d)
- yield: percentage for that date
Python (requests)
import requests
params = {"country": "TW", "maturity": "10Y", "date": "2025-06-15"}
r = requests.get("https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
j = r.json()
print(j["country"], j["maturity"], j["date"], j["yield"])
JavaScript (fetch)
const urlH = new URL("https://bonds-api.com/api/v1/historical");
urlH.searchParams.set("country", "TW");
urlH.searchParams.set("maturity", "10Y");
urlH.searchParams.set("date", "2025-06-15");
fetch(urlH.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => console.log(j.country, j.maturity, j.date, j.yield));
PHP (GuzzleHttp)
<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://bonds-api.com/api/v1/'
]);
$res = $client->request('GET', 'historical', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'TW', 'maturity' => '10Y', 'date' => '2025-06-15']
]);
echo $res->getBody();
Endpoint: Time series for Taiwan yields
Use /timeseries to retrieve a continuous set of daily yields for a maturity between two dates. This powers charts, rolling regressions, volatility models, and factor backtests. Dates are inclusive; yields are percentages.
cURL
JSON response
Fields:
- series: ordered list of daily points with date (Y-m-d) and yield (percent)
Python (requests)
import requests, pandas as pd
q = {"country": "TW", "maturity": "10Y", "start": "2025-11-23", "end": "2026-11-23"}
r = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"}, params=q)
js = r.json()
df = pd.DataFrame(js["series"]).set_index("date").astype({"yield": float})
print(df.head())
JavaScript (fetch)
const ts = new URL("https://bonds-api.com/api/v1/timeseries");
ts.searchParams.set("country", "TW");
ts.searchParams.set("maturity", "10Y");
ts.searchParams.set("start", "2025-11-23");
ts.searchParams.set("end", "2026-11-23");
const resp = await fetch(ts.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }});
const series = (await resp.json()).series;
console.log(series.slice(0, 3));
PHP (file_get_contents)
<?php
$params = http_build_query([
"country" => "TW", "maturity" => "10Y",
"start" => "2025-11-23", "end" => "2026-11-23"
]);
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$json = file_get_contents("https://bonds-api.com/api/v1/timeseries?$params", false, $ctx);
echo $json;
Endpoint: Spread versus a benchmark
/spread computes the difference between Taiwan and a benchmark country (e.g., US) for a given maturity. Spreads are returned in basis points (1 bps = 0.01%). Example: a spread_bps of 215 means TW is 2.15% above the benchmark for that tenor.
cURL
JSON response
Fields:
- spread_bps: difference in basis points
- country_yield, benchmark_yield: each in percent
Python (requests)
import requests
q = {"country": "TW", "benchmark": "US", "maturity": "10Y"}
r = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"}, params=q)
s = r.json()
print("Spread (bps):", s["spread_bps"])
JavaScript (fetch)
const sp = new URL("https://bonds-api.com/api/v1/spread");
sp.searchParams.set("country", "TW");
sp.searchParams.set("benchmark", "US");
sp.searchParams.set("maturity", "10Y");
fetch(sp.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => console.log(`TW-US 10Y spread: ${j.spread_bps} bps`));
PHP (GuzzleHttp)
<?php
$client = new \GuzzleHttp\Client(['base_uri' => 'https://bonds-api.com/api/v1/']);
$res = $client->request('GET', 'spread', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'TW', 'benchmark' => 'US', 'maturity' => '10Y']
]);
echo $res->getBody();
Endpoint: Full Taiwan yield curve
/curve returns multiple maturities for a single country and date, plus a flag to indicate if the curve is inverted. This is the easiest way to build a complete Taiwan curve for pricing, interpolation, and relative-value screens.
cURL
JSON response
Fields:
- inverted: true if longer maturities yield less than shorter ones
- curve: mapping of maturity to yield (percent)
JavaScript (fetch)
const cv = await fetch("https://bonds-api.com/api/v1/curve?country=TW", {
headers: { "X-API-Key": "YOUR_API_KEY" }
});
const curve = await cv.json();
console.log(curve.date, curve.curve["2Y"], curve.curve["10Y"]);
Python (requests)
import requests
r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TW"})
j = r.json()
tenors = ["1M","3M","6M","1Y","2Y","5Y","10Y","30Y"]
tw_curve = {t: j["curve"].get(t) for t in tenors}
print("Inverted?", j["inverted"], "as of", j["date"])
print(tw_curve)
PHP (file_get_contents)
<?php
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$json = file_get_contents("https://bonds-api.com/api/v1/curve?country=TW", false, $ctx);
echo $json;
Curve overview
| Maturity | Yield (%) on 2026-11-23 |
|---|---|
| 1M | 5.31 |
| 3M | 5.27 |
| 6M | 5.18 |
| 1Y | 4.98 |
| 2Y | 4.25 |
| 5Y | 4.39 |
| 10Y | 4.52 |
| 30Y | 4.71 |
Endpoint: Intraday Taiwan snapshots
/intraday provides multiple same-day yield observations for a maturity. Timestamps (fetched_at) are returned in UTC ISO 8601. Use this for trading dashboards, market monitors, and latency-sensitive alerts.
cURL
JSON response
Fields:
- yield: percent at snapshot time
- fetched_at: ISO 8601 UTC timestamp
- count: number of snapshots delivered
Python (requests)
import requests, pandas as pd
q = {"country": "TW", "maturity": "10Y", "date": "2026-11-23"}
r = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"}, params=q)
j = r.json()
df = pd.DataFrame(j["snapshots"]).astype({"yield": float})
df["fetched_at"] = pd.to_datetime(df["fetched_at"], utc=True)
print(df)
JavaScript (fetch)
const it = new URL("https://bonds-api.com/api/v1/intraday");
it.searchParams.set("country", "TW");
it.searchParams.set("maturity", "10Y");
it.searchParams.set("date", "2026-11-23");
const intraday = await fetch(it.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }});
console.log((await intraday.json()).snapshots);
PHP (GuzzleHttp)
<?php
$client = new \GuzzleHttp\Client(['base_uri' => 'https://bonds-api.com/api/v1/']);
$res = $client->request('GET', 'intraday', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'TW', 'maturity' => '10Y', 'date' => '2026-11-23']
]);
echo $res->getBody();
Endpoint: Fluctuation over a period
/fluctuation summarizes start and end yields, total change, and the min/max reached during the window. Use this to build risk dashboards and alerting on regime shifts.
cURL
JSON response
Fields for each country:
- start_yield, end_yield: percentages on the boundary dates
- change: end minus start (percentage points)
- min, max: extrema within the range
Python (requests)
import requests
q = {"countries": "TW", "maturity": "10Y", "start": "2025-11-23", "end": "2026-11-23"}
r = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"}, params=q)
j = r.json()
print(j["data"]["TW"])
JavaScript (fetch)
const fl = new URL("https://bonds-api.com/api/v1/fluctuation");
fl.searchParams.set("countries", "TW");
fl.searchParams.set("maturity", "10Y");
fl.searchParams.set("start", "2025-11-23");
fl.searchParams.set("end", "2026-11-23");
const out = await fetch(fl.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }});
console.log((await out.json()).data.TW);
PHP (file_get_contents)
<?php
$params = http_build_query([
"countries" => "TW", "maturity" => "10Y",
"start" => "2025-11-23", "end" => "2026-11-23"
]);
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
echo file_get_contents("https://bonds-api.com/api/v1/fluctuation?$params", false, $ctx);
Business-day conventions, update frequency, and caching
Daily endpoints (/latest, /historical, /timeseries, /curve, /fluctuation) align to business days; you should not expect new daily data on Taiwan public holidays or weekends. If you query a non-trading day with /historical and no observation exists, you can receive a 404. Prefer fetching a range with /timeseries and selecting the most recent prior date for robust pipelines.
Update frequency:
- /latest and /curve: refreshed when new official or market data is available for the day; generally one consolidated value per trading day
- /intraday: multiple snapshots throughout the day, UTC timestamps provided
- /spread: computed from underlying current or as-of values
Caching tips:
- Cache daily endpoints by country+maturity+date key; invalidate after end of trading day or when you detect a new as-of date
- Cache /intraday per date and poll with backoff; merge by timestamp to avoid duplicates
- Treat HTTP 404 as “no data for that combination”; do not retry immediately
- Handle 429 (rate limit exceeded) with exponential backoff and jitter
Building a Taiwan yield curve and spreads programmatically
There are two practical approaches:
- Use /curve to retrieve the full curve in one call. This is simplest and includes inverted detection.
- Or use /latest with maturities to fetch a custom subset (e.g., 2Y,5Y,10Y) for a lightweight dashboard refresh.
Example subset with /latest for TW 2Y, 5Y, 10Y:
For spreads, prefer /spread which returns spread_bps and the two underlying yields. You can compute additional cross-country differentials by iterating maturities and storing both the absolute yields and their spreads for charting and alerts.
Sovereign bond fundamentals (quick context)
Government bonds are debt securities issued by a sovereign. The yield reflects expected return to maturity and embeds policy rate expectations, inflation, term premium, and credit/liquidity premia. Short maturities (bills) tend to track policy rates; longer maturities (10Y–30Y) embed expectations and risk premia. Analysts often watch:
- Curve shape and inversion flags (e.g., 2s10s)
- Cross-market spreads in bps versus benchmarks like US Treasuries
- Historical regimes: rolling min/max, breakout levels, volatility
All of the above can be modeled with the Bonds API endpoints covered here. For onboarding and additional guidance, see bonds-api.com and use our MCP to experiment.
Error handling and response shape
All endpoints return JSON. On error, the shape includes success=false and an error message. Common statuses:
- 401: Missing or invalid X-API-Key
- 403: Account quota exceeded
- 404: No data for the requested country/maturity/date
- 422: Invalid parameter (format, ISO2 code, maturity)
- 429: Rate limit exceeded
- 500: Server error
Production tip: always check the success boolean before dereferencing fields. Log both the HTTP status and the error message for triage.
Complete reference recap by endpoint
For quick copying into your integration, here are concise code blocks again for each endpoint in cURL and at least one language binding. All requests use GET and pass authentication via X-API-Key header.
/latest (TW 2Y,10Y)
import requests
response = requests.get(
'https://bonds-api.com/api/v1/latest',
headers={'X-API-Key': 'YOUR_API_KEY'},
params={'countries': 'TW', 'maturities': '2Y,10Y'}
)
print(response.json())
/historical (TW 10Y on 2025-06-15)
fetch("https://bonds-api.com/api/v1/historical?country=TW&maturity=10Y&date=2025-06-15", {
headers: { "X-API-Key": "YOUR_API_KEY" }
}).then(r => r.json()).then(console.log);
/timeseries (TW 10Y, range)
<?php
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
echo file_get_contents("https://bonds-api.com/api/v1/timeseries?country=TW&maturity=10Y&start=2025-11-23&end=2026-11-23", false, $ctx);
/spread (TW vs US, 10Y)
import requests
r = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TW", "benchmark": "US", "maturity": "10Y"})
print(r.json())
/curve (TW full curve)
fetch("https://bonds-api.com/api/v1/curve?country=TW", {
headers: { "X-API-Key": "YOUR_API_KEY" }
}).then(r => r.json()).then(console.log);
/intraday (TW 10Y on date)
import requests
r = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TW", "maturity": "10Y", "date": "2026-11-23"})
print(r.json())
/fluctuation (TW 10Y, range)
fetch("https://bonds-api.com/api/v1/fluctuation?countries=TW&maturity=10Y&start=2025-11-23&end=2026-11-23", {
headers: { "X-API-Key": "YOUR_API_KEY" }
}).then(r => r.json()).then(console.log);
Real-world use cases
- Portfolio risk: monitor TW 2s10s slope and flag inversions using /curve and /latest
- Macro research: run event windows around CBC policy meetings with /timeseries and /fluctuation
- RV dashboards: track TW vs US 10Y spreads with /spread and intraday moves with /intraday
- Pricing tools: interpolate Taiwan points from /curve, or fetch a targeted set of tenors using /latest
Implementation notes for production
- Units: yields are percentages; spreads are basis points
- Dates: Y-m-d; intraday timestamps are UTC ISO 8601
- Holidays: expect gaps on weekends and Taiwan market holidays; prefer /timeseries for resilience
- Validation: check success==true; handle 404 and 422 gracefully
- Idempotence: all reads are GET; avoid sending secrets in URLs—use the X-API-Key header
FAQ
Q: What timezone are timestamps in?
A: All intraday timestamps (fetched_at) are UTC ISO 8601. Dates in daily endpoints are Y-m-d without a time component.
Q: How should I compute a daily close if there are multiple intraday snapshots?
A: Use /latest or /curve for a consolidated daily close. If you must derive from /intraday, select the last snapshot per date in UTC or your chosen local-market cutoff consistently.
Q: What do I do on Taiwan public holidays?
A: Expect no new daily observations. Use /timeseries to retrieve the last available business day and carry it forward for non-trading days in your UI if needed.
Q: Why am I getting 422 or 404?
A: 422 indicates bad parameters (unknown ISO2, malformed date, or tenor). 404 means no data exists for that country/maturity/date. Verify TW as the ISO2, use maturities like 2Y/10Y, and ensure the date is Y-m-d.
Q: Can I request multiple Taiwan maturities in one call?
A: Yes. Use /latest with countries=TW and maturities=comma-separated list. For the full curve, use /curve.
Start integrating Taiwan yield data into your models and dashboards today. Get an API key with a quick signup: Register. For hands-on exploration and testing, open the MCP.