Get Haitian Gourde (HTG) - N/A Historical Prices using this API for 2026 daily series

Metals-API 7 min read
Get Haitian Gourde (HTG) - N/A Historical Prices using this API for 2026 daily series

You need a clean, daily historical series for the Haitian Gourde (HTG) in 2026 to power backtests, render charts, and reconcile ledger entries. By the end of this guide, you will fetch HTG history for specific days and for a 2026 date range using Metals-API, transform the JSON into date/value pairs, and account for units, base currency, and non-trading days in your pipeline.

Why historical HTG matters for your stack

Developers and quants use HTG history to normalize multi-currency P&L, price invoices and SKUs dynamically for Haitian markets, and validate FX exposures in trading and treasury systems. Product teams apply it to user-facing charts and to analytics that explain price moves over time. In a broader digital transformation of metals and FX-enabled products, APIs like Metals-API let you standardize pipelines, automate data hygiene, and ship features backed by consistent, machine-readable time series.

Illustration: Get Haitian Gourde (HTG) - N/A Historical Prices using this API for 2026 daily series

Know your symbol, units, and base

In this tutorial we focus on the single symbol HTG (Haitian Gourde). Verify its availability and naming on the symbols reference before coding.

  • Symbol to request: HTG. See the full catalog on Metals-API Supported Symbols.
  • Base currency: By default, Metals-API returns rates relative to USD. That means rates.HTG represents “HTG per 1 USD”. To get “USD per 1 HTG,” take the reciprocal or use an inverse field if present in the payload.
  • Units: For currencies, there is no “per troy ounce.” You will not see a unit field in the HTG response; the interpretation is “units of HTG per 1 USD” (with base=USD).
  • Timestamps and dates: Responses include a UNIX timestamp (seconds) and an ISO date. Treat the date as the effective market date (UTC) for that fix.

Single-day historical HTG: the historical endpoint

Use the historical endpoint by appending the date (YYYY-MM-DD) to the API path. This is ideal for reconciling a specific trade day or backfilling a single gap.

curl -s "https://metals-api.com/api/2026-10-19?access_key=YOUR_API_KEY&symbols=HTG&base=USD"

Notes:

  • Replace YOUR_API_KEY with your key. If you do not have one, get it here: Register.
  • Keep base=USD if you plan to store a consistent “HTG per USD” series across your system. You can change the base in some plans; see the Documentation for details.

Daily series for 2026: the time-series endpoint

For charts and models, request a date range in one call. The time-series endpoint returns a map of dates to rates, which you can flatten into ordered pairs for plotting or storage.

Time-series curl example

curl -s "https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&start_date=2026-10-01&end_date=2026-10-19&symbols=HTG&base=USD"

General guidance:

  • Use the tightest range you need to minimize payload size and speed up downstream processing.
  • If you need a full calendar year, chunk into multiple requests if your plan’s per-request date span requires it. See the Documentation.

Python: flatten time-series to date/value pairs

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,
"start_date": "2026-10-01",
"end_date": "2026-10-19",
"symbols": "HTG",
"base": "USD"
}

r = requests.get(URL, params=params, timeout=15)
r.raise_for_status()
data = r.json()

if not data.get("success", False):
raise SystemExit(f"API error: {data}")

# data['rates'] is a dict keyed by date strings
# Each value is a dict like {"HTG": <number>}
series = []
for ds, daily in sorted(data.get("rates", {}).items()):
if "HTG" in daily:
# Interpret as HTG per 1 USD (base=USD)
series.append((ds, float(daily["HTG"])))

# Example: print as CSV lines date,rate
for ds, rate in series:
print(f"{ds},{rate}")

This code:

  • Calls the time-series endpoint once for 2026-10-01 to 2026-10-19.
  • Extracts the HTG value for each day with base=USD.
  • Outputs a compact date,rate list you can persist to a warehouse or charting lib.

The actual JSON fields you will use

Below is a real example payload for a historical HTG request. Use these fields directly; do not infer types or presence of extra attributes beyond what you see and what the docs guarantee.

{"success":true,"timestamp":1792368480,"date":"2026-10-19","base":"USD","rates":{"HTG":131.092991,"USD":1,"USDHTG":0.007628172889883944}}

What matters for your integration:

  • success: Boolean; check first to ensure the call is valid.
  • timestamp: UNIX seconds for the fix/reference time. Convert as needed.
  • date: Effective market date (YYYY-MM-DD). Use this as your series index.
  • base: “USD” here. Interpret rates relative to this base.
  • rates.HTG: Numeric; HTG per 1 USD on the specified date (base=USD).
  • rates.USD: 1 when base=USD (handy sanity check).
  • rates.USDHTG: Inverse relation (USD per 1 HTG). When present, it equals 1 / rates.HTG. If absent in a given response, compute it explicitly as 1.0 / rates.HTG.

Practical integration details that save time

  • Base currency discipline: Keep base=USD across all requests so the meaning of HTG is always “HTG per USD.” Store the base in your schema to prevent confusion during joins.
  • Units for currencies vs metals: HTG is a fiat currency. You won’t see “per troy ounce.” For metals endpoints, units may include troy ounces; don’t mix those series with FX without conversion.
  • Timezone and stamps: Use the date field for backtesting alignment. If you require exact intraday timing or higher frequency, see other endpoints in the Documentation.
  • Weekends and holidays: Expect gaps. For daily charts, forward-fill from the last available business day, but clearly mark non-session days in audit trails.
  • Maximum range per request: The allowed span can vary by subscription. If you need an annual series, make multiple time-series calls in monthly or quarterly chunks as required.
  • Caching and backfills: Cache daily responses by date and symbol. For large backfills, run a nightly job that:
    • Requests only missing dates.
    • Retries transient errors (with exponential backoff).
    • Persists raw JSON and a normalized table keyed on (date, base, symbol, rate).
  • Conversion math: With base=USD, rate = HTG per USD. If you need USD per HTG, take the reciprocal or use rates.USDHTG when present.
  • Error handling: Always check success. If false, inspect the body for diagnostics per the Documentation.

Choosing endpoints for HTG workflows

For 2026 daily HTG series you likely need only two endpoints:

  • Historical endpoint (single date): Backfills, reconciliation jobs, and audit snapshots.
  • Time-series endpoint (date range): Charting, model inputs, and bulk exports.

If you expand to more symbols or metals, review the rest of the endpoints in the Documentation, including OHLC and fluctuation, and confirm symbol availability via the Symbols page.

Haitian Gourde in modern data stacks

As fintech, jewelry, and manufacturing platforms integrate currency alongside metals pricing, HTG support enables price localization and exposure tracking for Haitian markets. Metals-API’s JSON schema fits directly into modern pipelines (dbt, Airflow, Kafka) and lakehouse storage for analytics and forecasting. A small, consistent set of endpoints lets you evolve from simple daily pulls to smart alerting and automated revaluations as your product matures.

For programmatic governance, see the MCP page and align your data ingestion standards with organizational policies.

Where to learn more

FAQ

  • How do I get “USD per HTG” instead of “HTG per USD”?
    If base=USD, divide 1.0 by rates.HTG, or use rates.USDHTG when present.
  • Why are some calendar days missing in the time-series response?
    Weekends and certain holidays don’t have new fixes. Forward-fill for charts, but keep the business date intact in storage.
  • Can I request a full 2026 year of HTG in one call?
    Depending on your plan, you may need to split the request into multiple ranges. Check the time-series limits in the Documentation.
  • How should I store the results?
    Normalize into a table with columns (date, base, symbol, rate, timestamp, raw_json). Index on (symbol, date) for quick lookups and keep raw JSON for auditability.
  • Do I need to pass base=USD on every call?
    USD is the default base, but being explicit can prevent confusion when onboarding teammates or moving between environments.

Ready to pull HTG history and wire it into your product? Create your key in minutes at Register, then follow the parameters in the Documentation and validate HTG on the Symbols page.