Nigeria Bond Curve API

Nigeria Bond Curve API

You need accurate, machine-readable Nigeria government bond yields that you can query and turn into a curve, spreads, and time-series metrics inside your own tools. By the end of this guide, you will fetch NG sovereign yields over HTTPS, compute a Nigeria yield curve and 10Y spreads, handle holidays and caching, and embed the data in dashboards or risk models using simple GET requests.

Why Nigeria sovereign yields and how this API works

Nigeria’s government bond market is a benchmark for local funding costs, policy expectations, and macro risk. Yields are quoted in percent (%). The curve spans short T-bills (1–6 months) through long bonds (up to 30Y), enabling curve analytics (level, slope, curvature), spread analysis versus benchmarks, and historical backtesting.

Illustration: Nigeria Bond Curve API

The Bonds API serves sovereign bond yields over a REST interface at https://bonds-api.com. All endpoints are GET. Authentication uses the X-API-Key header. Responses are JSON and include dates in Y-m-d and timestamps in ISO 8601 (UTC). Visit the homepage at https://bonds-api.com or explore developer tools at MCP.

Data model, units, maturities, and timestamps

  • Yield: expressed in percentage points (e.g., 4.52 means 4.52%).
  • Spread: returned in basis points (bps). 1 bps = 0.01%, so 215 bps = 2.15%.
  • Maturities: short bills (1M, 3M, 6M), intermediates (1Y, 2Y, 5Y), and long bonds (10Y, 30Y). Availability can vary by date; use the curve endpoint for the full set per day.
  • Business days and holidays: yields typically update on Nigerian market business days; weekends and local holidays may have no new values. Time-series endpoints will reflect gaps accordingly.
  • Timestamps: daily fields use Y-m-d; intraday snapshots include full UTC timestamps like 2026-10-20T12:00:00Z.

Get the latest Nigeria yields

Use /api/v1/latest for current yields. You can request a subset of maturities or omit the maturities parameter to return all available tenors for Nigeria (ISO2: NG).

cURL

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

Official JSON example

{
"success": true,
"date": "2026-10-20",
"rates": {
"US_10Y": 5.149
},
"dates": {
"US_10Y": "2026-10-20"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "155cdd55-c2cc-4c28-a0cb-c760b06c721a",
"timestamp": "2026-10-20T00:04:44+00:00"
}
}

How to read this:

  • success: boolean request status.
  • data.NG.2Y.yield: latest 2-year Nigeria yield in percent.
  • data.NG.2Y.date: last trading date in Y-m-d.
  • source: origin of the quote (“official” or “market”).

Python (requests)

import requests

resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "NG", "maturities": "2Y,10Y"}
)
resp.raise_for_status()
data = resp.json()

ng = data["data"]["NG"]
y2 = ng["2Y"]["yield"]
y10 = ng["10Y"]["yield"]
asof = ng["10Y"]["date"]
print(f"NG 2Y={y2:.2f}%, 10Y={y10:.2f}% (as of {asof})")

JavaScript (fetch)

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

fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(json => {
const ng = json.data.NG;
console.log(`NG 2Y=${ng["2Y"].yield}% 10Y=${ng["10Y"].yield}% (as of ${ng["10Y"].date})`);
})
.catch(console.error);

PHP (file_get_contents)

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

Get a specific Nigeria yield on a date

Use /api/v1/historical for a single date and maturity. Handy for end-of-month snapshots or point-in-time backtests.

cURL

Official JSON example

Fields:

  • yield: percent (%) on the requested date.
  • date: Y-m-d for the requested day; if the market was closed, the API may return no data (404) for that exact date.

Python (requests)

import requests

params = {"country": "NG", "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()
h = r.json()
print(h["country"], h["maturity"], h["date"], h["yield"])

JavaScript (fetch)

const params = new URLSearchParams({ country: "NG", maturity: "10Y", date: "2025-06-15" });
fetch(`https://bonds-api.com/api/v1/historical?${params}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(console.log)
.catch(console.error);

PHP (file_get_contents)

<?php
$q = http_build_query(["country" => "NG", "maturity" => "10Y", "date" => "2025-06-15"]);
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$resp = file_get_contents("https://bonds-api.com/api/v1/historical?$q", false, $ctx);
echo $resp;

Get a Nigeria time series between two dates

Use /api/v1/timeseries to retrieve a daily series for backtests, charts, or factor models.

cURL

Official JSON example

Fields:

  • series: array of daily observations, each with date (Y-m-d) and yield (%).

Python (requests)

import requests

p = {"country": "NG", "maturity": "10Y", "start": "2025-10-20", "end": "2026-10-20"}
r = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p).json()
series = r["series"]
print(f"Points: {len(series)}; first={series[0]}")

JavaScript (fetch)

const p = new URLSearchParams({
country: "NG",
maturity: "10Y",
start: "2025-10-20",
end: "2026-10-20"
});
fetch(`https://bonds-api.com/api/v1/timeseries?${p}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => console.log(json.series))
.catch(console.error);

PHP (file_get_contents)

<?php
$params = http_build_query([
"country" => "NG",
"maturity" => "10Y",
"start" => "2025-10-20",
"end" => "2026-10-20"
]);
$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?$params", false, $ctx);

Compute Nigeria-UST spreads (basis points)

Use /api/v1/spread to compute the Nigeria yield spread versus a benchmark country (e.g., US for U.S. Treasuries). The result is in basis points.

cURL

Official JSON example

Fields:

  • spread_bps: difference in basis points (NG 10Y minus US 10Y).
  • country_yield and benchmark_yield: each in percent.

Python (requests)

import requests

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

JavaScript (fetch)

const ps = new URLSearchParams({ country: "NG", benchmark: "US", maturity: "10Y" });
fetch(`https://bonds-api.com/api/v1/spread?${ps}`, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(j => console.log(`NG-US 10Y spread: ${j.spread_bps} bps`))
.catch(console.error);

PHP (file_get_contents)

<?php
$q = http_build_query(["country" => "NG", "benchmark" => "US", "maturity" => "10Y"]);
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
echo file_get_contents("https://bonds-api.com/api/v1/spread?$q", false, $ctx);

Get the Nigeria yield curve for a day

Use /api/v1/curve to fetch the full curve for a given date (or latest by default). It yields tenors mapped to percent yields and a flag for inversion.

cURL

Official JSON example

Fields:

  • inverted: true if shorter maturities yield more than longer ones (classic inversion check).
  • curve: map of tenor to yield in percent (%).

Python (requests)

import requests

r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "NG"}).json()
print(r["date"], r["curve"], "inverted=", r["inverted"])

JavaScript (fetch)

fetch("https://bonds-api.com/api/v1/curve?country=NG", {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(j => {
console.log(`As of ${j.date}, inverted=${j.inverted}`);
console.table(j.curve);
});

PHP (file_get_contents)

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

Intraday Nigeria snapshots

Use /api/v1/intraday for multiple yield snapshots throughout a trading day at a selected maturity.

cURL

Official JSON example

Fields:

  • snapshots: array of yield (%), fetched_at (UTC timestamp), and source.
  • count: number of intraday points returned; meta.timezone indicates timestamp basis (UTC).

Python (requests)

import requests

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

JavaScript (fetch)

const q = new URLSearchParams({ country: "NG", maturity: "10Y", date: "2026-10-20" });
fetch(`https://bonds-api.com/api/v1/intraday?${q}`, { 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 (file_get_contents)

<?php
$params = http_build_query(["country" => "NG", "maturity" => "10Y", "date" => "2026-10-20"]);
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
echo file_get_contents("https://bonds-api.com/api/v1/intraday?$params", false, $ctx);

Nigeria yield fluctuations over a period

Use /api/v1/fluctuation to summarize period change, min, and max. This helps quantify volatility regimes or detect outliers before modeling.

cURL

Official JSON example

Fields:

  • start_yield/end_yield: percent (%) at the start and end dates.
  • change: arithmetic difference in percentage points (end - start).
  • min/max: period extremes in percent.

Python (requests)

import requests

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

JavaScript (fetch)

const ps2 = new URLSearchParams({
countries: "NG", maturity: "10Y", start: "2025-10-20", end: "2026-10-20"
});
fetch(`https://bonds-api.com/api/v1/fluctuation?${ps2}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(j => console.log(j.data.NG))
.catch(console.error);

PHP (file_get_contents)

<?php
$params = http_build_query([
"countries" => "NG",
"maturity" => "10Y",
"start" => "2025-10-20",
"end" => "2026-10-20"
]);
$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);

Assembling a Nigeria yield curve and working with multiple maturities

There are two practical approaches:

  • Use /api/v1/curve for a turnkey daily curve (recommended). It includes the inverted flag and all available tenors for the day.
  • Use /api/v1/latest with maturities=1M,3M,6M,1Y,2Y,5Y,10Y,30Y to build a composite curve panel in your UI. This is useful when you only need a subset, or when mixing countries.

For front-ends, normalize the tenor order and express all yields with one decimal format (e.g., 4.52%). Cache for a few minutes during market hours to avoid rate limits and jitter while keeping charts responsive.

Illustrative tenor map at a glance

TenorBill/BondUnit
1M, 3M, 6MT-billYield in percent (%)
1Y, 2Y, 5YShort/Intermediate bondYield in percent (%)
10Y, 30YLong bondYield in percent (%)

Business days, holidays, update frequency, and caching

Daily yields update on Nigerian business days. Weekends and public holidays produce no new daily close. Intraday snapshots appear during the trading session in UTC timestamps. When building production dashboards:

  • Implement caching for 1–5 minutes for /latest and /curve during market hours, longer off-hours.
  • For time series, cache by date range key; refresh only when the end date is “today” or the last business day.
  • For holidays, handle 404 from /historical gracefully and fall back to the most recent prior business day when appropriate to your use case.

You can verify live behavior and endpoints at bonds-api.com.

Error handling and common responses

All errors share the shape success=false with an error message:

  • 401: Missing or invalid X-API-Key.
  • 403: Quota exceeded.
  • 404: No data for the country/maturity/date requested (consider holiday or unavailable tenor).
  • 422: Invalid parameter (e.g., wrong date format, unknown ISO2).
  • 429: Rate limit exceeded (increase cache or back off with exponential delay).
  • 500: Server error (retry with jitter).

For resilience: retry idempotent GETs on 429/500 with exponential backoff and respect cache headers where applicable.

Official live sample block (verbatim)

The following official sample is provided as-is and demonstrates an alternative response shape for a latest request. Use it for testing response parsing logic. Production requests should follow the Nigeria examples above with the X-API-Key header.

Fields in this block:

  • rates: keyed by symbol (e.g., US_10Y) with yields in percent.
  • dates: per-symbol Y-m-d as-of dates.
  • currencies: per-symbol currency code (e.g., USD).
  • meta.timestamp: ISO 8601 UTC.

End-to-end developer workflows

Typical fintech and quant workflows with Nigeria yields:

  • Market dashboard: call /latest for NG tenors, render a curve sparkline and colorize inversion flag from /curve.
  • Macro research: fetch /timeseries for NG 10Y and /fluctuation for rolling windows; annotate with central bank decisions.
  • Risk and attribution: compute NG–US 10Y spreads with /spread; report spread changes in bps to normalize scale.
  • Execution support: poll /intraday for 10Y to monitor liquidity shifts and alert on threshold breaks.

Quick checklist for production integrations

  • Authentication: always send X-API-Key: YOUR_API_KEY.
  • HTTP method: GET for all endpoints.
  • Units: yields in percent (%), spreads in bps.
  • Dates: Y-m-d; intraday timestamps in UTC ISO 8601.
  • Caching: 1–5 minutes for latest/curve during market hours; longer otherwise.
  • Error handling: back off on 429, validate ISO2 code NG, and watch for 404 on holidays.

FAQ

How do I build a Nigeria yield curve for a specific historical date?
Use /api/v1/curve with country=NG and date=YYYY-MM-DD. If you also need point verification, query /historical for individual tenors on that same date.

Are spread values in percent or basis points?
/api/v1/spread returns spread_bps in basis points. For example, 215 means 2.15%.

What timezone are intraday timestamps in?
Intraday snapshots include fetched_at in UTC and meta.timezone is “UTC”. Convert to your display timezone in the client.

How should I handle missing data on Nigerian holidays?
Expect 404 for exact holiday dates on /historical. For UIs, fall back to the previous business day or annotate the chart as a non-trading day.

Can I request multiple maturities at once?
Yes, with /api/v1/latest you can pass maturities=1M,3M,6M,1Y,2Y,5Y,10Y,30Y for NG to get a consolidated panel.

Ship your Nigeria bond curve integration today. Get an API key and start calling the endpoints described above: Register. Explore developer tools at MCP, and learn more at bonds-api.com.

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.

Related posts

All posts →