Capture Current Salem Gold 22k (SALE-22k) Historical Prices through this API
If you quote or hedge 22-karat gold jewelry in Salem or any other local market, you need two things: a reliable Gold (XAU) historical feed and a consistent way to translate pure gold benchmarks into 22k values and your local currency. This guide shows how to capture current and historical prices relevant to “Salem Gold 22k” using Metals-API, pulling XAU benchmarks, transforming them to 22k equivalent per gram or per piece, and automating the results for dashboards, pricing engines, or research backfills. We’ll use Metals-API’s Historical, Time-Series, OHLC, Fluctuation, Latest, Bid/Ask, Convert, Intraday, Carat, Lowest/Highest, Historical LME, and Supported Symbols features. Along the way we’ll cover units, troy ounces vs grams, base currencies, timestamps, timezones, caching, weekend/holiday behavior, validation, and production-grade best practices.
Why 22k equals “XAU plus context” (and how Metals-API helps)
Gold (XAU) is the global reference for fine (99.99%) gold priced “per troy ounce.” Most jewelry in regional markets—like 22k ornaments priced in local currency—reflects a standard purity conversion, local premiums/discounts, taxes, and making charges. The job for your product or analytics stack is to pull XAU historical and current data reliably, convert to 22k, apply your business logic, and push the results where they matter (e-commerce pricing, ERP valuation, risk dashboards, inventory P&L).
Metals-API provides the building blocks via simple JSON endpoints that you can combine:
- Latest, Historical, and Time-Series provide spot and daily closes for Gold (XAU).
- OHLC and Lowest/Highest give granular daily bars and extrema for analysis and guardrails.
- Bid/Ask unlocks spread-aware pricing for executable-style quotes.
- Fluctuation quantifies change and percent change across a window for alerts and PnL explainers.
- Convert gives instant metal-to-currency and currency-to-metal conversions.
- Carat provides gold rates by carat so you can directly reference 22k alongside XAU.
- Intraday supports tighter intervals for near-real-time visuals and triggers.
- Historical LME serves industrials; useful when your catalog spans precious and base metals.
- Supported Symbols ensures your system maps the right tickers.
Start at the Metals-API Website and get a free API key to test in minutes. The detailed parameter reference lives at the Metals-API Documentation, and you can confirm available tickers on the Metals-API Supported Symbols page.
What we’ll build: a practical 22k historical pipeline
We’ll outline a straightforward, production-minded flow you can adapt:
- Query XAU historical rates with the Time-Series endpoint for your backfill window.
- Derive 22k prices from XAU:
- Adjust purity: 22k equals 22/24 ≈ 0.9167 of fine gold content.
- Convert per troy ounce to per gram: 1 troy ounce = 31.1034768 grams.
- Optionally, add local premiums, making charges, and taxes as separate components.
- Alternatively, pull directly from the Carat endpoint for 22k to reduce manual conversion.
- Convert to your currency if needed using base/quote settings or the Convert endpoint.
- Store results with timestamps and units; cache responses to reduce API calls.
- Use OHLC, Lowest/Highest, Bid/Ask, and Fluctuation for QA, analytics, and alerts.
Key concepts developers must get right
- Units: XAU is quoted “per troy ounce.” If you sell per gram, convert accurately.
- Purity: 22k is 91.6667% of fine gold mass; don’t confuse with 24k (pure) XAU.
- Base currency: By default, rates are relative to USD unless you specify otherwise.
- Timestamp/timezone: Store “timestamp” and “date” from responses; align to your system’s timezone for charting and cutoffs.
- Weekends/holidays: Expect unchanged rates from the last available trading day; plan your job schedules and backfills accordingly.
- Caching: Cache identical queries (same endpoint and params) in your edge/app to save calls and time.
- Validation: Check “success” before reading fields; gracefully handle empty or partial data.
A complete cURL to capture XAU time-series
This example fetches a week of XAU data. Replace YOUR_ACCESS_KEY with your key.
curl -s "https://metals-api.com/api/timeseries?access_key=YOUR_ACCESS_KEY&base=USD&symbols=XAU&start_date=2026-09-09&end_date=2026-09-16"
Representative JSON response and what matters
{
"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"
}
Read these fields:
- success: must be true before using data.
- timeseries: indicates a time-window response.
- start_date / end_date: your requested bounds; respect for storage keys.
- base: the numeraire (USD by default); multiply by this base logic in your pipelines.
- rates[date][XAU]: since base=USD, the value is troy ounces of gold that 1 USD buys. To get USD per ounce, invert it (1 / XAU).
- unit: confirms “per troy ounce”, so you can convert to grams when needed.
From XAU to 22k per gram (and your currency)
To express 22k prices in your quote currency, combine conversion steps:
- Get USD per troy ounce:
- If rates['XAU'] = ounces per USD, then USD_per_ounce = 1 / rates['XAU'].
- Convert to per gram: USD_per_gram = USD_per_ounce / 31.1034768.
- Purity adjust: USD_per_gram_22k = USD_per_gram × (22/24).
- If your base currency is not USD:
- Either set base to your currency in the API call (if supported on your plan), or
- Use the Convert endpoint to convert the USD amount into your currency.
- Add optional making charges, GST/VAT, and local premiums as separate terms for transparency.
Alternatively, use the Carat endpoint to retrieve gold rates by carat directly and simplify your purity transformation logic. Consult the Metals-API Documentation for how to append the right base and parameters for 22k quotations.
Minimal Python example: pull XAU history and compute 22k per gram
The following example shows how to turn the time-series response into 22k-per-gram values. Replace YOUR_ACCESS_KEY. Store results with date, price, unit, and base currency metadata.
import requests
from decimal import Decimal, ROUND_HALF_UP
ACCESS_KEY = "YOUR_ACCESS_KEY"
url = "https://metals-api.com/api/timeseries"
params = {
"access_key": ACCESS_KEY,
"base": "USD",
"symbols": "XAU",
"start_date": "2026-09-09",
"end_date": "2026-09-16"
}
r = requests.get(url, params=params, timeout=30)
data = r.json()
if not data.get("success"):
raise RuntimeError(f"API error: {data}")
oz_to_grams = Decimal("31.1034768")
purity_22k = Decimal(22) / Decimal(24)
results = []
for day, symbols in sorted(data["rates"].items()):
xau = Decimal(str(symbols["XAU"])) # ounces per USD
usd_per_oz = Decimal(1) / xau
usd_per_gram = (usd_per_oz / oz_to_grams)
usd_per_gram_22k = (usd_per_gram * purity_22k).quantize(Decimal("0.00001"), rounding=ROUND_HALF_UP)
results.append({
"date": day,
"price": str(usd_per_gram_22k),
"currency": data.get("base", "USD"),
"unit": "per gram (22k)"
})
print(results)
Production note: wrap this call with retries, caching, and guards around missing dates (e.g., weekends). Consider using the Carat endpoint to natively retrieve 22k, reducing manual conversions and the risk of rounding drift.
Confirming symbols and expanding coverage
Always verify symbol availability via the Metals-API Supported Symbols list. For gold, you’ll typically use XAU. If you also price silver, platinum, palladium, copper, aluminum, nickel, or zinc, check XAG, XPT, XPD, XCU, XAL, XNI, and XZN on that page and batch your queries accordingly with the Time-Series and Latest endpoints. For product catalogs spanning precious and industrials, add Historical LME access for deeper backfills on metals with LME benchmarks.
Using Latest to drive live product UIs and sanity checks
For e-commerce and dashboards that need fresh quotes, poll Latest at an interval suitable for your plan’s updates. Combine Latest with your cached historicals to build intraday charts and quickly QA outliers.
Representative Latest response
{
"success": true,
"timestamp": 1789519290,
"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:
- timestamp: epoch seconds; use for chart alignment and cache keys.
- date: human-readable date of the snapshot.
- rates: ounces per 1 base unit (here, per USD). To get price in USD per ounce, invert as 1 / XAU.
- unit: confirms “per troy ounce.”
Tip: If you deliver per-gram prices to the front end, transform server-side to avoid repeating high-precision math on clients and to keep a single source of truth.
Historical by date: auditing and reconciling specific days
When reconciling finance or inventory positions, query the Historical endpoint for a specific date to lock pricing for settlements, NAVs, or period PnL.
Representative Historical response
{
"success": true,
"timestamp": 1789432890,
"base": "USD",
"date": "2026-09-15",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Implementation notes:
- If the market was closed on the requested date, expect the last available rate; persist the returned date along with your business date to avoid double-counting.
- Always store the API “timestamp” for audit trails and time-slicing analytics.
Fluctuation: instant alerts and change summaries
Build monitoring that flags when 22k-equivalent prices cross thresholds. Fluctuation summarizes changes over a window and saves you from hand-rolling diff logic across many symbols.
Representative Fluctuation response
{
"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"
}
How to use:
- Map change_pct on XAU to expected 22k per-gram changes; the percent is identical across purity-adjusted prices.
- Combine with OHLC to avoid false alarms on intraday noise; use Fluctuation over your business-defined window (e.g., previous close to present).
OHLC and Lowest/Highest: better charts, better risk controls
OHLC supports candlesticks, while Lowest/Highest helps define intraday or daily value-at-risk guardrails, reprice bands, or anomaly detection thresholds.
Representative OHLC response
{
"success": true,
"timestamp": 1789519290,
"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"
}
Practical usage:
- Use close as your daily settle for accounting; use high/low to bound intraday promotional pricing and protect margins.
- Invert open/high/low/close to USD per ounce where required; keep precision high (Decimal or BigNumber) to avoid rounding drift across conversions to grams and 22k.
Bid/Ask for executable-like quotes or spread-aware valuation
When offering tight quotes to buyers or repricing inventory frequently, bid/ask feeds anchor your fair-value mid and give transparency into implied spreads.
Representative Bid/Ask response
{
"success": true,
"timestamp": 1789519290,
"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"
}
Tips:
- Mid = (bid + ask) / 2 in ounces per USD terms; invert to USD per ounce for valuation.
- For customer quotes, propagate spread into your final 22k-per-gram output so users see consistent bid/ask differentials.
Convert: operational convenience for currency and unit workflows
Convert helps when you need a quick metal-to-currency or currency-to-metal conversion. It can reduce friction in your data layer for totals, invoices, or what-if calculators.
Representative Convert response
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789519290,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Interpretation:
- rate: the same ounces-per-USD rate seen on Latest for XAU.
- result: the amount of gold (in troy ounces) equivalent to the given USD.
Usage pattern: If you store values in grams, convert the result from ounces to grams, then apply the 22k purity factor where relevant.
Carat endpoint: shortcut to 22k quotations
Instead of manually applying 22/24 purity and unit conversions, you can use the Carat endpoint to retrieve gold rates by carat. This is valuable for retail pricing engines where product catalogs are standardized by karat grades (e.g., 22k, 18k, 14k). To use it properly, append the required base settings and parameters per the Metals-API Documentation. The Carat endpoint is especially helpful when you want consistent, policy-driven outputs across multiple karat grades without duplicating transformation logic in your code.
Intraday and near-real-time visuals
For traders, jewelers, or fintech products sensitive to intraday moves, the Intraday endpoint delivers tighter intervals (plan-dependent). Combine Intraday with:
- OHLC for bar charts and session summaries.
- Fluctuation for windowed change stats.
- Bid/Ask for microstructure-aware UI elements (e.g., traffic-light spreads, execution cues).
Design recommendation: Backfill daily with Time-Series and use Intraday only for the current session to keep API usage cost-effective and your datastore tidy.
Historical LME: industrial metals context for mixed catalogs
If your catalog spans precious jewelry and industrial components, Historical LME provides extended backfills on LME-traded symbols (dating back to 2008). Aligning 22k gold series with copper or aluminum LME benchmarks unlocks cost modeling across inventory, BOMs, and manufacturing schedules.
Data model, units, and precision: don’t let rounding bite
- Store base response values as given (ounces per USD when base=USD) in high precision decimals.
- For USD per ounce, invert late, not early, to minimize cumulative rounding.
- Convert to grams with 31.1034768 and persist at least 5–6 decimal places for per-gram cost bases.
- Apply purity factors (22/24) using precise decimal math. Store purity-adjusted intermediate values if your pricing engine has multiple fees or taxes to apply downstream.
- Keep “unit” next to every price in storage and in event logs. Examples: “per troy ounce”, “per gram (22k)”.
Caching and performance patterns
- Key caches by endpoint + normalized parameter string (e.g., a sorted query string) and timestamp/date where applicable.
- Respect response timestamps; don’t poll faster than your plan’s update cadence.
- Edge-cache static historical days aggressively; revalidate only when backfilling or correcting data.
- Batch symbols in a single request when sensible to reduce RTTs (e.g., XAU,XAG,XPT).
- Use a local time-series store (e.g., columnar DB or TSDB) for analytics; periodically reconcile with authoritative responses.
Error handling and resilience
- Check success in responses; if false, branch to a retry with exponential backoff and jitter.
- Handle partial data (e.g., missing dates due to weekends/holidays); forward-fill for UI while tagging as “market closed” for audit clarity.
- Guard against division by zero when inverting very small rates; verify plausibility bounds (e.g., XAU ounces per USD should live in a realistic range).
- Log request IDs, URLs (with key redacted), response time, and parsed timestamps for root-cause analysis.
Authentication, security, and key management
- Keep your access_key secret; never embed it in public client-side code. Proxy requests via your server if you must render data client-side.
- Rotate API keys periodically; keep keys in a vault (e.g., KMS/Secrets Manager) and load at runtime via environment variables.
- Rate limit clients upstream of Metals-API to avoid spikes and 429s. Queue heavy backfills.
- Validate and sanitize all parameters; when building generic query builders, whitelist allowed params and values.
Rate limiting, quotas, and scheduling
- Design ingestion jobs to run just after your plan’s update interval to avoid redundant pulls.
- Separate backfill pipelines from live polling to respect quotas and simplify troubleshooting.
- Use adaptive polling: if Latest indicates no change (timestamp unchanged), extend your next poll interval.
Schema and storage design
- Tables for raw responses (immutable), normalized series (per symbol, per date/time), and derived series (e.g., 22k per gram).
- Columns: symbol, base, unit, timestamp, date, value, source_endpoint, request_params_hash, success, and integrity checksums.
- Indexes on symbol+date/time; partition by month or quarter for faster analytics.
Analytics, charts, and reporting
- Compute moving averages and rolling volatility from your normalized XAU series, then apply purity to get 22k analytics.
- Use OHLC for candlesticks; annotate events (policy, tax changes, promotions).
- Fluctuation-based alerts feed Slack or incident tooling when day-over-day percent changes exceed thresholds.
Digital transformation themes around Gold (XAU)
Gold pricing is rapidly digitizing. With APIs like Metals-API, jewelers and manufacturers can shift from printed rate cards and manual updates to automated pipelines and programmatic alerts. Data analytics—rolling volatilities, beta to FX, seasonality—inform smarter procurement and hedging. Technology integration—linking Metals-API to ERP, OMS, and e-commerce—unifies pricing across channels. Innovations in price discovery, such as combining Bid/Ask with OHLC and intraday feeds, lead to more precise, fair, and auditable customer pricing. These digital asset solutions help even small shops operate like quant-informed desks without overbuilding infrastructure.
Putting it all together: a 22k pricing runbook
- Discovery:
- Confirm XAU availability and any other required symbols via Supported Symbols.
- Read the Documentation for plan limits and endpoint specifics.
- Backfill:
- Use Time-Series to load historical XAU into your store.
- Compute 22k per gram (or use Carat to retrieve by karat directly). Store both raw and derived series.
- Live Updates:
- Poll Latest or Intraday per SLA; enrich with Bid/Ask when quoting.
- Cache aggressively; invalidate on timestamp changes.
- Analytics:
- Use OHLC and Lowest/Highest for charting and guardrails.
- Use Fluctuation for alerts and report cards.
- Currency:
- Either set base to your local currency or use Convert to transform USD amounts.
- Document FX sources and timestamps to keep audits clean.
- Controls:
- Handle weekends/holidays with forward-filled UI but flagged as non-trading days.
- Use validation to prevent nonsensical outputs (e.g., negative prices).
Detailed examples across endpoints you’ll actually call
Time-Series: daily XAU for 22k historical charts
Use Time-Series for chart backfills and model training windows. The JSON above shows XAU across several dates. Typical pitfalls:
- Forgetting to invert ounces-per-USD into USD-per-ounce when you need currency amounts.
- Mixing units (troy ounces vs grams) in the same column; always tag values with unit.
- Assuming every calendar day has data; trading holidays produce gaps or carry-forward values.
Performance tips:
- Chunk long windows by month or quarter to reduce timeouts and memory spikes.
- Cache each chunk by start/end so re-runs don’t hit the API again.
Historical (by date): accounting-grade reproducibility
When a finance report says “price on 2026-09-15,” the Historical response provides that anchor. Store both the intended business date and the returned date; differences matter in post-mortems.
Troubleshooting:
- If success=false, check your access key, date format, or plan coverage.
- If rates are missing, validate symbol availability and parameters.
Latest: real-time edge
Drive live price tiles and keep them stable by debouncing UI updates (e.g., only update when timestamp changes). Cross-check Latest against Intraday to ensure consistent session narratives.
OHLC: analytics-grade bars
Use open/close for day-over-day returns. Use high/low to compute ranges. Convert to grams and 22k after statistical processing to avoid compounding rounding.
Fluctuation: pipeline-friendly deltas
Ideal for overnight batch jobs that produce management summaries like “Gold down 0.62% over the week.” Tie these to inventory valuations in ERP to reconcile margin effects.
Bid/Ask: spread-aware quotes
Derive per-gram 22k bid/ask by: (1) mid = (bid+ask)/2 in ounces per USD, (2) invert mid to USD per ounce, (3) convert to grams, then (4) apply 22k purity, and (5) distribute spread at the per-gram level for consistent UI.
Convert: quick math without extra FX feeds
Handy when you need to translate between USD and ounces on the fly for invoices or receipts. For more complex FX maps (e.g., local currency bases), consult plan capabilities in the documentation.
Carat: first-class support for jewelry-grade pricing
If your store sells 22k, 18k, and 14k items, the Carat endpoint helps unify your karat pricing pipeline. It reduces manual conversions, simplifies QA, and builds confidence in customer-facing quotes.
Historical LME: multi-metal catalogs
Align gold with copper and aluminum trends to forecast BOM costs and price finished goods robustly. Use it to defend pricing to B2B buyers by showing historical context.
Security, governance, and compliance best practices
- Separate roles: dev/test vs prod API keys with scoped access.
- Immutable raw logs: store unmodified JSON for audits; derive views from these logs.
- PII: Metals-API doesn’t store your user PII, but your app might; isolate pricing data from identities.
- Monitoring: alert on error rates, latency spikes, and anomalous values (e.g., outlier XAU). Circuit-break failing endpoints and degrade gracefully.
Testing and QA strategies
- Golden test fixtures: keep a small set of known responses to unit-test transforms (ounce→gram, purity factors, inversion).
- Property-based testing: verify monotonic transformations and unit consistency.
- Backtest-checks: rebuild a month’s 22k series from raw XAU twice—once via manual conversion and once via Carat—and compare within tolerances.
Architectural notes for scale
- Microservices: a “pricing-ingest” service for Metals-API calls; a “pricing-engine” service for transforms; a “pricing-API” for downstream apps.
- Eventing: publish updated 22k prices on a message bus for real-time UIs and alerts.
- Storage: columnar warehouse for analytics; key-value cache for hot prices; object store for raw JSON.
- Observability: structured logs with endpoint, params hash, response timestamp, and derived checksum.
Where to learn more and get started
- Get your key at the Metals-API Website and start testing today.
- Explore the Metals-API Documentation for endpoint details, parameters, and plan capabilities.
- Verify tickers on the Supported Symbols page before wiring your symbol maps.
For background on bullion benchmarks, spreads, and methodologies, see external resources like the LBMA prices and data, CME Group metals markets, and the World Gold Council. Use these to provide educational context around your 22k pricing while relying on Metals-API for the operational feed.
Example workflows end-to-end
E-commerce auto-pricing for 22k items
- Nightly: Time-Series backfill for XAU; compute 22k per gram baseline and store.
- Intraday: Poll Latest or Intraday; propagate spreads and taxes.
- Frontend: Consume a “final price” API that merges live data, making charges, and promotions.
- Audit: Persist all versions of prices with timestamps visible to admins.
ERP inventory valuation
- Daily close: Historical or OHLC close used to value stock-on-hand at 22k equivalents.
- Change report: Fluctuation generates day-over-day valuation delta summaries.
- Controls: Lowest/Highest sets thresholds for exception checks (e.g., sudden drawdowns).
Quant research and PnL explainers
- Backtest: Pull Time-Series for XAU; compute 22k per gram; join with FX, tax regimes, and margins.
- Explain: Use Fluctuation to attribute PnL to metal changes vs FX vs markup policy.
- Visualize: OHLC candlesticks with annotations for pricing decisions and promotions.
Troubleshooting common pitfalls
- “My per-gram values drift slightly over months”: ensure you do high-precision math, invert only once, and consistently apply purity after unit conversion, or consider the Carat endpoint.
- “I see gaps on weekends”: carry forward Friday’s close for UI; label as “market closed.”
- “Values look inverted”: remember rates[XAU] is ounces-per-USD when base=USD; invert for USD-per-ounce.
- “Front end flickers with tiny changes”: debounce updates and round display values, not stored values.
Conclusion: capture “Salem Gold 22k” with confidence
Metals-API gives you robust Gold (XAU) feeds and specialized capabilities—Carat, OHLC, Bid/Ask, Fluctuation, Intraday—that make 22k pricing straightforward and auditable. Combine careful unit handling (troy ounces vs grams), purity math, and currency conversion with strong engineering practices—caching, validation, retries—and you’ll deliver reliable 22k prices for Salem or any local market across e-commerce, ERP, and analytics. Get started now: visit the Metals-API Website to obtain your free API key, then explore the Documentation to wire up endpoints cleanly.
FAQ
Does Metals-API return gold in USD per ounce or ounces per USD?
By default with base=USD, rates[XAU] represents ounces per 1 USD. Invert to get USD per ounce. Always check the “base” and “unit” fields.
How do I get 22k directly instead of converting from XAU?
Use the Carat endpoint to retrieve gold rates by carat (e.g., 22k). Review the exact parameters in the documentation.
What about grams vs troy ounces?
Metals-API quotes per troy ounce; convert using 1 troy ounce = 31.1034768 grams. Be consistent and store units next to values.
How should I handle weekends and market closures?
Expect unchanged values from the prior trading day. For UIs, forward-fill but clearly indicate “market closed.”
Can I get bid/ask for executable-style pricing?
Yes. Use the Bid/Ask endpoint to retrieve spreads for XAU; apply transformations to 22k per gram for customer quotes.
How do I avoid hitting rate limits?
Cache results, schedule polls based on plan update intervals, batch symbols, and separate backfills from live polling.
What security practices should I follow?
Keep your access key server-side, rotate periodically, and validate all parameters. Log response timestamps and integrity checks.
Where can I find supported symbols and docs?
See Supported Symbols and the Metals-API Documentation for endpoint parameters and usage guidance.