Get Bhopal Gold 24k (BHOP-24k) - Price Per Gram prices using this API
If you sell or buy gold in Bhopal and need a reliable “Bhopal Gold 24k (BHOP-24k) – Price Per Gram” feed for pricing, invoicing, or analytics, you can build it with Metals-API’s XAU benchmarks, the carat feature, and currency conversion into INR—then convert troy ounces to grams. In this guide, we show how to use Metals-API to fetch the global gold rate, normalize it to per-gram 24k gold, and output a BHOP-24k stream for your application. We’ll cover real-time queries, historical backfills, unit and timezone gotchas, and practical caching. You’ll get a working curl request and a Python snippet to compute price-per-gram 24k in INR, ready to power trading tools, ERP pricing, and consumer apps.
What “BHOP-24k price per gram” actually means, technically
BHOP-24k is not a native exchange symbol; it’s a local-market view you can compute from Metals-API data:
- Underlying benchmark: XAU (gold) reference price from Metals-API.
- Purity: 24k is 99.9–99.99% pure gold, effectively equivalent to pure XAU pricing.
- Unit: Price per gram (not per troy ounce). 1 troy ounce = 31.1034768 grams.
- Currency: INR (Indian Rupee) for a Bhopal-localized view.
- Optional local adjustments: Retail premiums, making charges, or taxes are outside the scope of the API; you can apply them in your code as an additive/multiplicative overlay.
With this approach, your “BHOP-24k” stream is a derived instrument: XAU quoted in INR, converted from per troy ounce to per gram, optionally adjusted for retail spread, then labeled BHOP-24k in your system.
Endpoints you’ll use to build BHOP-24k
We’ll focus on two endpoints that are highly relevant to computing a BHOP-24k feed:
- Latest Rates Endpoint: Get the current XAU rate. We’ll convert to INR and per gram to create your BHOP-24k live price-per-gram feed.
- Historical Rates Endpoint: Backfill a time series for charts, P&L, or trend analysis.
Metals-API also provides a dedicated carat endpoint for gold by carat, which can be helpful when you model alloys (e.g., 22k, 18k). For 24k, XAU is effectively the same purity, so you can compute from XAU directly. Explore advanced options in the Metals-API Documentation and confirm supported symbols on the Metals-API Supported Symbols page.
Symbol mapping for this guide
| Concept | How we implement it with Metals-API |
|---|---|
| BHOP-24k (price per gram) | XAU quoted in INR, converted from per troy ounce to per gram; labeled “BHOP-24k” in your app |
| Currency | INR as the base (so results are INR per troy ounce) |
| Unit conversion | Divide INR per troy ounce by 31.1034768 to get INR per gram |
Quick start: Get a free API key
You’ll need an API key to call the endpoints. Sign up on the Metals-API Website and get your free key. Reference parameters and options in the Metals-API Documentation.
Building a real-time BHOP-24k price-per-gram feed
1) Latest Rates Endpoint: Fetch live XAU in INR
The Latest Rates endpoint returns exchange rates with a default base of USD. To express the price in INR per troy ounce, set base=INR and request XAU in symbols. Replace YOUR_KEY with your key.
curl -s "https://metals-api.com/api/latest?access_key=YOUR_KEY&base=INR&symbols=XAU"
Example of a realistic JSON response format:
{
"success": true,
"timestamp": 1790208653,
"base": "INR",
"date": "2026-09-24",
"rates": {
"XAU": 0.00000392
},
"unit": "per troy ounce"
}
How to read this:
- base=INR and unit="per troy ounce" mean the rate is quoted as XAU per INR-ounce. In Metals-API, when base is a fiat currency, the numeric value for XAU is the amount of XAU units per 1 INR. To compute INR per troy ounce, invert the rate: 1 / rate(XAU).
- timestamp is a Unix epoch (UTC). Align your charts and caches using this value.
Compute BHOP-24k price per gram:
- INR per troy ounce = 1 / rate(XAU) when base=INR.
- INR per gram = (INR per troy ounce) / 31.1034768.
- Optionally apply local premium/discount (retail spread, GST, making charges) as a separate calculation layer.
2) Python code: Derive BHOP-24k INR/gram from latest XAU
This snippet calls the Latest endpoint, then converts to INR/gram and labels the output as BHOP-24k for your app. Replace YOUR_KEY before running.
import requests
from decimal import Decimal, ROUND_HALF_UP
API_URL = "https://metals-api.com/api/latest"
ACCESS_KEY = "YOUR_KEY"
BASE = "INR"
SYMBOL = "XAU"
TROY_OUNCE_TO_GRAM = Decimal("31.1034768")
def fetch_latest_xau_in_inr():
params = {
"access_key": ACCESS_KEY,
"base": BASE,
"symbols": SYMBOL
}
r = requests.get(API_URL, params=params, timeout=10)
r.raise_for_status()
data = r.json()
if not data.get("success", False):
raise RuntimeError(f"API error: {data}")
return data
def compute_bhop_24k_inr_per_gram(latest):
# latest["rates"]["XAU"] is XAU per 1 INR (base=INR), unit per troy ounce
xau_per_inr = Decimal(str(latest["rates"]["XAU"]))
# INR per troy ounce = 1 / xau_per_inr
inr_per_troy_ounce = (Decimal("1") / xau_per_inr)
# Convert to INR per gram
inr_per_gram = inr_per_troy_ounce / TROY_OUNCE_TO_GRAM
# Round for display purposes (retain higher precision internally)
display = inr_per_gram.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
return {
"symbol": "BHOP-24k",
"timestamp": latest["timestamp"],
"date": latest["date"],
"currency": "INR",
"unit": "per gram",
"price": str(display)
}
if __name__ == "__main__":
latest = fetch_latest_xau_in_inr()
bhop_24k = compute_bhop_24k_inr_per_gram(latest)
print(bhop_24k)
Key fields you’ll use:
- rates.XAU: Convert this to INR per gram by inverting and dividing by 31.1034768.
- timestamp and date: For cache keys, audit trails, and UIs.
- unit: Always confirm it’s “per troy ounce” when converting to grams.
3) Practical notes for real-time BHOP-24k feeds
- Update frequency: The Latest endpoint refresh cadence depends on plan tier. Cache responses for at least the documented update interval to avoid redundant calls.
- Time zone: timestamps are in UTC. Convert to IST for local display if you need Bhopal-local time, but keep UTC for data storage.
- Weekends/holidays: Metals benchmarks may be less volatile or unchanged on market-closure days; don’t assume continuous intraday changes.
- Precision: Use decimal arithmetic to avoid floating-point drift in financial calculations.
- Overlays: Apply city-specific spreads, GST, and making charges in your code if your retail product needs them. Metals-API intentionally provides the underlying benchmark, not retail add-ons.
Backfilling BHOP-24k: Historical rates for charts and analytics
Historical Rates Endpoint
To backfill BHOP-24k for a specific day, query the Historical endpoint for that date with base=INR and symbols=XAU. Then perform the same per-gram unit conversion.
curl -s "https://metals-api.com/api/2026-09-23?access_key=YOUR_KEY&base=INR&symbols=XAU"
Example JSON format:
{
"success": true,
"timestamp": 1790122253,
"base": "INR",
"date": "2026-09-23",
"rates": {
"XAU": 0.00000390
},
"unit": "per troy ounce"
}
To compute BHOP-24k INR/gram for that day:
- INR per troy ounce = 1 / 0.00000390
- INR per gram = (INR per troy ounce) / 31.1034768
Implementation tips:
- Backfill windows: Loop dates from your start to end dates. Respect documented date availability; historical coverage generally goes back multiple years.
- Gaps/closures: If some days return the same value (e.g., due to closures), interpolate or carry-forward values depending on your charting policy.
- Reconciliation: Store both the raw Metals-API payload and your derived BHOP-24k values for reproducibility and audits.
Interpreting Metals-API responses correctly
Key points you must handle precisely to avoid mispricing:
- Base currency: By default, base is USD. If you need INR, set base=INR. Rates represent metal units per base currency unit, with the unit attribute indicating per troy ounce.
- Unit conversion: Convert per troy ounce to per gram by dividing by 31.1034768. For 24k, no additional purity factor is needed; for lower carats, multiply by the purity factor (e.g., 22k ≈ 0.9167).
- Timestamps: Use the timestamp for cache invalidation and alignment with other data sources. The date reflects the UTC calendar day.
- Error handling: Check success=true in responses. If false, inspect the error object and retry or degrade gracefully.
Optional: Gold by carat for non-24k cases
If you also price jewelry alloys (22k, 18k), the carat endpoint helps. For 24k, XAU already reflects pure gold, so computing BHOP-24k from XAU is direct. For details and parameters, refer to the Metals-API Documentation.
Caching, scaling, and cost control
- Cache strategy: Cache latest prices keyed by base and symbols, e.g., cache:INR:XAU with TTL equal to or slightly less than the documented update interval. Serve from cache for sub-interval reads.
- Batching: If you consume multiple metals, request them in one call via symbols=XAU,.... Then compute all derived per-gram values locally.
- Retry/backoff: Implement exponential backoff on transient network errors. Do not hammer the API during incidents; serve stale-but-labeled cache data briefly.
- Idempotency: Reads are safe; protect your app from duplicate downstream updates by checking timestamp changes before publishing.
Validation and monitoring
- Cross-checks: Periodically compare derived INR/gram with a secondary reference source to detect integration regressions.
- Alerts: Trigger alerts when there’s a large jump day-over-day; confirm it’s a real market move rather than a unit/base misconfiguration.
- Instrumentation: Log base, symbols, timestamp, unit, and computed per-gram values; include request IDs for traceability.
Security and key management
- API key storage: Keep your key in server-side secrets managers or environment variables; never ship it in client apps.
- Transport: Use HTTPS only. Validate TLS in your HTTP client.
- Access control: If exposing your BHOP-24k feed to clients, gate it with your own auth and rate limits.
Error handling and recoveries
- Check success: Always branch on success=true. If false, inspect the error object and decide whether to retry or serve cached data.
- Network timeouts: Set reasonable timeouts (e.g., 5–10s). Use retry with jitter; fail open to cached values with a “stale” flag in UIs.
- Data anomalies: If unit or base doesn’t match expectations, reject the payload and alert.
Putting it all together: a BHOP-24k pipeline
- Call Latest Rates with base=INR and symbols=XAU.
- Compute INR per gram: invert the XAU rate (INR per troy ounce), divide by 31.1034768.
- Publish as BHOP-24k with fields: timestamp (UTC), price (INR/gram), and optional local adjustments.
- Cache the result until the next documented update interval.
- For historical backfills, loop dates with the Historical Rates endpoint and compute per-gram similarly.
Why Metals-API for BHOP-24k?
Metals-API provides consistent gold benchmarks with flexible base currency selection, enabling fast computation of local-market views like BHOP-24k without stitching together multiple data sources. Native JSON responses, time-stamped payloads, and historical coverage make it straightforward to build charts and analytics pipelines. Explore the full feature set on the Metals-API Website, and confirm symbol availability on the Metals-API Supported Symbols page.
Advanced considerations
- RBI holidays and local trading hours: While benchmark data is global and time-stamped in UTC, align your BI dashboards to IST and mark Indian market holidays if you correlate with domestic order flows.
- Latency: Place caching and computation close to your API gateway. If you run user-facing quotes, precompute per-gram values at cache refresh to return in microseconds.
- Precision policy: Store high precision internally (e.g., 6–8 decimals) and round only at the edge for display, consistent with your pricing policy.
- Auditability: Persist raw JSON responses and derived values along with your code version/hash to reconstruct published prices later.
Example: End-to-end sample response interpretation
Suppose you request the latest XAU with base=INR and get:
{
"success": true,
"timestamp": 1790208653,
"base": "INR",
"date": "2026-09-24",
"rates": {
"XAU": 0.00000392
},
"unit": "per troy ounce"
}
Then your BHOP-24k INR per gram computation is:
- INR per troy ounce = 1 / 0.00000392
- INR per gram = (INR per troy ounce) / 31.1034768
Publish the result with fields: symbol=BHOP-24k, currency=INR, unit=per gram, timestamp=1790208653, date=2026-09-24, price=[computed value].
Where to go next
- Get your key now: Create a free Metals-API account and start calling the Latest and Historical endpoints.
- Deep dive into parameters, error formats, and additional features: Read the Metals-API Documentation.
- Check symbols and availability: Browse the supported symbols list.
Additional reading: For context on gold pricing mechanics and benchmarks, see reference primers from global market observers such as the World Gold Council or your preferred research provider.
FAQ
Is BHOP-24k a native Metals-API symbol?
No. In this guide, BHOP-24k is a derived instrument you compute from XAU, using base=INR and converting per troy ounce to per gram. You can then label and distribute it inside your application.
How do I get 24k specifically—should I use the carat endpoint?
24k is effectively pure gold, so XAU-based calculations already represent 24k. The carat endpoint is most helpful for alloys (22k, 18k). Refer to the documentation for details.
How do I account for Bhopal retail spreads or taxes?
Apply them as an overlay to the computed INR/gram benchmark. Keep them configurable so you can change them without altering your data ingestion pipeline.
What about weekends and market holidays?
Expect fewer updates or unchanged rates on closures. Cache and display the last known benchmark with a “last updated” timestamp, and avoid assuming intraday volatility when markets are closed.
How should I store the data?
Persist raw JSON responses, your derived BHOP-24k values (INR/gram), the unit and base used, and the UTC timestamp. This ensures auditability and reproducibility.
Where can I find every symbol the API supports?
Use the official list here: Metals-API Supported Symbols.