Thailand Yield Curve

Thailand Yield Curve

Problem: You need a reliable, programmatic way to fetch Thailand government bond yields to compute daily curves, monitor intraday moves, and analyze spreads—then embed those numbers in your dashboards, risk tools, or research notebooks. By the end of this article, you will be able to pull Thailand (TH) yields across maturities from Bonds API, build a yield curve, compute spreads vs. benchmarks, and manage details like business days, update frequency, and caching.

What you get from Bonds API for Thailand (TH)

Bonds API provides sovereign bond yields for over 60 countries, exposed as JSON over a REST interface. For Thailand (ISO2: TH), you can request:

Illustration: Thailand Yield Curve
  • Latest yields by maturity (e.g., 1M to 30Y, where available)
  • Historical yields for a given date
  • Daily time series between two dates
  • Intraday snapshots for a specific maturity and day
  • Spreads in basis points to a benchmark country (e.g., US 10Y)
  • A pre-assembled yield curve snapshot for a date
  • Fluctuation stats (change, min, max) for a period

All yields are returned as percentages (e.g., 4.52 means 4.52%). Spreads are returned in basis points (bps). Dates use the Y-m-d format (e.g., 2026-10-31). Timestamps in intraday snapshots are UTC ISO 8601 (e.g., 2026-10-31T12:00:00Z). Review endpoints in the documentation and explore interactively via the MCP. To obtain an API key, use Register.

Working assumptions that save you time

  • All requests use GET at base URL: https://bonds-api.com/api/v1/.
  • Authenticate via X-API-Key header (never as a query parameter).
  • Business days: If you query a holiday or weekend, “latest” returns the most recent trading day; historical endpoints expect a valid market date or return a 404.
  • Update frequency: Latest and curve endpoints return the most recent available official or market-sourced yields for the day. Intraday snapshots update throughout the trading day (UTC timestamps).
  • Caching: Cache “latest” and “curve” for several minutes in production dashboards; intraday should use shorter TTLs (e.g., 30–60 seconds) during trading hours.

Endpoint: Latest yields for Thailand

Use /latest to fetch up-to-date yields. You can specify one or more maturities or omit to retrieve all available. Yields are percentages; date is the market date of the quote.

cURL

curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"

JSON response (official example)

{
    "success": true,
    "date": "2026-10-30",
    "rates": {
        "US_10Y": 4.94
    },
    "dates": {
        "US_10Y": "2026-10-30"
    },
    "currencies": {
        "US_10Y": "USD"
    },
    "meta": {
        "request_id": "10c646dc-cc48-4871-900e-ab08a54410a6",
        "timestamp": "2026-10-31T00:07:15+00:00"
    }
}

Interpretation:

  • yield: Percent (e.g., 4.52 = 4.52%)
  • date: Market date (Y-m-d)
  • source: “official” or “market” origin of the quote

Python (requests)

import requests

resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "TH", "maturities": "2Y,10Y"}
)
data = resp.json()
th_2y = data["data"]["TH"]["2Y"]["yield"]
th_10y = data["data"]["TH"]["10Y"]["yield"]
asof = data["data"]["TH"]["10Y"]["date"]
print("TH 2Y:", th_2y, "TH 10Y:", th_10y, "as of", asof)

JavaScript (fetch)

async function fetchLatestTH() {
const url = new URL("https://bonds-api.com/api/v1/latest");
url.searchParams.set("countries", "TH");
url.searchParams.set("maturities", "2Y,10Y");
const res = await fetch(url, {
headers: { "X-API-Key": "YOUR_API_KEY" }
});
const json = await res.json();
const th = json.data.TH;
console.log("TH 2Y", th["2Y"].yield, "TH 10Y", th["10Y"].yield, "date", th["10Y"].date);
}
fetchLatestTH();

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=TH&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
$y2 = $data["data"]["TH"]["2Y"]["yield"];
$y10 = $data["data"]["TH"]["10Y"]["yield"];
echo "TH 2Y: $y2, TH 10Y: $y10\n";

Official sample (verbatim)

The following sample reflects a different response schema that may appear in certain environments. It is provided verbatim.

In this sample:

  • rates: Yield as percent (e.g., 4.94 = 4.94%)
  • dates: Market date per symbol
  • meta.timestamp: UTC ISO 8601

Endpoint: Historical yield for a specific date

Use /historical to obtain the yield for one maturity on a given market date. Returns success, country, maturity, date, yield, and source.

cURL

JSON response (official example)

Python

import requests

resp = requests.get(
"https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TH", "maturity": "10Y", "date": "2025-06-15"}
)
j = resp.json()
print(j["country"], j["maturity"], j["date"], j["yield"])

JavaScript

async function getTHHistorical() {
const url = new URL("https://bonds-api.com/api/v1/historical");
url.searchParams.set("country", "TH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", "2025-06-15");
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const j = await res.json();
console.log(j.country, j.maturity, j.date, j.yield);
}
getTHHistorical();

PHP

<?php
$context = stream_context_create([
"http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]
]);
$url = "https://bonds-api.com/api/v1/historical?country=TH&maturity=10Y&date=2025-06-15";
$data = json_decode(file_get_contents($url, false, $context), true);
echo $data["country"]." ".$data["maturity"]." ".$data["date"]." ".$data["yield"]."\n";

Endpoint: Time series between dates

Use /timeseries to retrieve daily yields over a date range for a single maturity. Useful for backtests, regressions, or charting.

cURL

JSON response (official example)

Python

import requests

params = {"country": "TH", "maturity": "10Y", "start": "2025-10-31", "end": "2026-10-31"}
resp = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
ts = resp.json()["series"]
print("Count:", len(ts), "First:", ts[0]["date"], ts[0]["yield"])

JavaScript

async function getTHTimeseries() {
const url = new URL("https://bonds-api.com/api/v1/timeseries");
url.searchParams.set("country", "TH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("start", "2025-10-31");
url.searchParams.set("end", "2026-10-31");
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const j = await res.json();
console.log("Series points:", j.series.length);
}
getTHTimeseries();

PHP

<?php
$ctx = stream_context_create(["http" => ["method" => "GET","header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/timeseries?country=TH&maturity=10Y&start=2025-10-31&end=2026-10-31";
$j = json_decode(file_get_contents($url, false, $ctx), true);
echo "Points: ".count($j["series"])."\n";

Endpoint: Spread vs. benchmark

Use /spread to compute the yield spread of Thailand vs. a benchmark country (e.g., US). Returns spread in basis points, along with the underlying yields.

cURL

JSON response (official example)

Interpretation:

  • spread_bps: Difference in basis points (1 bp = 0.01%). Here, 215 bps = 2.15%.
  • country_yield, benchmark_yield: Percent yields used to compute the spread.

Python

import requests

resp = requests.get(
"https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TH", "benchmark": "US", "maturity": "10Y"}
)
j = resp.json()
print("Spread (bps):", j["spread_bps"], "TH:", j["country_yield"], "US:", j["benchmark_yield"])

JavaScript

async function thVsUsSpread() {
const url = new URL("https://bonds-api.com/api/v1/spread");
url.searchParams.set("country", "TH");
url.searchParams.set("benchmark", "US");
url.searchParams.set("maturity", "10Y");
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const j = await res.json();
console.log(`TH- US 10Y spread: ${j.spread_bps} bps`);
}
thVsUsSpread();

PHP

<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/spread?country=TH&benchmark=US&maturity=10Y";
$j = json_decode(file_get_contents($url, false, $ctx), true);
echo "Spread bps: ".$j["spread_bps"]."\n";

Endpoint: Full yield curve

Use /curve to get a full curve snapshot for Thailand. Helpful for bootstrapping, curve visualization, and shape diagnostics (e.g., inversion).

cURL

JSON response (official example)

Interpretation:

  • curve: Maturity-to-yield map in percent.
  • inverted: True if shorter maturities are higher than longer ones for meaningful segments.
  • date: Market date (Y-m-d) for the snapshot.

Available maturities (example)

MaturityComment
1M, 3M, 6MT-bill tenors (money-market segment)
1Y, 2YFront-end of the curve
5Y, 10YBenchmark mid-to-long segment
30YLong-end

Python

import requests

r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TH"})
c = r.json()
tenors = ["1M","3M","6M","1Y","2Y","5Y","10Y","30Y"]
curve = [(t, c["curve"].get(t)) for t in tenors]
print("Curve date:", c["date"], "Inverted:", c["inverted"])
for t, y in curve:
print(t, y)

JavaScript

async function getTHCurve() {
const url = new URL("https://bonds-api.com/api/v1/curve");
url.searchParams.set("country", "TH");
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const j = await res.json();
console.log("Date:", j.date, "Inverted:", j.inverted, "10Y:", j.curve["10Y"]);
}
getTHCurve();

PHP

<?php
$ctx = stream_context_create(["http" => ["method" => "GET","header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/curve?country=TH";
$j = json_decode(file_get_contents($url, false, $ctx), true);
echo "As of ".$j["date"]." TH 10Y: ".$j["curve"]["10Y"]."%\n";

Endpoint: Intraday snapshots

Use /intraday to monitor day-of moves for a chosen maturity. Timestamps are UTC; yields are percentages. Useful for execution monitors or alerting.

cURL

JSON response (official example)

Interpretation:

  • snapshots[].yield: Percent
  • snapshots[].fetched_at: UTC timestamp
  • count: Snapshot count returned
  • meta.timezone: Timezone context (UTC)

Python

import requests

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

JavaScript

async function thIntraday() {
const url = new URL("https://bonds-api.com/api/v1/intraday");
url.searchParams.set("country", "TH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", "2026-10-31");
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const j = await res.json();
console.log("Snapshots:", j.count, "First:", j.snapshots[0].fetched_at, j.snapshots[0].yield);
}
thIntraday();

PHP

<?php
$ctx = stream_context_create(["http" => ["method" => "GET","header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/intraday?country=TH&maturity=10Y&date=2026-10-31";
$j = json_decode(file_get_contents($url, false, $ctx), true);
echo "Count: ".$j["count"].", First stamp: ".$j["snapshots"][0]["fetched_at"]."\n";

Endpoint: Fluctuation (change, min, max)

Use /fluctuation to summarize how a maturity moved over a period, returning the start/end yields, absolute change (percent), and min/max during the window.

cURL

JSON response (official example)

Interpretation:

  • start_yield, end_yield: Percent yields for the period endpoints.
  • change: Absolute percentage point change (end - start).
  • min, max: Extremes during the period.

Python

import requests

params = {"countries": "TH", "maturity": "10Y", "start": "2025-10-31", "end": "2026-10-31"}
r = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
j = r.json()["data"]["TH"]
print("Δ (pp):", j["change"], "Min:", j["min"], "Max:", j["max"])

JavaScript

async function thFluct() {
const url = new URL("https://bonds-api.com/api/v1/fluctuation");
url.searchParams.set("countries", "TH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("start", "2025-10-31");
url.searchParams.set("end", "2026-10-31");
const res = await fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } });
const j = await res.json();
const d = j.data.TH;
console.log("Start:", d.start_yield, "End:", d.end_yield, "Change:", d.change);
}
thFluct();

PHP

<?php
$ctx = stream_context_create(["http" => ["method" => "GET","header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/fluctuation?countries=TH&maturity=10Y&start=2025-10-31&end=2026-10-31";
$j = json_decode(file_get_contents($url, false, $ctx), true);
$d = $j["data"]["TH"];
echo "Start: ".$d["start_yield"].", End: ".$d["end_yield"].", Change: ".$d["change"]."\n";

Business-day behavior, updates, and caching

Thailand bond markets observe local business days and holidays. “Latest” and “curve” endpoints return the most recent available trading day when you query during holidays or weekends. Historical/date-bound endpoints expect valid market dates; an invalid date can result in a 404 response.

Updates typically occur at least daily for official closing levels, while intraday data provide multiple “fetched_at” snapshots throughout the day. In production:

  • Cache latest/curve for 5–10 minutes during market hours and 30–60 minutes off-hours.
  • Cache time series for longer (hours) since they’re stable for past dates.
  • Use short TTLs (30–60 seconds) for intraday monitoring screens.

When building your pipeline, centralize your HTTP client with the X-API-Key header and handle common errors gracefully.

Error handling and resilience

Typical error responses share the same shape: success=false, error=string. Handle these cases:

  • 401: Missing or invalid X-API-Key
  • 403: Account quota exceeded
  • 404: No data for requested country/maturity/date
  • 422: Invalid parameter (e.g., bad date format)
  • 429: Rate limit exceeded (retry with backoff)
  • 500: Server error (retry)

Building a Thailand yield curve programmatically

If you need the full curve: the /curve endpoint already aggregates maturities for you. If you need control over specific points or want to compute custom shapes (e.g., 2s10s), you can also call /latest with multiple maturities and compose the curve client-side. For example:

  • Call /latest with maturities=1M,3M,6M,1Y,2Y,5Y,10Y,30Y for country TH.
  • Order maturities and plot the curve; compute slopes such as 2Y–10Y (in percentage points).
  • Use /spread when you need cross-country 10Y spreads in bps.

Units reminder:

  • All yields are percentages (not decimals); 4.52 represents 4.52%.
  • Spreads from /spread are in basis points; 100 bps = 1 percentage point.

Use cases for analysts and developers

  • Portfolio risk: Pull TH 10Y time series from /timeseries to compute duration and scenario shocks.
  • Macro dashboards: Use /curve to render daily shapes and /intraday for real-time change markers.
  • Relative value: /spread vs. US or regional peers; alert when spreads widen beyond thresholds.
  • Backtesting: Combine /historical and /fluctuation to calibrate regime detection or mean-reversion logic.

Explore the API interactively in the MCP and reference the main site at bonds-api.com for conceptual overviews.

Common patterns and snippets

Multiple maturities in one call for curve construction

From the response, iterate maturities in ascending order; missing points can be linearly interpolated for chart continuity (document clearly if you do so).

Lightweight cache key scheme

  • Key: latest:TH:1M,3M,6M,1Y,2Y,5Y,10Y,30Y
  • Key: curve:TH:2026-10-31 (or curve:TH:latest)
  • Key: intraday:TH:10Y:2026-10-31

Always store the date field with the payload to avoid ambiguity when markets are closed.

FAQ

Q: What timezone are timestamps in?
A: Dates are Y-m-d without timezone (market date). Intraday fetched_at timestamps are UTC ISO 8601.

Q: How are yields and spreads expressed?
A: Yields are percentages (e.g., 4.52 = 4.52%). Spreads from /spread are in basis points (e.g., 215 bps = 2.15%).

Q: What happens on Thailand market holidays?
A: “Latest” and “curve” return the most recent trading day’s data. Historical endpoints for a holiday date may return 404 if no data exists for that date.

Q: Can I query multiple countries in one request?
A: Yes for /latest and /fluctuation via the comma-separated countries parameter. For curve, the request is per country.

Q: How do I compute a 2s10s slope for Thailand?
A: Use /latest with maturities=2Y,10Y, then subtract 2Y from 10Y (both in percentage points). For cross-country spreads, prefer /spread.

If you’re ready to integrate Thailand sovereign yields into your app, start now: Register for an API key, explore endpoints in the MCP, and consult bonds-api.com for coverage and concepts.

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.