Access real-time Hong Kong Dollar (HKD) prices using this API
Need to display real-time Hong Kong Dollar (HKD) prices for gold, silver, platinum, palladium, copper, aluminum, and more in your trading dashboard, pricing engine, or ERP? This guide shows exactly how to access HKD-denominated metal prices using Metals-API, align units (troy ounces vs grams), handle timestamps and market closures, and integrate robustly with caching, retries, and data validation. We’ll walk through each relevant feature step-by-step, from latest spot to OHLC and fluctuations, with HKD-centric tips throughout.
Why HKD-denominated metals data matters
Whether you are a jeweler in Kowloon, a commodities PM allocating risk across Asian hours, or a fintech product team recalculating markups for Hong Kong–based customers, quoting in Hong Kong Dollar (HKD) improves transparency and reduces conversion noise. HKD pricing:
- Aligns with settlement and accounting for HK-based operations.
- Prevents rounding drift from repeated USD conversions.
- Enables precise margin strategies in retail checkout and B2B quotes.
- Supports localized analytics, alerts, and risk models during Asian trading sessions.
Metals-API delivers real-time and historical metals rates and currency rates in a simple JSON REST format, making it straightforward to show HKD prices directly in your application. Visit the Metals-API Website to get started and claim your free API key.
How Metals-API enables real-time HKD pricing
Metals-API provides endpoints for latest rates, historical values, time series, bid/ask, OHLC, fluctuation, conversion, intraday, and more. By default, exchange rates are relative to USD and expressed per troy ounce for metals. You can either:
- Request rates with HKD as the base (if available in your plan), or
- Use the conversion endpoints to translate USD-based outputs into HKD for display and analytics.
You’ll find full details in the Metals-API Documentation, and a comprehensive symbol directory (metals, currencies, and LME tickers) on the Metals-API Supported Symbols page.
Quick start: Fetch latest metals and display prices in HKD
Below is a minimal workflow to fetch spot metals, then present values in HKD for a retail jewelry site or trading widget:
- Call the Latest Rates endpoint to get current metals rates (default base USD, unit per troy ounce).
- Either:
- Request base=HKD (if supported) and read metals directly in HKD per troy ounce, or
- Multiply USD-denominated rates by the USD→HKD rate (or request Convert for HKD).
- Cache results to avoid re-fetching within your update interval.
- Render prices in HKD with unit labels (troy oz, gram) and timestamps.
Example: Latest Rates response shape you will use
This is a representative Metals-API response for latest rates. Values are quoted per troy ounce and, by default, relative to USD. You will adapt these to HKD in your application logic.
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744,
"XCU": 0.294118,
"XAL": 0.434783,
"XNI": 0.142857,
"XZN": 0.344828
},
"unit": "per troy ounce"
}
Key fields you’ll use:
- success: Check true before using data.
- timestamp and date: Store for caching and display; timestamps are critical for auditability.
- base: Default “USD.” If your plan supports base override, this can be “HKD.”
- rates: Metal symbols (e.g., XAU for gold) mapped to exchange rates relative to base.
- unit: By default, metals are quoted “per troy ounce.” Convert to grams if needed (1 troy oz ≈ 31.1034768 g).
cURL: Request latest metals aiming for HKD display
If your subscription allows a base currency override, you can request HKD directly:
curl -G "https://metals-api.com/api/latest" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "base=HKD" \
--data-urlencode "symbols=XAU,XAG,XPT,XPD,XCU,XAL"
If base override is not available, request default USD and then convert values to HKD using your FX logic or Metals-API conversion endpoints.
JavaScript example: Transform USD-based metals to HKD
This example illustrates fetching latest metals (USD base) and converting to HKD for frontend display. Replace YOUR_API_KEY and adapt the symbols list as needed:
// For demonstration purposes only. Handle secrets server-side in production.
async function fetchMetalsInHKD() {
const accessKey = "YOUR_API_KEY";
// 1) Fetch latest metals rates (default base: USD)
const latestUrl = new URL("https://metals-api.com/api/latest");
latestUrl.searchParams.set("access_key", accessKey);
latestUrl.searchParams.set("symbols", "XAU,XAG,XPT,XPD,XCU,XAL");
const latestRes = await fetch(latestUrl);
const latest = await latestRes.json();
if (!latest.success) throw new Error("Latest failed");
// 2) Fetch USD-HKD FX rate via convert (amount=1, from=USD, to=HKD)
// Alternatively, if your plan supports base=HKD, skip this step and request base=HKD above.
const convertUrl = new URL("https://metals-api.com/api/convert");
convertUrl.searchParams.set("access_key", accessKey);
convertUrl.searchParams.set("from", "USD");
convertUrl.searchParams.set("to", "HKD");
convertUrl.searchParams.set("amount", "1");
const fxRes = await fetch(convertUrl);
const fx = await fxRes.json();
if (!fx.success) throw new Error("FX convert failed");
const usdToHkd = fx.result; // numeric multiplier
// 3) Transform each metal price from USD-base to HKD-base
// Rates are "per troy ounce" relative to the base currency.
const hkdRates = {};
for (const [metal, ratePerBase] of Object.entries(latest.rates)) {
// ratePerBase indicates how many troy ounces per USD (or vice versa) depending on the API semantics.
// Always confirm the direction in documentation for your plan.
// Here we multiply by usdToHkd to express the same value in HKD terms.
hkdRates[metal] = ratePerBase * usdToHkd;
}
return {
timestamp: latest.timestamp,
date: latest.date,
unit: latest.unit,
ratesHKD: hkdRates
};
}
fetchMetalsInHKD()
.then(data => console.log("HKD metals:", data))
.catch(err => console.error(err));
Note: Store your API key server-side in production and proxy requests to protect credentials.
Symbols, units, and base currency essentials for HKD integration
Metal codes follow ISO-like conventions (XAU, XAG, etc.). Currency codes follow ISO 4217, so HKD is “HKD.” All supported symbols are listed on the Metals-API Supported Symbols page. Remember these fundamentals when integrating HKD:
- Base currency: Defaults to USD in the response. Depending on your plan, you may override to HKD. If not, convert downstream.
- Units: Metals are “per troy ounce.” If you need grams, convert by dividing by 31.1034768.
- Timestamps: Use response timestamp/date for cache keys, data lineage, and display.
- Weekends/holidays: Spot markets may not update; plan for unchanged data during closures and plateaued timestamps.
Common symbols quick reference
| Category | Symbol | Description |
|---|---|---|
| Currency | HKD | Hong Kong Dollar |
| Currency | USD | United States Dollar (default base) |
| Precious Metal | XAU | Gold |
| Precious Metal | XAG | Silver |
| Precious Metal | XPT | Platinum |
| Precious Metal | XPD | Palladium |
| Industrial Metal | XCU | Copper |
| Industrial Metal | XAL | Aluminum |
Detailed walkthroughs: End-to-end HKD pricing flows
Flow A: Real-time HKD price board for a Hong Kong jewelry chain
- Fetch Latest Rates for XAU and XAG.
- If base override is available, request base=HKD; otherwise, convert USD outputs to HKD via Convert.
- Transform troy ounces to grams for retail quotes.
- Apply business markup, tax, and fees.
- Cache results (e.g., 60s–300s) to stabilize UI and minimize calls.
- Display time and unit alongside price to prevent misinterpretation.
Flow B: Intraday HKD risk monitor for a commodities desk
- Use Intraday (where available) or Latest plus polling.
- Use Bid/Ask to model spreads and execution impact in HKD terms.
- Alert on Fluctuation metrics and OHLC threshold breaches.
- Persist data to time-series DB; resample to your risk horizon.
Flow C: ERP cost update for HK-based manufacturer
- Daily Historical or OHLC fetch at start of HK business day.
- Convert to HKD if needed and recalculate BoMs.
- Notify purchasing and update live price catalogs.
Latest rates for HKD pricing and real-time boarding
The Latest Rates endpoint is your entry point for real-time HKD quotes. Depending on your plan, updates are available at different intervals (e.g., every 60 minutes, every 10 minutes, or other plan-specific cadence). The response includes:
- success: integrity check
- timestamp/date: data freshness
- base: reference currency (default USD)
- rates: map of symbols to rates
- unit: typically per troy ounce
Example: Latest with default base USD (convert downstream to HKD)
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744
},
"unit": "per troy ounce"
}
Implementation tips:
- Cache by timestamp, not just now(). If two servers hit at nearly the same time, reuse the same snapshot.
- Defensive checks: if timestamp unchanged from previous poll, skip downstream recalcs to spare compute.
- Weekend behavior: expect fewer or no updates; UI should show “Last updated” clearly.
Historical rates in HKD for backtesting and PnL explain
Historical rates are available for most currencies dating back to 2019 (as per service scope). Appending a date to the Historical Rates path returns a daily snapshot for that day. Use it to:
- Backfill charts in HKD.
- Compute historical spreads or moving averages.
- Run PnL explains in local currency.
Example: Historical response structure
{
"success": true,
"timestamp": 1789432201,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
HKD usage strategy:
- If your plan supports base=HKD historically, request it. Otherwise, store USD-based historical and apply USD→HKD series (from the same date) to display HKD charts.
- Keep FX and metals synchronized by date/time to avoid mismatched conversions.
Time-series HKD analytics
The Time-Series endpoint returns daily historical rates between two dates, useful for rolling volatility, regression, and charting. You can:
- Pull a contiguous block (e.g., the last 180 days) and convert to HKD in bulk.
- Compute SMA/EMA, Bollinger Bands, and crossovers for HKD-based signals.
Example: Time-series response and field usage
{
"success": true,
"timeseries": true,
"start_date": "2026-09-09",
"end_date": "2026-09-16",
"base": "USD",
"rates": {
"2026-09-09": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-09-11": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-09-16": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Best practices:
- Validate that timeseries is true and dates match your requested window.
- Handle missing days (weekends) gracefully when rendering charts—don’t assume daily continuity.
- Resample to business days only for most financial analytics.
Convert endpoint: Aligning HKD with pricing logic
The Convert endpoint lets you convert any amount across currencies and metals. This is your simplest route to display in HKD when default base is USD or when you need an explicit conversion step for pricing logic.
Example: Convert response structure
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789518601,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
How to apply for HKD:
- Convert 1 USD → HKD to get USD→HKD multiplier, then multiply your USD-based metals rates.
- Alternatively, convert HKD → XAU to compute how many ounces your HKD budget buys—useful for treasury or procurement allocation workflows.
Tips:
- Round and format outputs consistently when showing HKD to customers. Keep internal precision higher than displayed precision.
- Batch conversions server-side if you price many SKUs at once.
Fluctuation: HKD movement tracking and alerts
The Fluctuation endpoint returns start_rate, end_rate, absolute change, and percentage change for a window. Use it to drive HKD-denominated alerts and dynamic pricing rules.
Example: Fluctuation response insights
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-09",
"end_date": "2026-09-16",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
},
"XAG": {
"start_rate": 0.03825,
"end_rate": 0.03815,
"change": -0.0001,
"change_pct": -0.26
},
"XPT": {
"start_rate": 0.000915,
"end_rate": 0.000912,
"change": -3.0e-6,
"change_pct": -0.33
}
},
"unit": "per troy ounce"
}
Implementation tips for HKD:
- Convert start_rate and end_rate to HKD using corresponding USD→HKD rates on those dates to avoid FX distortion in alerts.
- Consider both absolute and percentage changes—use percentage for cross-metal normalization.
OHLC: HKD market structure and candle charts
The Open/High/Low/Close (OHLC) endpoint provides daily candle components for metals. For chart rendering in HKD, either request base=HKD (if supported) or transform USD OHLC values into HKD using synchronized FX data.
Example: OHLC response structure
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
},
"XAG": {
"open": 0.03825,
"high": 0.0383,
"low": 0.0381,
"close": 0.03815
},
"XPT": {
"open": 0.000915,
"high": 0.000918,
"low": 0.00091,
"close": 0.000912
}
},
"unit": "per troy ounce"
}
Usage notes:
- Always keep OHLC values internally at high precision. Only round at the final display step.
- When converting to HKD, ensure consistent FX timestamp alignment for open, high, low, and close.
Bid/Ask spreads in HKD for execution-aware pricing
The Bid/Ask endpoint provides bid, ask, and spread. This is valuable for trading tools and for retail price calculators that incorporate simulated execution or safety margins in HKD.
Example: Bid/Ask response with spread
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
},
"XAG": {
"bid": 0.0381,
"ask": 0.0382,
"spread": 0.0001
},
"XPT": {
"bid": 0.000911,
"ask": 0.000913,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
HKD pricing guide:
- Convert bid and ask separately to HKD—don’t convert mid and recompute, or you’ll understate the HKD spread if FX is non-linear across decimals.
- For retail margining, add a buffer on top of ask for selling and below bid for buybacks, all in HKD terms.
Carat endpoint: Converting gold carats to HKD retail prices
Use the Carat endpoint to get gold rates by carat directly. This simplifies retail-grade pricing workflows that sell in 24k, 22k, 18k, etc., especially for Hong Kong storefronts where carat-based tags are standard. Append a base if needed to align with your currency preference.
Implementation ideas:
- Fetch carat rates and convert to HKD for price tags.
- Show per-gram HKD price for each carat level in your POS.
- Synchronize with Latest or OHLC for real-time adjustments.
Lowest/Highest and HKD-based range analytics
The Lowest/Highest Price endpoint returns the minimum and maximum price for a specified day. In HKD analytics, this helps produce “Today’s Range” widgets, volatility summaries, or intraday risk guardrails.
Tips:
- Convert min and max separately to HKD to preserve range accuracy.
- Trigger alerts if price breaks yesterday’s HKD high/low.
Historical LME data in HKD
Metals-API provides a historical-lme endpoint for LME symbols dating back to 2008. For HKD-aware manufacturing and industrial trading, you can:
- Pull LME historical series (USD base) and convert to HKD for cost modeling.
- Align LME data with your procurement calendar and currency exposures.
- Keep an internal HKD index of inputs to drive dynamic quotes.
Intraday: Finer granularity for HKD decisioning
The Intraday endpoint allows querying intraday exchange rate data for a single symbol where supported. Use this to enable HKD quotes that respond more frequently to market changes within the day. Be mindful of plan-specific limits and data granularity.
Authentication, authorization, and HKD security best practices
Every request must include your API key via the access_key parameter. To secure HKD-denominated apps:
- Never expose your API key in client-side code for production. Proxy calls from your server or use a secure edge function.
- Rotate keys periodically and on developer offboarding.
- Scope environment variables per environment (dev/staging/prod) to avoid cross-env leakage.
- Log only truncated keys in observability tools.
Start now by obtaining your key at the Metals-API Website. The Metals-API Documentation contains request/response schemas, parameters, and additional examples to accelerate integration.
Error handling, retries, and HKD data integrity
In production systems that rely on HKD pricing, resilient error handling is essential:
- Check success flag in every response. If false, inspect error metadata and back off.
- Use exponential backoff with jitter on transient failures (network, 5xx).
- Fail open with cached data when possible, and surface a “stale” badge to the UI.
- Validate that expected symbols are present in rates. If missing, don’t proceed to price calculations.
- Monitor for timestamp regressions (older data than last fetch) to avoid time-travel anomalies in analytics.
Caching and performance: Serving HKD prices at scale
To support large user bases and frequent recalculations:
- HTTP edge caching: Use CDN or edge functions to cache by URL + query string including base=HKD and symbols list.
- App-layer cache: Store the JSON payload keyed by timestamp and base to reuse across services.
- Batch computations: Convert entire metal arrays to HKD once per update cycle; don’t reconvert per request.
- Precompute grams and carat-based prices for retail catalogs; invalidate on new timestamps.
- Use time-series storage for historical (e.g., a columnar store) and fetch only deltas.
Data validation and sanitization for HKD pipelines
Before prices drive production logic, validate inputs:
- Schema: Ensure fields like success, timestamp, base, rates, and unit exist.
- Types: Confirm numeric fields are parseable numbers; guard against NaN/Infinity.
- Ranges: Reasonable bounds checks (e.g., non-negative rates).
- Completeness: Verify all required metals exist for your SKU set.
- Monotonicity: For time-series, ensure dates are ordered and handle gaps.
Units: Troy ounces vs grams in HKD displays
Metals-API defaults to “per troy ounce.” Hong Kong retail may prefer grams for consumer clarity. Convert carefully:
- 1 troy ounce ≈ 31.1034768 grams.
- When showing per-gram HKD prices, convert metal rates first to HKD, then divide by 31.1034768.
- Label units prominently to avoid mispricing disputes.
Time, timezone, and HKD trading hours
Accurate timestamps ensure reliable HKD pricing and audit trails:
- Record the API’s timestamp for each fetch. Store it with your HKD-transformed rates.
- Display “Last updated” with a timezone indicator (commonly UTC or HKT) to keep context clear.
- On weekends or holidays, expect unchanged values; your UI should communicate that the last known price is being displayed.
Security and compliance in HKD-focused solutions
For fintech, trading, and ERP systems operating in or serving Hong Kong:
- Secrets management: Keep API keys in vaults or managed secrets.
- Encryption: TLS in transit; at-rest encryption for stored payloads and derived HKD series.
- Access control: Restrict who can change pricing configurations (e.g., markups) in admin tools.
- Audit logging: Track who changed what and when, capturing old/new HKD rates and metadata.
End-to-end example: Building an HKD product pricing engine
- Fetch Latest metals (XAU, XAG) periodically.
- Fetch USD→HKD rate via Convert (amount=1).
- Compute HKD per troy ounce for each metal.
- Convert to per-gram HKD for retail display.
- Apply carat purity factors (e.g., 18k = 75% pure) or use Carat endpoint.
- Add making charges and margins in HKD.
- Cache and push to storefront or POS.
- Use Fluctuation and OHLC to trigger repricing or promotional messaging.
Troubleshooting common HKD integration issues
- “My prices look off by ~31x”: You likely used troy ounces where grams were expected. Convert units explicitly.
- “Spread seems too small in HKD”: Don’t convert mid only; convert bid and ask separately to HKD and recompute spread.
- “Charts have gaps”: Markets close on weekends/holidays. Either skip drawing points or resample to business days.
- “Rounding causes checkout mismatches”: Maintain high precision internally, round only at UI, and use the same rounding rules server-side.
- “Different services show slightly different HKD”: Ensure you use the same timestamped FX rate for all HKD conversions within a cycle.
Advanced analytics: HKD signals and risk metrics
- Volatility: Compute rolling standard deviation on HKD-transformed returns.
- Correlation: Assess HKD gold vs HKD copper co-movements for portfolio construction.
- Event windows: Examine HKD metals behavior around macro events relevant to Hong Kong markets.
- Regime detection: Segment HKD series into volatility regimes for adaptive pricing.
Architectural patterns for HKD scale
- Data layer: Centralized pricing microservice converts all metals to HKD once per tick; downstream services subscribe.
- Storage: Append-only time-series store for HKD candles and snapshots. Keep USD originals for cross-checks.
- APIs: Offer internal read-only endpoints for “current HKD price per metal” and “historical HKD series.”
- Observability: Log timestamp, base, symbols, conversion factors, and latency for each fetch.
Endpoint-by-endpoint HKD-focused details, examples, and best practices
Latest Rates: Real-time HKD display and caching
Purpose: Fetch the current snapshot of metal prices. Updated at plan-specific intervals. Default base is USD; HKD base may be available depending on plan.
Parameters to consider:
- access_key: Your API key (required).
- symbols: Comma-separated metals (e.g., XAU,XAG,XPT). Filter to reduce payload and speed processing.
- base: If plan allows, set to HKD to get direct HKD prices.
Example success response (USD base, convert to HKD downstream):
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
},
"unit": "per troy ounce"
}
Error handling:
- If success is false, inspect error, retry with backoff, and fall back to cached HKD-transformed snapshot.
- On repeated failures, alert ops and fail open with stale HKD output (labeled) to keep checkout operational.
Performance:
- Poll at or below plan’s update frequency; over-polling wastes calls without fresher data.
- Cache by (base, symbols) and timestamp.
Security:
- Call server-to-server; don’t expose access_key client-side.
Historical Rates: HKD backfills and analytics
Purpose: Retrieve single-day historical prices for backfills, reconciliations, and daily analytics.
Parameters:
- access_key (required)
- date (required): YYYY-MM-DD snapshot
- symbols (optional): Filter metals
- base (optional per plan): HKD if supported
Example response (USD base):
{
"success": true,
"timestamp": 1789432201,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
HKD conversion strategy:
- Use same-day USD→HKD rate for consistent historical HKD computation.
- Store both USD and HKD snapshots for auditing.
Time-Series: HKD charting and modeling
Purpose: Pull a series of daily data between two dates.
Parameters:
- access_key (required)
- start_date, end_date (required): YYYY-MM-DD range
- symbols (optional)
- base (optional per plan)
Example response (USD base):
{
"success": true,
"timeseries": true,
"start_date": "2026-09-09",
"end_date": "2026-09-16",
"base": "USD",
"rates": {
"2026-09-09": { "XAU": 0.000485, "XAG": 0.03825, "XPT": 0.000915 },
"2026-09-11": { "XAU": 0.000483, "XAG": 0.0382, "XPT": 0.000913 },
"2026-09-16": { "XAU": 0.000482, "XAG": 0.03815, "XPT": 0.000912 }
},
"unit": "per troy ounce"
}
Best practices:
- Normalize non-business days when computing returns.
- Convert to HKD after fetching for consistent analytics.
Fluctuation: HKD-day change summaries
Purpose: Get absolute and percent changes for a period.
Parameters:
- access_key (required)
- start_date, end_date (required)
- symbols (optional)
- base (optional per plan)
Example (USD base):
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-09",
"end_date": "2026-09-16",
"base": "USD",
"rates": {
"XAU": { "start_rate": 0.000485, "end_rate": 0.000482, "change": -3.0e-6, "change_pct": -0.62 }
},
"unit": "per troy ounce"
}
HKD detail:
- Derive HKD change_pct identically to USD (percentage is unitless). For absolute change in HKD, convert start and end to HKD first.
OHLC: HKD candles and signals
Purpose: Obtain open, high, low, and close per day for metals.
Parameters:
- access_key (required)
- date or range (as supported)
- symbols (optional)
- base (optional per plan)
Example (USD base):
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": { "open": 0.000485, "high": 0.000487, "low": 0.000481, "close": 0.000482 }
},
"unit": "per troy ounce"
}
HKD precision:
- Convert open/high/low/close individually to HKD.
- When plotting, round to display precision but maintain raw HKD values for analytics.
Bid/Ask: HKD execution-aware quotes
Purpose: Access current bid and ask per metal.
Parameters:
- access_key (required)
- symbols (optional)
- base (optional per plan)
Example (USD base):
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": { "bid": 0.000481, "ask": 0.000483, "spread": 2.0e-6 }
},
"unit": "per troy ounce"
}
HKD best practices:
- Compute HKD spread = (ask_HKD - bid_HKD) and show it to traders.
- Use HKD bid for buyback quotes; HKD ask for sell quotes.
Carat: HKD retail simplification
Purpose: Fetch gold rates by carat to eliminate manual purity math.
Parameters overview:
- access_key (required)
- base (optional per plan; HKD-friendly for direct pricing)
Tips:
- Display per-gram HKD by carat for storefront labeling.
- Automate SKU price updates from carat rates plus making charges.
Lowest/Highest: HKD intraday range
Purpose: Obtain min and max prices for a given date. Great for risk dashboards, HKD range badges, or alerting.
Parameters overview:
- access_key (required)
- date (required)
- symbols and base (optional per plan)
HKD detail:
- Convert min and max separately to HKD to keep range integrity.
Historical LME: HKD for industrials
Purpose: Access LME historical rates dating back to 2008 for supported symbols.
HKD guidance:
- Convert USD LME series to HKD for procurement and budget planning.
- Align with your financial close calendar for accurate variance analysis.
Intraday: HKD granularity and responsiveness
Purpose: Finer-grained updates for a single symbol where available. Use for responsive HKD quotes and high-frequency alerts.
Performance:
- Honor plan limits; cache between fetches to reduce duplicate work.
cURL examples: Putting it all together for HKD usage
Latest USD base (convert to HKD afterward)
curl -G "https://metals-api.com/api/latest" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "symbols=XAU,XAG,XPT,XPD,XCU,XAL"
Attempt base=HKD (if supported by your plan)
curl -G "https://metals-api.com/api/latest" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "base=HKD" \
--data-urlencode "symbols=XAU,XAG"
Convert 1 USD to HKD for HKD multiplier
curl -G "https://metals-api.com/api/convert" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "from=USD" \
--data-urlencode "to=HKD" \
--data-urlencode "amount=1"
Realistic JSON responses you can expect
Use these shapes when designing your data models and parsers.
Latest (USD base)
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": { "XAU": 0.000482, "XAG": 0.03815 },
"unit": "per troy ounce"
}
Historical (USD base)
{
"success": true,
"timestamp": 1789432201,
"base": "USD",
"date": "2026-09-15",
"rates": { "XAU": 0.000485, "XAG": 0.03825 },
"unit": "per troy ounce"
}
Time-series (USD base)
{
"success": true,
"timeseries": true,
"start_date": "2026-09-09",
"end_date": "2026-09-16",
"base": "USD",
"rates": {
"2026-09-09": { "XAU": 0.000485, "XAG": 0.03825 },
"2026-09-16": { "XAU": 0.000482, "XAG": 0.03815 }
},
"unit": "per troy ounce"
}
Convert (USD to XAU)
{
"success": true,
"query": { "from": "USD", "to": "XAU", "amount": 1000 },
"info": { "timestamp": 1789518601, "rate": 0.000482 },
"result": 0.482,
"unit": "troy ounces"
}
Fluctuation (USD base)
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-09",
"end_date": "2026-09-16",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
}
},
"unit": "per troy ounce"
}
OHLC (USD base)
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
}
},
"unit": "per troy ounce"
}
Bid/Ask (USD base)
{
"success": true,
"timestamp": 1789518601,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": { "bid": 0.000481, "ask": 0.000483, "spread": 2.0e-6 }
},
"unit": "per troy ounce"
}
Practical HKD tips a beginner might miss
- Label units on every price: “HKD per gram” vs “HKD per troy oz.”
- Show timestamps on screens used for negotiation or contracts.
- Cache aggressively to stabilize UX; re-render only when timestamp changes.
- On weekends, freeze the UI at last good snapshot and surface a gentle “Market closed” indicator.
- Log the USD→HKD factor you used for every HKD conversion; it simplifies audits.
Digital transformation and HKD: What’s next
With Metals-API, HKD-denominated metals pricing becomes a building block for smarter, faster applications:
- Smart technology integration: Use serverless workflows to precompute HKD prices every minute and push to edge caches.
- Data analytics and insights: Deploy HKD volatility and regime dashboards to inform procurement and treasury decisions.
- Future trends: Combine carat-based feeds with buyer journey analytics for dynamic HKD offers at checkout.
- Technological advancement: Integrate OHLC and Bid/Ask with ML-based risk models tailored to Hong Kong market hours.
Where to go next
- Read the complete Metals-API Documentation for parameters, examples, and integration specifics.
- Browse the full Supported Symbols list to plan your HKD coverage.
- Get your free API key at the Metals-API Website and build your HKD pricing service today.
Additional references:
- Hong Kong Exchanges and Clearing (HKEX) for broader market context.
- Bank for International Settlements statistics for FX market insights.
Conclusion
Metals-API makes it straightforward to access real-time and historical metals pricing and convert it cleanly into Hong Kong Dollar (HKD) for dashboards, trading tools, checkout pages, and ERP systems. By mastering base currency handling, units conversion, timestamps, caching, and robust error management, you can deliver resilient HKD-denominated experiences across retail and institutional use cases. Combine Latest, Historical, Time-Series, Fluctuation, OHLC, Bid/Ask, Carat, and, where relevant, Historical LME and Intraday to power dynamic HKD strategies. Get started now with the Metals-API Website and dive deep into parameters and best practices in the Metals-API Documentation.
FAQ
How do I get HKD prices if the default is USD?
Either set base=HKD if supported by your plan or convert USD-based outputs to HKD using the Convert endpoint. Keep USD→HKD timestamps aligned with the metals data timestamp.
Are metals quoted per gram or per troy ounce?
By default, “per troy ounce.” Convert to grams by dividing by 31.1034768. Always label your units explicitly in HKD displays.
How often do HKD prices update?
The Latest endpoint updates at plan-specific intervals. Cache accordingly and expect fewer updates on weekends or holidays.
Should I use bid/ask or mid for HKD retail pricing?
Use ask for selling to customers and bid for buyback programs. Convert both bid and ask to HKD separately to maintain accurate spreads.
What’s the best way to handle market closures?
Display the last known HKD price with a “Market closed” or “Last updated” timestamp. Avoid repeatedly recalculating during closures.
Where can I find all symbols and confirm HKD support?
Check the Metals-API Supported Symbols page for metals and currencies, including HKD.
How do I secure my API key?
Never store it in client-side code. Use server-side proxies or edge functions, rotate keys periodically, and keep them in a secrets manager.
Can I use carat-based gold rates directly in HKD?
Yes. Use the Carat endpoint and request base=HKD if supported or convert results to HKD post-fetch. Then compute per-gram HKD if needed for labeling.
What about LME data for industrials in HKD?
Use the Historical LME endpoint (USD base) and convert to HKD for budgeting, procurement, and manufacturing analytics.
Where do I begin?
Start at the Metals-API Website to get your free API key, then explore the Metals-API Documentation for implementation details and the Supported Symbols list to plan your HKD integration.