Get Mysore Gold 24k (MYSO-24k) - Per Gram Historical Prices using this API - example Python requests for 2026
You need Mysore 24k gold (MYSO-24k) per-gram history to backfill pricing models, render charts, and reconcile past orders. By the end of this guide you will fetch historical and time-series prices for MYSO-24k from Metals-API, convert the default per–troy-ounce quotes to per gram, and parse the data in Python for 2026 backtests and analytics.
What you’ll build: clean MYSO-24k history for 2026, per gram
We’ll use two endpoints:
- Historical date endpoint: query a single day to validate calculations and point-in-time checks.
- Time-series endpoint: pull a date range (e.g., a month or quarter in 2026) to feed your chart or quant pipeline.
Metals-API responses are by default returned with base USD and quoted per troy ounce. We’ll convert to per gram (1 troy ounce = 31.1034768 grams) in code. If you’re validating the MYSO-24k symbol or want to add other regional or carat-based codes later, check the full list at Metals-API Supported Symbols.
Why historical MYSO-24k data matters
Developers use Mysore 24k gold history to:
- Backtest pricing logic and hedging rules against historical moves in 2026.
- Fill gaps in charts after downtime or onboarding a new data source.
- Reconcile invoices and orders that reference a specific MYSO-24k daily fix.
Gold (XAU) data powers many digital products today, from fintech quote widgets to ERP repricing. Regional and carat-specific symbols like MYSO-24k help bridge the last mile to the customer’s mental model—your system can reflect the spot reference that buyers in Mysore expect while still using a robust, developer-first API. See capabilities and constraints in the Metals-API Documentation.
Endpoint 1: Single-day historical price for MYSO-24k
Use the “historical rates” format by appending the date (YYYY-MM-DD) to the API path. This is best for point-in-time validation and reconciliations.
Request (curl)
curl -G "https://metals-api.com/api/2026-01-15" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "symbols=MYSO-24k"
The example uses a 2026 date. Replace with the exact date you need. Values shown below are illustrative and minimal to demonstrate structure.
Illustrative JSON response
{
"success": true,
"timestamp": 1768435200,
"base": "USD",
"date": "2026-01-15",
"rates": {
"MYSO-24k": 0.000480
},
"unit": "per troy ounce"
}
Fields you’ll actually use
- success: Boolean indicating the request result.
- timestamp: UNIX seconds for the rate snapshot (treat as UTC).
- date: The ISO date of the historical quote.
- base: Base currency (default is USD).
- rates.MYSO-24k: Units of MYSO-24k per 1 USD when base is USD and unit is per troy ounce.
- unit: Pricing unit context (“per troy ounce” by default).
Per-gram conversion: divide the per–troy-ounce quote by 31.1034768. For example, per_gram = rate_per_oz / 31.1034768.
Endpoint 2: Time-series price history for a 2026 date range
Use the time-series endpoint to pull a continuous range for MYSO-24k—ideal for backtests, charts, and batch backfills. The permissible date range per request depends on your plan; see limits in the endpoint docs.
Request (curl)
curl -G "https://metals-api.com/api/timeseries" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "start_date=2026-01-01" \
--data-urlencode "end_date=2026-01-31" \
--data-urlencode "symbols=MYSO-24k"
Illustrative JSON response
{
"success": true,
"timeseries": true,
"start_date": "2026-01-01",
"end_date": "2026-01-31",
"base": "USD",
"rates": {
"2026-01-02": { "MYSO-24k": 0.000478 },
"2026-01-03": { "MYSO-24k": 0.000478 },
"2026-01-06": { "MYSO-24k": 0.000481 }
},
"unit": "per troy ounce"
}
Notes:
- Days without new trades (e.g., weekends/holidays) may repeat the last available business day rate. Design your ingestion to accept missing calendar dates or duplicated values.
- The “rates” object maps ISO date strings to a nested object containing the symbol and rate.
Python example: list of (date, per_gram) pairs for MYSO-24k
import os
import requests
from datetime import datetime
from decimal import Decimal, ROUND_HALF_UP
API_KEY = os.getenv("METALS_API_KEY", "YOUR_API_KEY")
BASE_URL = "https://metals-api.com/api"
TROY_OUNCE_TO_GRAMS = Decimal("31.1034768")
def fetch_timeseries(symbol: str, start_date: str, end_date: str):
url = f"{BASE_URL}/timeseries"
params = {
"access_key": API_KEY,
"start_date": start_date,
"end_date": end_date,
"symbols": symbol,
}
r = requests.get(url, params=params, timeout=30)
r.raise_for_status()
data = r.json()
if not data.get("success"):
raise RuntimeError(f"API error: {data}")
return data
def to_per_gram_list(data: dict, symbol: str):
# Returns list of tuples: (date_str, Decimal per_gram)
out = []
rates_by_day = data.get("rates", {})
for date_str, payload in sorted(rates_by_day.items()):
per_oz = Decimal(str(payload.get(symbol)))
per_gram = (per_oz / TROY_OUNCE_TO_GRAMS).quantize(Decimal("0.00000001"), rounding=ROUND_HALF_UP)
out.append((date_str, per_gram))
return out
if __name__ == "__main__":
symbol = "MYSO-24k"
data = fetch_timeseries(symbol, "2026-01-01", "2026-01-31")
series = to_per_gram_list(data, symbol)
for d, v in series[:5]:
print(d, v)
This script:
- Calls the time-series endpoint with MYSO-24k for January 2026.
- Reads data.rates[date]["MYSO-24k"] as per–troy-ounce values.
- Converts to per gram by dividing by 31.1034768 and rounds to 8 decimal places.
- Emits a list of (date, value) pairs ready to plot or store.
Interpreting the JSON and units correctly
By default, Metals-API delivers metals relative to USD and in “per troy ounce” units, expressed as a rate such as rates["MYSO-24k"]. To present per-gram pricing:
- Read the exact symbol you requested: "MYSO-24k".
- Take the per–troy-ounce value.
- Divide by 31.1034768 to get per gram.
If you maintain inventory or invoices in grams, store only the per-gram result to avoid repeated conversions downstream. If you model in ounces or kilograms, centralize your unit conversions in a utility module to prevent rounding drift.
Practical details that save time
Base currency and conversions
The base field indicates the currency context (default USD). If you need per-gram prices in another currency (e.g., INR), you can convert afterward using your internal FX curves, or use Metals-API’s conversion capabilities documented in the conversion section. Keep the unit transformation (ounce to gram) separate from currency conversion to simplify testing.
Timestamps and timezone
- timestamp is a UNIX epoch in seconds. Treat it as UTC.
- date is the ISO calendar date for daily fixes. Prefer date for daily bars; keep timestamp for audit trails.
Weekends and market closures
- Precious metals trade 24x5; weekends and some holidays produce no new settlements.
- Time-series responses may repeat the last available business day across non-trading days. Your code should not assume every calendar date has a unique rate.
- For charting, either skip non-business days or forward-fill with clear labeling.
Maximum range per request
- The time-series endpoint supports ranges that vary by plan. If your range is too large, split it into monthly or weekly chunks.
- Check allowed date spans and historical depth in the Time-Series endpoint docs.
Caching and backfills
- Historical endpoints are immutable for past dates; cache results by date and symbol to avoid re-requests.
- For first-time backfills (e.g., Jan–Dec 2026), batch by month and persist raw JSON alongside your normalized per-gram series for reproducibility.
- Store the unit and base fields with each batch so future consumers understand the context.
Data validation workflow
- Run the single-day historical endpoint first for a spot check on a known 2026 date.
- Verify your ounce-to-gram conversion matches a trusted reference.
- Then pull the time-series and diff the first and last days against single-day calls to ensure consistency.
Putting it together: historical + timeseries for 2026
Step 1: Quick single-day check
curl -G "https://metals-api.com/api/2026-07-10" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "symbols=MYSO-24k"
Compute per_gram = rates["MYSO-24k"] / 31.1034768. Store this as your canonical figure for that date.
Step 2: Pull a month for charting
curl -G "https://metals-api.com/api/timeseries" \
--data-urlencode "access_key=YOUR_API_KEY" \
--data-urlencode "start_date=2026-07-01" \
--data-urlencode "end_date=2026-07-31" \
--data-urlencode "symbols=MYSO-24k"
Ingest the payload into a (date, per_gram) array using the Python helper shown earlier. Forward-fill or gap-handle as needed.
Error handling and edge cases
- Check success; if false, inspect the payload for error details and implement retry or fallback logic accordingly.
- Gracefully handle missing dates: not every calendar day will be present in rates.
- Use Decimal or integers of micro-units when aggregating to avoid floating-point drift.
- Log the unit and base fields—downstream users often need to confirm whether numbers are per ounce or per gram, and whether they’re USD-based.
MYSO-24k symbol notes
Always confirm symbols before production use. Visit the Metals-API Supported Symbols page to verify that “MYSO-24k” is available on your plan and spelled exactly as required. If your business logic maps multiple product SKUs to this symbol, centralize the mapping in configuration so changing symbols later doesn’t require a code deploy.
Security, performance, and cost control
- Store your API key in secure config or environment variables; never hardcode in client-side code.
- Batch historical pulls to respect plan limits and reduce latency variance.
- Cache and reuse daily results; a single daily value may be accessed by many users and services.
Additional resources
- API overview and examples: Metals-API Documentation
- Complete list of tradable symbols: Metals-API Supported Symbols
- Main site and signup: Metals-API Website
- Gold market context: LBMA Prices and Data
- Gold research and demand trends: World Gold Council
FAQ
Does Metals-API return prices per gram?
By default, the unit is “per troy ounce.” Convert to per gram by dividing by 31.1034768. Always read the unit field in the response before transforming.
Can I request MYSO-24k directly in INR?
The base is USD by default. You can convert to INR in your system or use conversion features described in the documentation. Keep unit conversion (oz→g) separate from currency conversion for clarity.
Why are there repeated values on weekends?
Non-trading days may reuse the last available business day rate. Your time-series ingestion should not assume unique values per calendar date.
How big a date range can I query at once?
It depends on your plan. If you hit a limit, split by month or week. Refer to the time-series notes in the Metals-API Documentation.
How do I verify the MYSO-24k symbol?
Check the Supported Symbols list and test a single-day historical call to confirm availability before building a full backfill.
Get started
Sign up for an API key and start pulling Mysore 24k gold per-gram history today. Visit the Metals-API Website, then open the Documentation to copy the historical and time-series requests shown here. Get your free API key and ship your 2026 backtests in minutes.