You need reliable, machine-readable access to the Malaysia 10-year government bond yield to power dashboards, backtests, and trading or risk models. By the end of this guide, you’ll know exactly how to fetch the latest MY 10Y yield, query historical and intraday points, compute spreads, and assemble a full Malaysian yield curve using Bonds API endpoints with production-ready code in cURL, Python, JavaScript, and PHP.
What you can build with Malaysia 10Y yield data
Malaysia’s 10-year government bond is the core reference point for MYR rates—used for duration targeting, curve positioning, and macro signals. With Bonds API, you can:
- Display real-time-like snapshots (intraday) and end-of-day yields for the Malaysian 10Y note.
- Construct a Malaysia yield curve across bills and bonds to measure steepening/flattening.
- Calculate spreads versus benchmarks (e.g., US Treasuries) in basis points for cross-market risk views.
- Drive quant research with timeseries and fluctuation windows (change, min, max) across business days.
Explore the service at https://bonds-api.com, and learn more developer tooling in the MCP.
Data basics: units, dates, and frequency
- Yields are returned as percentages (e.g., 4.52 means 4.52%).
- Spreads are returned in basis points (e.g., 215 means 2.15%).
- Dates use the Y-m-d format (e.g., 2026-10-17). Intraday timestamps are ISO8601 UTC.
- Coverage includes business days; Malaysian public holidays will not have updates. The latest endpoint returns the most recent available day with data.
- Use caching for intraday dashboards (e.g., cache snapshots for a few minutes) and for end-of-day series (cache by date once market closes).
All requests are GET and authenticated with the X-API-Key header. Base URL: https://bonds-api.com/api/v1/. See bonds-api.com for service overview.
Endpoint: Latest — current Malaysian yields
Use this to grab the most recent yields for Malaysia across one or many maturities. For the 10Y specifically, request maturity=10Y. You can include multiple maturities to build a live curve segment.
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": "MY", "maturities": "2Y,10Y"}
)
data = resp.json()
# Access Malaysia 10Y:
my_10y = data["data"]["MY"]["10Y"]["yield"] # percentage
my_10y_date = data["data"]["MY"]["10Y"]["date"] # Y-m-d
JavaScript (fetch)
const url = "https://bonds-api.com/api/v1/latest?countries=MY&maturities=2Y,10Y";
fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(json => {
const my10y = json.data.MY["10Y"].yield; // percentage
const asOf = json.data.MY["10Y"].date; // Y-m-d
console.log("MY 10Y:", my10y, "as of", asOf);
});
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=MY&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
$my10y = $data["data"]["MY"]["10Y"]["yield"];
$asOf = $data["data"]["MY"]["10Y"]["date"];
echo "MY 10Y: $my10y% (as of $asOf)\n";
Sample JSON
{
"success": true,
"date": "2026-10-16",
"rates": {
"US_10Y": 5.09
},
"dates": {
"US_10Y": "2026-10-16"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "fb551831-a855-46ff-b4a0-28ca42fbaa0b",
"timestamp": "2026-10-17T00:04:44+00:00"
}
}
How to read it:
- data.MY.10Y.yield is the 10-year Malaysian government bond yield in percent.
- date is the valuation date (Y-m-d), typically the latest business day with available data.
- source indicates the data provenance; here, “official”.
Endpoint: Historical — specific date for Malaysia 10Y
Pull a single point in time (e.g., reporting or backfill) for the Malaysia 10-year on a given date.
cURL
Python (requests)
import requests
params = {"country": "MY", "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)
h = r.json()
point = {"date": h["date"], "yield": h["yield"]} # yield in percent
JavaScript (fetch)
const params = new URLSearchParams({ country: "MY", maturity: "10Y", date: "2025-06-15" });
fetch(`https://bonds-api.com/api/v1/historical?${params.toString()}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(h => console.log("MY 10Y on", h.date, "=", h.yield, "%"));
PHP (file_get_contents)
<?php
$params = http_build_query(["country" => "MY", "maturity" => "10Y", "date" => "2025-06-15"]);
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$context = stream_context_create($opts);
$json = file_get_contents("https://bonds-api.com/api/v1/historical?$params", false, $context);
$h = json_decode($json, true);
echo "MY 10Y on {$h["date"]}: {$h["yield"]}%\n";
Sample JSON
Yield is in percent; date is Y-m-d.
Endpoint: Timeseries — Malaysia 10Y over a window
Request a continuous date range for quant studies and charts. Only business days (and dates with data) will appear.
cURL
Python (requests)
import requests
params = {"country": "MY", "maturity": "10Y", "start": "2025-10-17", "end": "2026-10-17"}
r = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
ts = r.json()["series"]
# ts is a list of {"date": "Y-m-d", "yield": float}
JavaScript (fetch)
const q = new URLSearchParams({ country: "MY", maturity: "10Y", start: "2025-10-17", end: "2026-10-17" });
fetch(`https://bonds-api.com/api/v1/timeseries?${q}`, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => j.series.forEach(pt => console.log(pt.date, pt.yield)));
PHP (file_get_contents)
<?php
$params = http_build_query([
"country" => "MY",
"maturity" => "10Y",
"start" => "2025-10-17",
"end" => "2026-10-17"
]);
$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);
$j = json_decode($json, true);
foreach ($j["series"] as $pt) {
echo $pt["date"] . " " . $pt["yield"] . "%\n";
}
Sample JSON
Each entry is a daily yield in percent keyed by Y-m-d date.
Endpoint: Spread — Malaysia vs benchmark (e.g., US)
Compute the MY 10Y spread versus a benchmark sovereign (e.g., the US 10Y). Output is in basis points and includes the underlying yields for each leg.
cURL
Python (requests)
import requests
params = {"country": "MY", "benchmark": "US", "maturity": "10Y"}
r = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
s = r.json()
bps = s["spread_bps"] # basis points, e.g., 215
my_y = s["country_yield"] # percent
us_y = s["benchmark_yield"] # percent
JavaScript (fetch)
const qs = new URLSearchParams({ country: "MY", benchmark: "US", maturity: "10Y" });
fetch(`https://bonds-api.com/api/v1/spread?${qs}`, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(s => console.log(`MY-US 10Y spread: ${s.spread_bps} bps (MY ${s.country_yield}%, US ${s.benchmark_yield}%)`));
PHP (file_get_contents)
<?php
$params = http_build_query(["country" => "MY", "benchmark" => "US", "maturity" => "10Y"]);
$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/spread?$params", false, $ctx);
$s = json_decode($json, true);
echo "MY-US 10Y spread: {$s["spread_bps"]} bps\n";
Sample JSON
spread_bps is in basis points. Positive means Malaysia exceeds the benchmark; negative would indicate the opposite.
Endpoint: Curve — complete Malaysia yield curve
Get a full snapshot of Malaysia’s curve for the latest available date (or a specified one) and assess whether it’s inverted. Combine this with spreads or timeseries for strategy signals.
cURL
Python (requests)
import requests
r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "MY"})
curve = r.json()
date = curve["date"]
is_inverted = curve["inverted"]
points = curve["curve"] # dict: maturity -> yield (percent)
JavaScript (fetch)
fetch("https://bonds-api.com/api/v1/curve?country=MY", {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(c => {
console.log("As of", c.date, "inverted?", c.inverted);
Object.entries(c.curve).forEach(([tenor, y]) => console.log(tenor, y));
});
PHP (file_get_contents)
<?php
$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/curve?country=MY", false, $ctx);
$c = json_decode($json, true);
echo "Curve date: {$c["date"]}, inverted? " . ($c["inverted"] ? "yes" : "no") . "\n";
Sample JSON
All values are yields in percent. inverted is true if short maturities exceed long ones beyond a configurable rule applied by the API.
| Maturity | Yield (%) |
|---|---|
| 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 — Malaysia 10Y snapshots
For trading monitors and near-real-time dashboards, fetch intraday quotes for a specific date. Timestamps are UTC and ISO8601. Combine with client-side throttling or short cache windows to control API usage.
cURL
Python (requests)
import requests
p = {"country": "MY", "maturity": "10Y", "date": "2026-10-17"}
r = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p)
snap = r.json()
for s in snap["snapshots"]:
# s["yield"] is percent; s["fetched_at"] is UTC timestamp
print(s["fetched_at"], s["yield"])
JavaScript (fetch)
const qs2 = new URLSearchParams({ country: "MY", maturity: "10Y", date: "2026-10-17" });
fetch(`https://bonds-api.com/api/v1/intraday?${qs2}`, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => {
console.log("Count:", j.count, "Timezone:", j.meta.timezone);
j.snapshots.forEach(s => console.log(s.fetched_at, s.yield));
});
PHP (file_get_contents)
<?php
$params = http_build_query(["country" => "MY", "maturity" => "10Y", "date" => "2026-10-17"]);
$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/intraday?$params", false, $ctx);
$j = json_decode($json, true);
echo "Snapshots: {$j["count"]}, TZ: {$j["meta"]["timezone"]}\n";
Sample JSON
fetched_at is an ISO8601 UTC timestamp; yield is in percent.
Endpoint: Fluctuation — change, min, max for Malaysia 10Y
Get summary stats for the Malaysia 10-year between two dates: start and end levels, absolute change, and the min/max across the window.
cURL
Python (requests)
import requests
p = {"countries": "MY", "maturity": "10Y", "start": "2025-10-17", "end": "2026-10-17"}
r = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p)
j = r.json()["data"]["MY"]
# All values in percent (except that "change" is percentage point difference)
print("Start:", j["start_yield"], "End:", j["end_yield"], "Change:", j["change"], "Min:", j["min"], "Max:", j["max"])
JavaScript (fetch)
const q3 = new URLSearchParams({ countries: "MY", maturity: "10Y", start: "2025-10-17", end: "2026-10-17" });
fetch(`https://bonds-api.com/api/v1/fluctuation?${q3}`, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => {
const s = j.data.MY;
console.log(`Δ: ${s.change} pp (min ${s.min}% / max ${s.max}%)`);
});
PHP (file_get_contents)
<?php
$params = http_build_query(["countries" => "MY", "maturity" => "10Y", "start" => "2025-10-17", "end" => "2026-10-17"]);
$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/fluctuation?$params", false, $ctx);
$j = json_decode($json, true);
$s = $j["data"]["MY"];
echo "Change: {$s["change"]} pp; Range: {$s["min"]}%–{$s["max"]}%\n";
Sample JSON
All values are yields in percent; change is the percent point difference (end_yield minus start_yield).
Production considerations: holidays, caching, and error handling
- Business days: Malaysia market holidays lead to gaps; latest returns the most recent available date.
- Caching: Cache curve and latest results by date; for intraday, consider a short TTL (e.g., 1–5 minutes).
- Backfilling: Use historical for single dates and timeseries for ranges. Fluctuation is a quick summary.
- Spreads: Always check units—spread_bps is in basis points. Convert to percent by dividing by 100.
Error responses
Common error shapes are JSON with success=false and an error message string. Handle HTTP codes:
- 401: Missing or invalid X-API-Key
- 403: Account quota exceeded
- 404: No data for requested country/maturity/date
- 422: Invalid parameter (e.g., wrong date format)
- 429: Rate limit exceeded
- 500: Server error
Building a Malaysia yield curve and analytics
To build a curve, either call curve?country=MY or request latest with multiple maturities (e.g., 1Y, 2Y, 5Y, 10Y, 30Y). The curve endpoint is best for a single, coherent snapshot with inversion metadata. For charting over time, call timeseries per maturity and stitch curves by date keys.
- Curve snapshot: Use /curve to populate a term-structure chart and detect inversion via the inverted field.
- Live panel: Use /latest for a subset of tenors and re-poll on a schedule aligned to market hours.
- Spread monitor: Use /spread to track MY vs US differentials in bps for relative value screens.
- Risk measures: Compute DV01 or duration from yields external to the API; use timeseries for rolling windows.
Official sample blocks (verbatim)
The following cURL and JSON samples are provided verbatim for compatibility testing of clients. They demonstrate the GET method and a valid JSON envelope.
Notes: rates values are yields in percent; date/dates are Y-m-d; meta.timestamp is ISO8601 UTC.
Sovereign bond quick primers (focused on Malaysia 10Y)
Sovereign bonds are government debt securities; the yield reflects financing costs and macro expectations. The Malaysia 10Y is commonly used for:
- Macro signals: Inflation expectations and policy stance (Bank Negara Malaysia context).
- Benchmarking: Pricing of local-currency credit and swap curves.
- Cross-market analysis: Spread to US 10Y or regional peers for capital flow insights.
End-to-end example: assemble a live Malaysia 10Y dashboard
- Call /latest for MY 10Y (and nearby tenors) at a fixed poll rate during market hours.
- Render a sparkline from /timeseries for the last 3 months.
- Compute the MY-US 10Y spread via /spread and annotate in bps.
- If the curve is inverted (via /curve), flag a macro warning on the page.
- Use /intraday during the session to provide quotes and last update timestamp.
- Add a daily summary panel using /fluctuation for WTD/MTD/3M windows.
Get your API key to start building: Register. For tooling and operational guidance, visit the MCP. You can also read more on bonds-api.com.
FAQ
How are yields expressed?
All yields are percentages. For example, 4.52 means 4.52%.
What timezone are timestamps in?
Intraday fetched_at timestamps are UTC ISO8601. Daily dates are Y-m-d without a timezone.
How should I handle non-trading days in Malaysia?
Use the latest endpoint for the most recent available business day. Timeseries and fluctuation endpoints will naturally skip holidays.
Can I request multiple maturities at once?
Yes. Use latest with maturities=1Y,2Y,5Y,10Y,30Y or call curve for a full snapshot including inverted detection.
How do I authenticate?
Send your key in the X-API-Key header with every GET request.
Ready to integrate Malaysia 10Y yields into your models and dashboards? Start in minutes: Register for an API key and explore the docs at bonds-api.com.