The Easiest Way to Get Mumbai Silver (MUMB-XAG) - Per Gram Historical Rates via REST API
You need a clean, daily history of Mumbai silver (MUMB-XAG) priced per gram for dashboards, pricing engines, or backtesting. By the end of this guide you will query Metals-API for MUMB-XAG historical rates, convert the default troy-ounce quotes into per-gram values in INR, and export a ready-to-use CSV.
What you will build: a daily Mumbai silver per-gram history table
We will produce a CSV with rows like:
- date (YYYY-MM-DD)
- mumb_xag_inr_per_troy_ounce (as returned by the API)
- mumb_xag_inr_per_gram (derived)
This is enough to power a product price rule (e.g., “spot + margin per gram”), a research chart, or a manufacturing ERP material revaluation. We’ll use two endpoints: the single-day historical date endpoint and the time-series endpoint.
Before you start, check that the symbol appears in the catalog: browse the Metals-API Supported Symbols. If your environment is new to Metals-API, get a key here: Metals-API Website.
Key idea: convert troy ounce quotes to per-gram INR
Metals-API quotes are returned “per troy ounce” by default. For silver (XAG) and exchange/location-specific variants like MUMB-XAG, you will:
- Request the rate with base=INR so numbers reflect the Indian rupee.
- Receive rates as troy ounces per 1 INR (unit: “per troy ounce”).
- Convert to INR per troy ounce by taking the reciprocal: inr_per_oz = 1 / rate.
- Convert to INR per gram by dividing by 31.1034768 (grams in a troy ounce): inr_per_g = inr_per_oz / 31.1034768.
This keeps calculations explicit and avoids confusion about which side of the quote you’re looking at. We will implement the math below.
Endpoint 1: single historical date (sanity checks and spot backfills)
Use the historical date endpoint when you need a specific calendar day (e.g., to backfill a missing row). Replace YYYY-MM-DD with the date you need.
cURL example
curl "https://metals-api.com/api/2026-09-25?access_key=YOUR_API_KEY&base=INR&symbols=MUMB-XAG"
Illustrative JSON response
Values are representative of the documented response shape; units are per troy ounce.
{
"success": true,
"timestamp": 1790295158,
"base": "INR",
"date": "2026-09-25",
"rates": {
"MUMB-XAG": 0.00028
},
"unit": "per troy ounce"
}
How to read it:
- base: the currency you requested (INR). The rate expresses troy ounces per 1 INR.
- rates.MUMB-XAG: troy ounces of Mumbai silver per INR.
- date: the market date covered by the price.
- timestamp: Unix seconds since epoch (UTC).
- unit: per troy ounce (so you must convert to per gram yourself).
Converting:
- INR per troy ounce = 1 / 0.00028 = 3571.428571...
- INR per gram = 3571.428571... / 31.1034768 ≈ 114.79
Endpoint 2: time-series (daily MUMB-XAG over a range)
For a chart or CSV export, request a contiguous date range in one call. Pick a start_date and end_date (YYYY-MM-DD). As with the single-date endpoint, set base=INR and symbols=MUMB-XAG.
cURL example
curl "https://metals-api.com/api/timeseries?access_key=YOUR_API_KEY&base=INR&symbols=MUMB-XAG&start_date=2026-09-01&end_date=2026-09-26"
Illustrative JSON response (trimmed)
Values below demonstrate structure for multiple days. You will receive one key per calendar day.
{
"success": true,
"timeseries": true,
"start_date": "2026-09-01",
"end_date": "2026-09-26",
"base": "INR",
"rates": {
"2026-09-01": { "MUMB-XAG": 0.00029 },
"2026-09-02": { "MUMB-XAG": 0.000285 },
"2026-09-03": { "MUMB-XAG": 0.000287 }
},
"unit": "per troy ounce"
}
How to read it:
- rates: a dictionary keyed by date. Each value contains the symbol-to-rate mapping for that day.
- Each rates[date]["MUMB-XAG"] is troy ounces per INR for that date (unit per troy ounce).
To compute INR per gram for each day:
- inr_per_oz = 1 / rates[date]["MUMB-XAG"]
- inr_per_g = inr_per_oz / 31.1034768
Python example: write MUMB-XAG per gram to CSV
The script below calls the time-series endpoint, converts to per gram, and writes date-indexed rows. Adjust your date range as needed.
import csv
import math
import os
import sys
import time
import urllib.parse
import urllib.request
import json
API_KEY = os.getenv("METALS_API_KEY", "YOUR_API_KEY")
BASE = "INR"
SYMBOL = "MUMB-XAG"
START_DATE = "2026-09-01"
END_DATE = "2026-09-26"
TOZ_IN_GRAMS = 31.1034768
params = {
"access_key": API_KEY,
"base": BASE,
"symbols": SYMBOL,
"start_date": START_DATE,
"end_date": END_DATE
}
url = "https://metals-api.com/api/timeseries?" + urllib.parse.urlencode(params)
try:
with urllib.request.urlopen(url, timeout=30) as resp:
data = json.loads(resp.read().decode("utf-8"))
except Exception as e:
print(f"Request failed: {e}", file=sys.stderr)
sys.exit(1)
if not data.get("success"):
print(f"API error: {json.dumps(data, indent=2)}", file=sys.stderr)
sys.exit(1)
rates = data.get("rates", {})
rows = []
for date_str, daily in sorted(rates.items()):
oz_per_inr = daily.get(SYMBOL)
if not oz_per_inr:
continue # skip missing entries
inr_per_oz = 1.0 / oz_per_inr
inr_per_g = inr_per_oz / TOZ_IN_GRAMS
rows.append({
"date": date_str,
"mumb_xag_inr_per_troy_ounce": f"{inr_per_oz:.6f}",
"mumb_xag_inr_per_gram": f"{inr_per_g:.6f}"
})
with open("mumb_xag_inr_per_gram.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=["date", "mumb_xag_inr_per_troy_ounce", "mumb_xag_inr_per_gram"])
writer.writeheader()
writer.writerows(rows)
print(f"Wrote {len(rows)} rows to mumb_xag_inr_per_gram.csv")
What the fields mean (and which ones you’ll actually use)
- success: boolean for request status. Always check this before parsing.
- timestamp: Unix seconds (UTC). Helpful for caching and latency measurements.
- date/start_date/end_date: ISO dates (YYYY-MM-DD). These anchor your time series.
- base: your chosen currency (INR in this workflow).
- rates: container for values:
- Single-date response: rates["MUMB-XAG"] is troy ounces per INR.
- Time-series response: rates[date]["MUMB-XAG"] for each day.
- unit: "per troy ounce" tells you how to convert to per gram.
Practical details that save time (units, base, weekends, caching)
- Units and silver form factors:
- Metals-API unit default is per troy ounce for precious metals. 1 troy ounce = 31.1034768 grams.
- Per-gram conversions should keep double precision to avoid rounding drift in invoicing.
- Base currency:
- Requests here use base=INR so you can produce INR-denominated per-gram values.
- If you must report in another currency (e.g., USD), change base and redo the same reciprocal + ounce-to-gram math.
- Timestamps and timezone:
- timestamp is Unix epoch seconds (UTC). date keys are calendar dates (UTC).
- If you align to IST for reporting, map each UTC date to your local business day convention.
- Weekends, holidays, market closures:
- Not every calendar day will have a new fix. Time-series ranges can include days with no changes.
- Handle missing dates by forward-filling or business-day indexing on your side if you require continuity.
- Caching and request economy:
- Historical responses for past dates are immutable—cache them by date key indefinitely.
- For a daily job, hit the time-series endpoint once for the rolling window instead of many single-day calls.
- Validation and symbol discovery:
- Confirm symbol availability and naming in the catalog: Metals-API Supported Symbols.
- If your plan includes additional locations or venues for silver, retrieve their symbols the same way.
Why Mumbai (MUMB-XAG) matters for industrial and manufacturing use
Silver underpins electronics, photovoltaics, medical devices, and high-reliability connectors widely produced across India’s manufacturing corridor. For smart manufacturing and ERP cost models, pricing the local (Mumbai) silver basis helps reduce hedging slippage versus generic benchmarks. With per-gram INR series at daily granularity, you can:
- Feed dynamic pricing into procurement workflows and reorder logic.
- Model bill-of-material sensitivity for silver-bearing components.
- Backtest inventory accounting approaches (e.g., weighted-average cost) against local market reality.
If you’re building analytics or trading tools, pairing MUMB-XAG with time-series queries enables rapid factor studies, signal engineering, and volatility screens in your region of interest.
Troubleshooting checklist
- Empty or missing rates:
- Check success is true. If false, inspect the returned error payload.
- Verify symbols parameter exactly matches the listing for MUMB-XAG in the symbols catalog.
- Values look inverted:
- Remember: rates are troy ounces per 1 unit of the base currency (INR here). To get INR per troy ounce, take the reciprocal.
- Then go from per troy ounce to per gram by dividing by 31.1034768.
- Sparse dates:
- Time-series data keys are calendar dates. If a day is absent or unchanged, apply your desired fill rule (forward-fill is common for VaR backtests with calendar alignment).
- Performance:
- Cache immutable historical responses by date range and symbol.
- Batch multiple consecutive dates via the time-series endpoint instead of looping single-day calls.
Extend from here
Once you have the per-gram INR series for MUMB-XAG, you can layer basic analytics:
- Rolling averages and z-scores for procurement timing.
- Alerts on percentage changes using your own logic or, for quick checks, the API’s fluctuation or OHLC endpoints (see docs).
- Cost-plus pricing formulas in your e-commerce or ERP system keyed directly to the latest daily close.
When you’re ready to combine additional endpoints (latest, OHLC, bid/ask) or broaden coverage, refer to the endpoint catalog and parameter options in the Metals-API Documentation. Always validate symbols via the Supported Symbols page to ensure precise mappings (e.g., venue-specific silver codes like MUMB-XAG).
Reference: quick conversion formulae
- Given: rate = troy_ounces_per_INR
- INR per troy ounce = 1 / rate
- INR per gram = (1 / rate) / 31.1034768
FAQ
How do I confirm that MUMB-XAG is supported on my plan?
Check the symbol in the catalog and your subscription’s access in the Metals-API Documentation. If your plan restricts certain venues or endpoints, the API will return an error payload indicating the limitation.
Why does the JSON show “unit”: “per troy ounce” even if I want per gram?
The API standardizes precious metal units to troy ounces. Use the outlined conversion (divide INR per troy ounce by 31.1034768) to obtain per-gram INR. Keep double precision through calculations before rounding for display.
What timezone is the “date” field?
Dates are provided as calendar dates in UTC, and timestamps are Unix epoch seconds (UTC). If you require IST alignment, map UTC dates to your local trading calendar during ingestion.
How do I handle missing or unchanged days in the time series?
It’s normal for some days (weekends/holidays) to have no update. If you require a continuous daily index, forward-fill the last available value, or reindex to a business-day calendar and fill as needed for your risk model.
Can I request historical rates in another base currency?
Yes. Set the base parameter to your desired currency (e.g., USD, EUR). The reciprocal and ounce-to-gram math remain the same, producing per-gram prices in that base currency.
Ready to integrate? Get your free API key on the Metals-API Website, then explore parameters and edge cases in the Documentation and verify MUMB-XAG in the Supported Symbols. Once your key is active, the cURL and Python snippets above will produce your Mumbai silver per-gram history in minutes.