Building a historical Hungary yield series requires more than storing a rate: you need to identify the maturity, preserve the observation date, handle market holidays, and distinguish percentage-point changes from basis points. This guide explains how to use the Bonds API reference to retrieve and analyze sovereign yields, build a curve, and handle gaps and updates in a production integration.
Hungary yields and data availability
A sovereign bond is debt issued by a government. Its yield is an annualized measure of return implied by its price and cash flows; analysts track yields because changes affect bond valuations, borrowing conditions, and relative-value comparisons.
The reference identifies Hungary with the country code HU and describes maturities such as 2Y and 10Y. However, the supplied live sample states that Hungary is not in the published catalog. Confirm Hungary availability before relying on the requests described below; a valid endpoint format does not guarantee that a particular country, maturity, or date has data.
The live example below uses US_10Y to demonstrate the published response format. It is not a Hungary yield and should not be inserted into a Hungary series. The Hungary endpoint descriptions that follow use the country and maturity parameters from the reference, rather than claiming a live Hungary result.
Make a request and read the response
All Bonds API requests use GET. The following is the supplied live request; replace YOUR_API_KEY before running it:
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
The supplied request places the key in the query string, while the endpoint reference specifies an X-API-Key header. Confirm the accepted authentication method for your integration before deployment. In particular, protect URLs containing keys from application logs, browser history, and error reports.
The supplied live response is:
{
"success": true,
"date": "2026-11-25",
"rates": {
"US_10Y": 4.85
},
"dates": {
"US_10Y": "2026-11-25"
},
"currencies": {
"US_10Y": "USD"
},
"sources": {
"US_10Y": "us_treasury"
},
"updated_at": {
"US_10Y": "2026-11-25T21:30:04+00:00"
},
"changes": {
"US_10Y": {
"previous_close": 4.91,
"daily": {
"date": "2026-11-24",
"bps": -6,
"pct": -1.22
},
"weekly": {
"date": "2026-11-18",
"bps": -22,
"pct": -4.34
},
"monthly": {
"date": "2026-10-23",
"bps": -15,
"pct": -3
},
"annual": {
"date": "2025-11-25",
"bps": 85,
"pct": 21.25
}
}
},
"meta": {
"request_id": "6d86fa42-7c86-483e-81eb-d7cfa86fae2c",
"timestamp": "2026-11-26T00:05:38+00:00"
}
}
success indicates whether the request succeeded. In this response, rates maps the instrument key to its yield in percent: 4.85 means 4.85%, not 0.0485%. dates, currencies, sources, and updated_at provide per-instrument context; the sample currency is USD and applies to the US instrument, not Hungary.
date is a calendar date in year-month-day format. updated_at is a timestamp with an explicit UTC offset; +00:00 means UTC. The response-level meta.timestamp is separate from the instrument update time, and meta.request_id can help trace a request.
changes contains previous_close and daily, weekly, monthly, and annual comparisons. Each comparison has a reference date, a change in bps, and a relative percentage change in pct. One basis point is one hundredth of a percentage point, so the sample’s daily change of -6 basis points corresponds to a decline of 0.06 percentage points.
The reference also shows a different latest-response structure, with yields nested under data by country and maturity. Do not assume that the live sample’s rates structure and the reference’s data structure are interchangeable. Check the actual response contract before connecting either parser to a Hungary dashboard.
Read the live sample with Python
This example calls the same endpoint and reads the fields shown in the live response. Set the BONDS_API_KEY environment variable locally; keep the key out of source control.
import os
from urllib.parse import quote
import requests
key = quote(os.environ["BONDS_API_KEY"], safe="")
url = (
"https://bonds-api.com/api/v1/latest"
"?countries=US&maturities=10Y&api_key=" + key
)
response = requests.get(url)
response.raise_for_status()
payload = response.json()
if not payload.get("success"):
raise RuntimeError(payload.get("error", "Request was not successful"))
symbol = "US_10Y"
print("Yield percent:", payload["rates"][symbol])
print("Observation date:", payload["dates"][symbol])
print("Currency:", payload["currencies"][symbol])
print("Updated at:", payload["updated_at"][symbol])
print("Source:", payload["sources"][symbol])
The sample intentionally reads only the documented live fields. In an application, handle missing instrument keys explicitly instead of treating them as zero yields. Also avoid logging the request URL because this particular sample carries the key in the query string.
Retrieve Hungary history and intraday observations
The following endpoint descriptions use the reference’s Hungary conventions. They are integration targets to verify against actual availability, not evidence that a particular Hungary observation exists.
Latest and historical values
GET /api/v1/latest requires countries, a comma-separated list of ISO2 codes. Its optional maturities parameter accepts a comma-separated list such as 2Y,10Y; omit it to request all available maturities. In the reference response, data groups results by country and maturity, and each entry contains yield, date, and source.
GET /api/v1/historical takes country, maturity, and a date in year-month-day format. Its reference response contains success, country, maturity, date, yield, and source. Use it when a valuation or research calculation needs the yield associated with a specific date, and retain the returned date alongside the result.
A requested calendar date is not necessarily a trading day. A weekend, Hungarian market holiday, or unavailable observation can produce no data; the reference lists HTTP 404 for a country, maturity, and date combination with no data. Decide whether your application should show a gap or apply a separately defined prior-business-day policy, and label any carried-forward value rather than presenting it as a new observation.
Time series
GET /api/v1/timeseries requires country, maturity, start, and end; dates use year-month-day format and end must not precede start. The reference response identifies country and maturity and returns a series array whose entries have date and yield.
For economic research, store each observation with its country, maturity, and date so that a later refresh can be compared with an earlier retrieval. Sort and validate observations before calculating changes, and preserve gaps instead of generating synthetic daily yields. Check the returned dates against your requested range before using the series in a backtest.
Intraday snapshots
GET /api/v1/intraday requires country, maturity, and date. The reference response includes those identifiers, a snapshots array, a count, and meta.timezone. Each snapshot has a yield, fetched_at, and source.
A timestamp ending in Z is UTC; the reference example also identifies the timezone as UTC. Treat fetched_at as the snapshot’s fetch time, not as proof of an underlying trade time. The reference does not specify a fixed snapshot cadence, so use the timestamps returned rather than assuming evenly spaced observations.
Build curves, spreads, and risk measures
Yield curves
GET /api/v1/curve requires country and optionally accepts date. If the date is omitted, the reference says the endpoint uses the latest available day with data. Its response includes country, date, inverted, and a curve mapping maturity labels to yield percentages.
The inverted field is the API’s curve-inversion indicator. A curve can contain different slopes across different maturity segments, so inspect the underlying points as well; the reference does not specify the exact rule used to set the indicator. Preserve missing maturities as missing rather than drawing them at zero.
You can also assemble a current curve from /api/v1/latest by requesting multiple maturity labels in maturities. Order the returned points by tenor before plotting, and check each point’s observation date: “latest” values for different maturities need not automatically represent a single synchronized market snapshot. The full-curve endpoint is useful when you need a country-level curve for a specified historical date.
Benchmark spreads
GET /api/v1/spread requires country and benchmark; maturity is optional and defaults to 10Y. The reference uses ISO2 benchmark codes, including US. A response identifies the country, benchmark, and maturity and includes country_yield, benchmark_yield, and spread_bps.
The spread is the country yield minus the benchmark yield, expressed in basis points. For an independent check, subtract the two percentage yields and multiply the percentage-point difference by 100. A cross-country spread is a yield comparison, not a currency-adjusted return: differences in currency, market conventions, and risk should be considered before interpreting it as a pure credit measure.
Period fluctuations
GET /api/v1/fluctuation takes countries, maturity, start, and end. The reference response includes the requested maturity and dates and a data object keyed by country. For each country, start_yield and end_yield describe the period endpoints, while change, min, and max summarize the movement and observed range.
Read change in yield percentage points, not basis points; multiply by 100 to express it in basis points. For a portfolio risk tool, this summary can complement a full time series, but it cannot replace the individual observations needed to inspect the path or identify when extremes occurred.
Operational checks for a production integration
Cache by endpoint and all relevant request parameters, including country, maturity, and date or date range. Keep the observation date and source with the cached value. Historical observations may still need periodic revalidation if underlying data can be revised; choose the refresh policy according to your application’s tolerance for stale data.
For latest yields and intraday snapshots, set a shorter cache lifetime than for historical data when the application needs timely updates. The reference does not give a guaranteed update frequency, so check returned timestamps where available and display the observation date rather than implying that every response is current to the second.
Handle errors as part of the data model. The common error shape has success set to false and an error message. HTTP 401 indicates a missing or invalid key; 403 indicates account quota exceeded; 404 indicates no matching data; 422 indicates an invalid parameter; 429 indicates rate limiting; and 500 indicates a server error.
Validate date formats and required parameters before sending a request. For temporary failures or rate limiting, use bounded retries and backoff; do not retry invalid credentials or invalid parameters indefinitely. Check the endpoint’s pagination behavior before assuming a large historical range can be retrieved in one response, and verify completeness against the returned dates.
For a dashboard, show the maturity and observation date next to each yield. For research and risk calculations, retain enough metadata to reproduce which observations were used, including any missing-day or carry-forward policy. The MCP entry point is available for teams integrating Bonds API data into their tools.
FAQ
Can I retrieve historical Hungary yields?
The reference describes Hungary requests using HU, but the supplied live sample says Hungary is not in the published catalog. Confirm availability for the required maturities and dates before building a dependency on those results.
How do I convert a yield difference to basis points?
Subtract yields expressed in percent to get a percentage-point difference, then multiply by 100. Keep this separate from a relative percentage change such as the sample response’s pct field.
What should I do when a historical date has no result?
Check whether the date was a business day and handle a 404 as missing data. If your analysis carries forward a prior observation, record both its actual observation date and the policy used.
Can I construct a Hungary curve from several maturities?
If Hungary data is available, request several maturities with /api/v1/latest, or request a dated country curve with /api/v1/curve. Check maturity coverage and dates before comparing points.
To obtain an API key and test the documented integration, Register, then verify Hungary coverage and the authentication and response format your application receives.