Get Hungarian Forint (HUF) Historical Prices using this API for a specific date range
You need a reliable way to pull Hungarian Forint (HUF) historical prices across a specific date range so you can backtest a strategy, draw a chart, or reconcile your ERP’s month-end FX conversions. By the end of this guide, you’ll query single-day and multi-day HUF rates with Metals-API, transform the JSON to date/value pairs, and ship it with practical guardrails around base currency, weekends, and caching.
What you’ll build: reproducible HUF history for backtests, charts, and reconciliation
Typical workflows include backfilling a HUF chart in a dashboard, normalizing PnL into HUF for a trading model, or auditing HUF conversions on historical invoices in a finance system. Metals-API provides consistent, timestamped HUF rates you can request by single date or a date range, plus the ability to switch base currencies when you need HUF as the numeraire.
If you’re mapping symbols, confirm codes in the official list before you code: see Metals-API Supported Symbols.
Single date: retrieve the HUF rate for a historical day
Use the historical endpoint by appending the date to the path in YYYY-MM-DD format. In this example, we request HUF with USD as the base (rates represent HUF per 1 USD).
curl "https://metals-api.com/api/2026-10-05?access_key=YOUR_API_KEY&base=USD&symbols=HUF"
Below is a real JSON response payload you can expect for this use case. Use it as your parsing contract when wiring your client:
{"success":true,"timestamp":1791158820,"date":"2026-10-05","base":"USD","rates":{"HUF":327.263566,"USD":1,"USDHUF":0.0030556410914375966}}
How to read the fields you’ll use
- success: Boolean indicating a successful request.
- timestamp: UNIX time (seconds) for the pricing snapshot in UTC. Store this to keep your data auditable.
- date: ISO date for the rates delivered. If you query a weekend or holiday, check this value to know which market day you received.
- base: The currency all quoted rates are relative to. Defaults to USD unless you specify base=HUF (or another supported code).
- rates.HUF: HUF per 1 USD (because base=USD). Multiply USD amounts by this to convert to HUF.
- rates.USD: Will be 1 when base=USD (identity check).
- rates.USDHUF: USD per 1 HUF. This is the inverse measure. Use it only if you specifically need HUF→USD as a direct multiplier.
Date range: time-series HUF history for charting and backfills
To populate a chart or run a backtest, request a contiguous block of days with the time-series endpoint. You provide start_date and end_date, the base currency, and the target symbol(s).
curl "https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&base=USD&symbols=HUF&start_date=2026-09-28&end_date=2026-10-05"
The response includes a date-keyed map of rates. You’ll typically normalize it to a list of (date, value) pairs sorted by date. Here’s a minimal Python example you can drop into a script or notebook.
import os
import requests
from datetime import datetime
API_KEY = os.getenv("METALS_API_KEY", "YOUR_API_KEY")
url = "https://metals-api.com/api/timeseries"
params = {
"access_key": API_KEY,
"base": "USD",
"symbols": "HUF",
"start_date": "2026-09-28",
"end_date": "2026-10-05"
}
res = requests.get(url, params=params, timeout=20)
res.raise_for_status()
data = res.json()
if not data.get("success"):
raise RuntimeError(f"API error: {data}")
# Build a sorted list of (date, HUF_per_USD) pairs.
pairs = []
rates_by_date = data.get("rates", {})
for ds, day_rates in rates_by_date.items():
# ds is an ISO date string like "2026-10-05"
huf = day_rates.get("HUF")
if huf is not None:
pairs.append((ds, float(huf)))
pairs.sort(key=lambda x: datetime.strptime(x[0], "%Y-%m-%d"))
# Example: print or feed into a charting library
for ds, huf in pairs:
print(f"{ds}, {huf}")
That’s the shape you’ll pass to your plotting layer, feed into a moving-average calculation, or load into a warehouse for downstream analytics.
Practical details that will save you time
Base currency: get the side you need
- Default base is USD, meaning rates.HUF is HUF per 1 USD. For price tags or PnL in HUF, this is often what you want.
- If you need quotes expressed per 1 HUF, set base=HUF and request symbols=USD. Then rates.USD means “USD per 1 HUF.”
- Be consistent in your data model: either store all rates as HUF per USD or invert consistently on ingest so your downstream math stays simple.
Timestamps and timezone
- timestamp is in UNIX seconds, UTC. Persist it as an integer and only localize for display.
- Use the date field to verify which market day your snapshot belongs to; don’t infer the business day solely from your request date.
Weekends and holidays
- FX trades 24/5; on weekends/holidays, daily snapshots typically reflect the last available market day. Always check the response date for your backtests or financial reconciliation.
- If a day is missing in time series (e.g., non-trading day), your app should either forward-fill or skip according to your analytics standard.
- For context on Hungarian market holidays, consult the Budapest Stock Exchange calendar: Budapest Stock Exchange. For broader FX context, you can also refer to the central bank website: Magyar Nemzeti Bank (MNB).
Units: currencies vs. metals
- HUF rates are unitless exchange rates. When base=USD, rates.HUF is “HUF per 1 USD.”
- If you later combine HUF with metals (e.g., XAU), remember metals are quoted “per troy ounce” by default (as indicated by the unit field in metals responses). Keep currency conversion and weight units separate in your math.
Caching and backfills
- Historical and time-series data are stable. Cache them aggressively (e.g., daily granularity) to minimize request volume and speed up batch backfills.
- For daily ETL, fetch only the new day and append to your store. Re-run periodically if you need to capture any late adjustments (rare for FX daily snapshots, but your governance may require it).
Maximum range and pagination
- The maximum date range per time-series request depends on your plan. If your window exceeds the limit, chunk the period into consecutive ranges and merge client-side.
- When chunking, be mindful of inclusive boundaries so you don’t double-count endpoints. A common pattern: [start, mid], [mid+1, end].
- Refer to endpoint specifics and plan capabilities in the Metals-API Documentation.
Why HUF history also matters for metal-linked workflows
Even if your immediate use case is FX, HUF sits at the intersection of commodity pricing and manufacturing costs in CEE supply chains. Developers often price gold or industrial metals to HUF for consumer-facing catalogs, procurement, or risk dashboards. Metals-API’s data model lets you combine currency time series with metals time series without retooling your stack.
For example, a Hungarian electronics manufacturer tracking tellurium (TE) inputs can tie TE price signals to HUF to understand real production costs. This is part of a broader digital transformation: streaming market data into smart ERP/MES systems, adding data analytics and alerts, and enabling faster adjustments in procurement. If you’re scoping a pipeline that blends FX with metals, see the coverage map on the Metals-API MCP page and confirm symbol codes via the Symbols catalog.
Putting it together: implementation checklist
- Pick your base: Decide if you need HUF per USD (base=USD) or USD per HUF (base=HUF). Be consistent.
- Start with a single-day historical call to nail your parsing and field mapping.
- Add a time-series fetch for your required date range; normalize to (date, rate) pairs.
- Handle non-trading days by forward-filling or skipping, and always check the date returned.
- Persist timestamp (UTC) and base to maintain traceability for audits and reruns.
- Cache historical responses to reduce calls and speed up batch processing.
- If you need more endpoints later (e.g., OHLC or fluctuation), see the Docs and integrate iteratively.
Troubleshooting notes
- Unexpected null rate on a day: Verify the symbol and confirm the day exists in your plan’s coverage. Check the Supported Symbols.
- Wrong side of the quote: Re-check base vs. symbols. If base=USD and symbols=HUF, value is HUF per 1 USD. Invert if your pipeline expects USD per 1 HUF.
- Weekend responses: If your requested date is a Saturday/Sunday and you need Friday’s close, confirm the response date, not just your request date.
- Consistency across endpoints: Store both date and timestamp to ensure you can reconcile single-day and time-series pulls from the same period.
Endpoint summary used in this guide
- Historical (single date): /YYYY-MM-DD with base and symbols for one-day HUF snapshots.
- Time-series: /timeseries with base, symbols, start_date, end_date for multi-day HUF history.
For additional endpoints such as fluctuation or OHLC, see the Metals-API Documentation.
FAQ
What does rates.HUF represent when base=USD?
It’s HUF per 1 USD. Multiply a USD amount by this value to convert to HUF. If you need USD per 1 HUF, either use the inverse or set base=HUF and read rates.USD.
How do I handle weekends and holidays in a time series?
Use the returned date keys as your ground truth. If a date is absent or maps to the previous business day, forward-fill or skip based on your analytics standard. Always confirm the response’s date field.
Can I request HUF as the base currency?
Yes. Set base=HUF and request symbols for the counter currency you need (e.g., symbols=USD). Store base in your dataset to avoid confusion later.
What is the timestamp unit and timezone?
timestamp is UNIX seconds in UTC. Convert to local time only at the presentation layer. Persist UTC for consistency and easier reconciliation.
What’s the maximum date range per time-series request?
It depends on your plan. If your range is too large, split it into contiguous chunks and merge client-side. Consult the Documentation for up-to-date limits.
Get your API key and ship it
Spin up your integration in minutes: create a key, hit the historical and time-series endpoints, and cache the data you backfill. Start now: Register. If you need to validate coverage or add metals alongside HUF, check the Symbols list and browse more details in the Documentation.