API to Get Taiwan Bond Yields

API to Get Taiwan Bond Yields

Teams building fixed-income dashboards and models often struggle to source reliable Taiwan government bond yields in a developer-friendly way. In this guide you will learn how to fetch current Taiwan yields, query historical points, build time series and curves, calculate spreads, and work with intraday snapshots using the Bonds API over simple GET requests—ready to embed in analytics, research notebooks, and fintech apps.

What you can do with the Taiwan sovereign bond endpoints

Bonds API serves sovereign bond yields as JSON, covering Taiwan (ISO2: TW) across bills and bonds from 1M to long tenors. Yields are expressed in percent (e.g., 4.52 means 4.52%). Dates are provided in Y-m-d (e.g., 2026-11-08). Intraday timestamps are ISO 8601 in UTC. With the endpoints below you can:

Illustration: API to Get Taiwan Bond Yields
  • Pull the latest Taiwan yields for one or many maturities.
  • Query a historical yield on a specific date.
  • Download a time series between two dates for backtests and factor models.
  • Compute Taiwan vs. a benchmark (e.g., U.S. Treasuries) in basis points.
  • Get the full Taiwan yield curve on the latest available business day (or a chosen date).
  • Inspect intraday yield snapshots for high-frequency monitoring.
  • Summarize change, min, and max over a period to assess regime shifts.

All endpoints use GET and the base URL https://bonds-api.com/api/v1/. Authentication is provided via the X-API-Key header. Explore more at bonds-api.com and the MCP. When you are ready to integrate, use Register to obtain an API key.

Key conventions you will use

  • Units: yield values are percentages, not decimals or basis points.
  • Spreads: spread_bps fields are in basis points (1 bp = 0.01%).
  • Dates: Y-m-d for daily data, and ISO 8601 UTC timestamps in intraday responses.
  • Business days: daily yields are for business days; market holidays and weekends will not produce new daily values. The API returns the latest available business day when applicable.
  • Caching: cache daily endpoints for the trading day and intraday snapshots for your refresh cadence; respect 429 responses by backing off.

Endpoint: Latest Taiwan yields

Fetch current Taiwan government bond yields. Use maturities to specify desired tenors; omit to fetch all available.

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-06",
    "rates": {
        "US_10Y": 4.86
    },
    "dates": {
        "US_10Y": "2026-11-06"
    },
    "currencies": {
        "US_10Y": "USD"
    },
    "meta": {
        "request_id": "b0e5153f-80d8-44cb-ac60-ce7b7e340a3a",
        "timestamp": "2026-11-08T00:06:22+00:00"
    }
}

Field notes:

  • data.TW.2Y.yield and data.TW.10Y.yield are percent yields (e.g., 4.52%).
  • date is the quote date in Y-m-d; source indicates data provenance.

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"}
)
resp.raise_for_status()
data = resp.json()
tw10 = data["data"]["TW"]["10Y"]["yield"]
tw10_date = data["data"]["TW"]["10Y"]["date"]
print("TW 10Y:", tw10, "on", tw10_date)

JavaScript (fetch)

const url = new URL("https://bonds-api.com/api/v1/latest");
url.search = new URLSearchParams({ countries: "TW", maturities: "2Y,10Y" });

fetch(url.toString(), {
method: "GET",
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
const y = json.data.TW["10Y"].yield;
const d = json.data.TW["10Y"].date;
console.log(`TW 10Y: ${y}% on ${d}`);
});

PHP (file_get_contents)

<?php
$context = stream_context_create([
"http" => [
"method" => "GET",
"header" => "X-API-Key: YOUR_API_KEY\r\n"
]
]);
$url = "https://bonds-api.com/api/v1/latest?countries=TW&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
$yield = $data["data"]["TW"]["10Y"]["yield"];
$date = $data["data"]["TW"]["10Y"]["date"];
echo "TW 10Y $yield% on $date";
?>

Endpoint: Historical yield for a specific date

Retrieve the Taiwan yield for a given maturity on a single date. Useful for point-in-time analytics or event studies.

cURL

JSON response

Field notes:

  • yield is percent; if the date is a non-business day, expect a 404 for no data.
  • date is the request-specified Y-m-d for the quote.

Python

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)
r.raise_for_status()
j = r.json()
print(j["country"], j["maturity"], j["yield"], j["date"])

JavaScript

const p = { country: "TW", maturity: "10Y", date: "2025-06-15" };
const u = "https://bonds-api.com/api/v1/historical?" + new URLSearchParams(p);

fetch(u, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => console.log(j.country, j.maturity, j.yield, j.date));

PHP

<?php
$q = http_build_query(["country" => "TW", "maturity" => "10Y", "date" => "2025-06-15"]);
$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/historical?$q", false, $ctx);
?>

Endpoint: Time series between two dates

Fetch a daily series for Taiwan, suitable for regressions, carry/roll analyses, and performance attribution.

cURL

JSON response

Field notes:

  • series is an array of business-day points; yield in percent, date in Y-m-d.
  • No snapshots on weekends/holidays; missing days are simply absent.

Python

import requests, pandas as pd
p = {"country": "TW", "maturity": "10Y", "start": "2025-11-08", "end": "2026-11-08"}
r = requests.get("https://bonds-api.com/api/v1/timeseries", headers={"X-API-Key": "YOUR_API_KEY"}, params=p)
r.raise_for_status()
s = r.json()["series"]
df = pd.DataFrame(s).set_index("date").astype({"yield": "float"})
print(df.head())

JavaScript

const params = { country: "TW", maturity: "10Y", start: "2025-11-08", end: "2026-11-08" };
const urlTs = "https://bonds-api.com/api/v1/timeseries?" + new URLSearchParams(params);
const hdrs = { "X-API-Key": "YOUR_API_KEY" };

const res = await fetch(urlTs, { headers: hdrs });
const js = await res.json();
const series = js.series.map(pt => [pt.date, pt.yield]);

PHP

<?php
$params = http_build_query([
"country" => "TW", "maturity" => "10Y",
"start" => "2025-11-08", "end" => "2026-11-08"
]);
$ctx = stream_context_create(["http" => ["method" => "GET", "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 vs. benchmark

Measure Taiwan yield relative to a benchmark country (e.g., U.S.). Results are in basis points.

cURL

JSON response

Field notes:

  • spread_bps: basis points difference (TW minus benchmark).
  • country_yield and benchmark_yield are in percent.

Python

import requests
p = {"country": "TW", "benchmark": "US", "maturity": "10Y"}
j = requests.get("https://bonds-api.com/api/v1/spread", headers={"X-API-Key": "YOUR_API_KEY"}, params=p).json()
print(f"TW vs US 10Y spread: {j['spread_bps']} bps")

JavaScript

const pSpread = { country: "TW", benchmark: "US", maturity: "10Y" };
const uSpread = "https://bonds-api.com/api/v1/spread?" + new URLSearchParams(pSpread);

fetch(uSpread, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => console.log(`Spread: ${j.spread_bps} bps`));

PHP

<?php
$q = http_build_query(["country" => "TW", "benchmark" => "US", "maturity" => "10Y"]);
$ctx = 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/spread?$q", false, $ctx);
?>

Endpoint: Full Taiwan yield curve

Get a curve snapshot for Taiwan on the latest available day or for a specified date. This is the most direct way to construct a multi-tenor curve for pricing and risk.

cURL

JSON response

Field notes:

  • curve: maturities mapped to yields in percent.
  • inverted: true if short-end exceeds long-end based on API’s internal check.

Building a curve with multiple symbols

While /curve returns the full set at once, you can also call /latest with multiple maturities to construct a partial curve, which is useful if you only need specific tenors for a visualization or hedge model.

Maturity Use case
1M, 3M, 6MCash laddering, discounting short cash flows
1Y, 2YShort bond hedges, policy rate expectations
5Y, 10YBenchmark mid-curve pricing, duration exposure
30YLong-duration risk, ALM, convexity

Python

import requests
j = requests.get("https://bonds-api.com/api/v1/curve", headers={"X-API-Key": "YOUR_API_KEY"}, params={"country": "TW"}).json()
curve = j["curve"]
tenors = ["1M","3M","6M","1Y","2Y","5Y","10Y","30Y"]
print([ (t, curve.get(t)) for t in tenors ])

JavaScript

const uCurve = "https://bonds-api.com/api/v1/curve?country=TW";
const cj = await fetch(uCurve, { headers: { "X-API-Key": "YOUR_API_KEY" } }).then(r => r.json());
console.log("Inverted:", cj.inverted, "Date:", cj.date, "10Y:", cj.curve["10Y"]);

PHP

<?php
$ctx = 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/curve?country=TW", false, $ctx);
?>

Endpoint: Intraday yield snapshots

Monitor Taiwan yields during the trading day. Useful for dashboards, alerts, and liquidity screens.

cURL

JSON response

Field notes:

  • snapshots[].yield is percent; fetched_at is ISO 8601 UTC.
  • count is the number of intraday observations returned for the requested date.

Python

import requests
p = {"country": "TW", "maturity": "10Y", "date": "2026-11-08"}
j = requests.get("https://bonds-api.com/api/v1/intraday", headers={"X-API-Key": "YOUR_API_KEY"}, params=p).json()
pts = [(s["fetched_at"], s["yield"]) for s in j["snapshots"]]
print(pts)

JavaScript

const prms = { country: "TW", maturity: "10Y", date: "2026-11-08" };
const urlIntra = "https://bonds-api.com/api/v1/intraday?" + new URLSearchParams(prms);

fetch(urlIntra, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => j.snapshots.forEach(s => console.log(s.fetched_at, s.yield)));

PHP

<?php
$q = http_build_query(["country" => "TW", "maturity" => "10Y", "date" => "2026-11-08"]);
$ctx = 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/intraday?$q", false, $ctx);
?>

Endpoint: Fluctuation over a period

Summarize change, min, and max for Taiwan yields between two dates—ideal for risk reports and monthly reviews.

cURL

JSON response

Field notes:

  • All values are in percent. change = end_yield - start_yield.
  • min and max are extrema over the period on business days.

Python

import requests
p = {"countries": "TW", "maturity": "10Y", "start": "2025-11-08", "end": "2026-11-08"}
j = requests.get("https://bonds-api.com/api/v1/fluctuation", headers={"X-API-Key": "YOUR_API_KEY"}, params=p).json()
tw = j["data"]["TW"]
print(f"Δ: {tw['change']}%, min: {tw['min']}%, max: {tw['max']}%")

JavaScript

const pFluc = { countries: "TW", maturity: "10Y", start: "2025-11-08", end: "2026-11-08" };
const uFluc = "https://bonds-api.com/api/v1/fluctuation?" + new URLSearchParams(pFluc);

const jsn = await fetch(uFluc, { headers: { "X-API-Key": "YOUR_API_KEY" } }).then(r => r.json());
const tw = jsn.data.TW;
console.log(`Change: ${tw.change}%, Min: ${tw.min}%, Max: ${tw.max}%`);

PHP

<?php
$q = http_build_query(["countries" => "TW", "maturity" => "10Y", "start" => "2025-11-08", "end" => "2026-11-08"]);
$ctx = 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/fluctuation?$q", false, $ctx);
?>

Error handling and reliability

Common error responses share the same shape with success=false and an error message:

  • 401: Missing or invalid X-API-Key
  • 403: Account quota exceeded
  • 404: No data for requested country/maturity/date
  • 422: Invalid parameter (e.g., date format not Y-m-d, unknown ISO2)
  • 429: Rate limit exceeded (back off and retry later)
  • 500: Server error (temporary)

Recommendations:

  • Validate ISO2 and maturities client-side before sending the request.
  • Use request retries with jitter only for idempotent GETs on 429/500; do not retry on 401/422 without fixing inputs.
  • Cache daily responses for the quote date; cache intraday for your dashboard’s refresh interval.

Fundamentals: Sovereign bonds and Taiwan use cases

Sovereign bonds are debt securities issued by national governments. Their yields summarize expected policy paths, inflation, term premium, and risk. For Taiwan, analysts often:

  • Track the 2Y vs. 10Y slope as a growth signal and for curve positioning.
  • Monitor 10Y spreads to U.S. Treasuries to gauge cross-border relative value.
  • Construct discount curves for pricing local-currency cash flows.
  • Study regime shifts with fluctuation stats (min/max/change) over macro windows.

Once integrated, you can embed these analytics into internal tools across research, risk, and trading. Refer to bonds-api.com for platform context and documentation links, and use the MCP for programmatic testing.

Compatibility note: Official sample block

The following official sample blocks are provided verbatim for reference. They are copy-pasteable as-is and demonstrate a latest-yield request and response shape.

cURL (official sample)

JSON (official sample)

Interpretation tips:

  • rates.US_10Y is a percent yield.
  • date and dates.US_10Y are Y-m-d; meta.timestamp is ISO 8601 with timezone.

Putting it together: Practical workflows

Build a Taiwan curve and slope indicator

  • Call /curve for TW and read curve["2Y"] and curve["10Y"].
  • Compute slope = curve["10Y"] - curve["2Y"] (percent points).
  • Cache the curve for the trading day; recompute slope after the daily update.

Daily dashboard with intraday overlays

  • Use /latest for TW 10Y once on page load to show the reference level.
  • Poll /intraday for TW 10Y snapshots to draw a time-of-day line chart; timestamps are UTC—convert to user timezone in the client.

Cross-market relative value

  • Call /spread with country=TW, benchmark=US, maturity=10Y.
  • Display spread_bps in a sortable table; positive implies TW > US.
  • Augment with a time series by computing spreads from two /timeseries calls if needed historically.

Backtesting regime analysis

  • Pull a 10Y /timeseries for the full backtest window.
  • Compute rolling vol and drawdowns; verify extremes match /fluctuation min/max.

Business days, holidays, updates, and caching

Bonds API’s daily endpoints align with market business days. Taiwan market holidays and weekends will not yield new daily entries; the latest endpoints will reference the most recent business day with data. Intraday snapshots are provided on trading days and include UTC timestamps for alignment across regions.

Operational guidelines:

  • Cache-daily: Cache /latest, /curve, and single-day /historical responses keyed by country, maturity (if present), and date.
  • Cache-intraday: For /intraday, select a refresh interval compatible with your UI (e.g., every 5–15 minutes), and avoid redundant requests.
  • Backoff: On 429, implement exponential backoff and surface a lightweight “data delayed” message.

Security and request patterns

  • Send your API key in the X-API-Key header on all requests.
  • Prefer HTTPS endpoints under https://bonds-api.com/api/v1/ exclusively.
  • Log success=false responses with request parameters to speed up debugging.

FAQ

How are yields expressed?
Yields are percentages, e.g., 4.52 means 4.52%. Spreads from /spread are in basis points.

What timezone are timestamps in?
Daily dates are Y-m-d (date only). Intraday fetched_at fields are ISO 8601 timestamps in UTC.

Do I get data on weekends and holidays?
No new daily values are produced for non-business days. Use the latest-available day for dashboards and clearly display the date.

Can I build a custom curve from selected maturities?
Yes. Call /latest with countries=TW and a comma-separated maturities list (e.g., 2Y,5Y,10Y), or use /curve for the full set at once.

What errors should I handle?
Handle 401 (auth), 422 (bad parameters), 404 (no data for that date), 429 (rate limit), and 500 (temporary). Back off on 429, and correct inputs for 401/422/404.

Ready to integrate Taiwan sovereign yields into your models and tools? Get an API key and start building today: Get started with Bonds API. You can also browse endpoints interactively via the Bonds API MCP.

Start building with bond data today

Get your API key and access sovereign bond yields across 60+ countries. 7-day free trial, no credit card required.