Get Kanpur Gold 24k (KANP-24k) - Per Gram Closing Price Historical Prices using this API
If you run a jewelry storefront in Kanpur, build a bullion trading algo, or maintain a treasury dashboard for a manufacturing ERP, you likely need Kanpur Gold 24k (KANP-24k) per-gram closing prices—historically and reliably. This guide shows how to retrieve KANP-24k historical closing prices using Metals-API, transform the results into per-gram values, and integrate them into pricing, analytics, and risk workflows. We will focus on two endpoints that deliver daily close data at scale: Open/High/Low/Close (OHLC) for precise daily snapshots and Time-series for backfilling ranges. We’ll also discuss carat-specific data considerations relevant to 24k, unit conversion (troy ounces to grams), time zones and weekends, and practical engineering patterns like caching and forward-filling.
What “KANP-24k per gram closing price” means in practice
“KANP-24k” designates a Kanpur-referenced pure gold (24 karat) quotation. Metals-API standardizes precious metals pricing using well-known symbols. Always verify symbol availability and exact codes against the live directory at Metals-API Supported Symbols. In this article, we will query KANP-24k for:
- Daily close values for a single date (to validate today’s or a specific day’s price), and
- Continuous daily close values across a historical range (to backfill charts or compute returns).
Metals-API quotes are, by default, relative to USD and measured per troy ounce. To get a per-gram closing price, we will convert the result using the fixed equivalence: 1 troy ounce = 31.1034768 grams. If you need INR or another local currency for invoicing, you can combine metals data with currency conversion (details in the documentation) or downstream convert with your FX source. This guide keeps currency in USD for reproducibility and then demonstrates the per-gram derivation.
Key endpoints to retrieve KANP-24k daily close data
We will use two Metals-API endpoints that are most relevant to this task:
- Open/High/Low/Close (OHLC) endpoint: returns the daily open, high, low, and close for a specific date—ideal for the canonical “closing price.”
- Time-series endpoint: returns daily data over a date range—best for chart backfills and historical studies.
Metals-API is a modern JSON REST API designed for precision, throughput, and integration simplicity. For full parameter coverage, authentication, and advanced usage, refer to the Metals-API Documentation. For a free API key and plan details, visit the Metals-API Website.
How to interpret units and rates correctly
- Base currency: Responses are by default relative to USD. The “base” field shows the currency of account.
- Unit: The “unit” field indicates the commodity unit (for gold, “per troy ounce”).
- Rate orientation: A metals rate in Metals-API responses often expresses “how many units of metal one USD buys,” i.e., troy ounces per USD. To obtain USD per troy ounce, invert the value.
- Per gram conversion: USD_per_gram = (USD_per_troy_ounce) / 31.1034768.
Quick start: get an API key and verify the symbol
- Sign up to obtain your access_key: Get a free Metals-API key.
- Confirm the presence and exact casing of KANP-24k: Browse the Supported Symbols.
- Keep your key secure and do not expose it in client-side code for production apps. Use server-side calls or a secure proxy.
Endpoint 1: OHLC — the definitive daily close for KANP-24k
Use the OHLC endpoint to retrieve the open, high, low, and close for a specific date. This is the most direct way to obtain “the closing price” and derive a per-gram value without ambiguity.
Purpose
Get the four canonical daily fields—open, high, low, close—for KANP-24k, in a consistent base currency and unit. Use the close field to compute the per-gram closing price.
HTTP pattern
The OHLC endpoint follows a dated-path style:
- Path: /open-high-low-close/YYYY-MM-DD
- Query parameters: access_key, symbols
Notes:
- The date is in ISO format (YYYY-MM-DD).
- By default, the base is USD. If you need a different base, consult the documentation.
Example cURL request for a single day
curl -s "https://metals-api.com/api/open-high-low-close/2026-09-23?access_key=YOUR_ACCESS_KEY&symbols=KANP-24k"
Illustrative JSON response
{
"success": true,
"timestamp": 1790122535,
"base": "USD",
"date": "2026-09-23",
"rates": {
"KANP-24k": {
"open": 0.000486,
"high": 0.000489,
"low": 0.000482,
"close": 0.000484
}
},
"unit": "per troy ounce"
}
Field-by-field guide
- success: Boolean indicating the request status.
- timestamp: Unix epoch seconds for the data snapshot. Treat it as UTC.
- base: The accounting currency. Default is USD.
- date: ISO date for the OHLC values.
- rates: Object keyed by the requested symbol(s). For KANP-24k:
- open, high, low, close: Values expressed as “troy ounces per USD.”
- unit: The commodity unit. For gold, usually “per troy ounce.”
Converting the close to USD per gram
Let r_close be the close value in ounces per USD from the response.
- USD per troy ounce = 1 / r_close
- USD per gram = (1 / r_close) / 31.1034768
Example calculation using the sample payload above:
- r_close = 0.000484 oz/USD → USD/oz = 1 / 0.000484 ≈ 2066.116
- USD/gram ≈ 2066.116 / 31.1034768 ≈ 66.44 USD/g
If you need INR/gram, multiply USD/gram by your USD→INR rate for the same date. You may source FX from Metals-API or your preferred currency feed. If you transform downstream, document rounding rules and effective times, especially across weekends or local holidays.
JavaScript example: fetch OHLC and compute per-gram close
// Minimal illustrative example; use server-side calls for production to protect your key.
async function fetchKanpurClosePerGram(dateIso) {
const url = `https://metals-api.com/api/open-high-low-close/${dateIso}?access_key=YOUR_ACCESS_KEY&symbols=KANP-24k`;
const res = await fetch(url);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
if (!data.success) throw new Error("API returned success=false");
const r = data.rates["KANP-24k"].close; // ounces per USD
const usdPerOunce = 1 / r;
const usdPerGram = usdPerOunce / 31.1034768;
return {
date: data.date,
usdPerGram: Number(usdPerGram.toFixed(4)),
base: data.base,
unit: "per gram",
timestamp: data.timestamp
};
}
// Example usage:
fetchKanpurClosePerGram("2026-09-23")
.then(console.log)
.catch(console.error);
Usage scenarios
- Retail repricing: Pull yesterday’s KANP-24k close at midnight IST and update SKU base prices with a fixed per-gram markup.
- Risk and P&L: Use the close as end-of-day for VaR, returns, and hedging performance.
- Settlement: Lock invoices using the published close to remove intraday volatility from billing.
Common pitfalls and tips for OHLC
- Weekend/holiday behavior: Expect unchanged values or no market movement on weekends. Some providers keep a Friday close through Sunday. Use business calendars in your pipeline.
- Time zone alignment: Treat the timestamp as UTC. If you must align to IST, convert consistently and document your end-of-day cutoff.
- Precision: Always carry full precision through calculations. Round only at display time. Use decimal libraries if required.
- Caching: The OHLC for a past date is immutable. Cache aggressively in your DB or CDN to reduce request counts.
Endpoint 2: Time-series — backfill historical per-gram closes
The Time-series endpoint returns daily values across a date range. For KANP-24k, this is ideal for powering charts, backtests, and longer-window analytics. You will convert each day’s rate into a per-gram close similarly to the OHLC method—using the inversion and then dividing by 31.1034768.
Purpose
Pull daily KANP-24k rates over a time interval so you can compute per-gram closes and aggregate series analytics (moving averages, drawdowns, volatility, etc.).
HTTP pattern
- Path: /timeseries
- Query parameters: access_key, start_date, end_date, symbols
Example cURL request for a daily range
curl -s "https://metals-api.com/api/timeseries?access_key=YOUR_ACCESS_KEY&start_date=2026-09-16&end_date=2026-09-23&symbols=KANP-24k"
Illustrative JSON response
{
"success": true,
"timeseries": true,
"start_date": "2026-09-16",
"end_date": "2026-09-23",
"base": "USD",
"rates": {
"2026-09-16": { "KANP-24k": 0.000486 },
"2026-09-18": { "KANP-24k": 0.000485 },
"2026-09-23": { "KANP-24k": 0.000484 }
},
"unit": "per troy ounce"
}
Understanding the time-series payload
- timeseries: Boolean confirming this is a time-series response.
- start_date, end_date: Echo of your query boundaries.
- rates: A date-keyed object. Each date maps to a symbol-object with the KANP-24k rate for that day.
- Gaps: If weekends or holidays exist, you might see fewer entries than calendar days.
Per-gram closing price series
For each date D with rate r_D (oz per USD):
- USD per troy ounce at D = 1 / r_D
- USD per gram at D = (1 / r_D) / 31.1034768
Store the results in your database keyed by date and normalized to UTC. If KANP-24k is your canonical symbol, index your tables on (date, symbol) with numeric columns for usd_per_gram and any currency transforms you need.
Best practices for historical pulls
- Batching: Use a single Time-series request for contiguous ranges rather than many single-day calls.
- Resilience: If you rely on fresh data daily, build a retry schedule (e.g., 3 attempts over 15 minutes) for transient network errors.
- Forward-fill or gap-aware: For chart continuity, forward-fill weekends with Friday’s close or display gaps explicitly—decide per product requirements.
- Versioning: Stamp your data with the retrieval timestamp and API version for reproducibility.
Working with 24k data and carat context
“24k” denotes pure gold. Metals-API includes a Carat endpoint that supports Gold rates by carat. When your catalog spans 22k/18k/14k alongside 24k, the Carat endpoint helps automate purity scaling with consistent metadata. Because this article focuses on KANP-24k specifically, we rely on the KANP-24k symbol for direct 24k quotations. For broader carat usage patterns, consult the Metals-API Documentation for parameterization and response fields.
Putting it together: KANP-24k in real applications
1) E-commerce pricing engine (Kanpur 24k jewelry)
- Daily job pulls OHLC for the latest business day.
- Compute USD/gram close, then convert to INR/gram if your store’s base is INR.
- Apply SKU-level making charges, wastage, and markup rules.
- Cache the result and publish across your storefront and PIM.
2) Trading and hedging dashboards
- Use the Time-series endpoint to backfill KANP-24k closes for a lookback window (e.g., 1–3 years as your plan allows).
- Compute moving averages, realized volatility, and drawdown metrics per gram to align with inventory units.
- Overlay FX if your P&L is in INR, then evaluate hedge ratios against futures/OTC exposures.
3) ERP and treasury cost feeds
- Standardize on per-gram close for BOM costing and production planning.
- Record a single authoritative EOD price per business day for auditability.
- Expose the canonical series via internal API for reconciliation and analytics.
Innovation, analytics, and digital transformation with KANP-24k
Digitizing precious metals workflows goes far beyond pulling a single price. Once KANP-24k is standardized in your data platform, you can:
- Run market insights on demand: compute price momentum, rolling correlations, and price elasticity of your SKUs.
- Accelerate price discovery: unify metals and FX data for real-time recalibration of bids and offers in RFQ tools.
- Experiment with digital asset solutions: design tokenized gold products or loyalty points pegged to per-gram value, using reliable KANP-24k closes for NAV and redemption.
- Integrate with modern stacks: stream daily closes into your data warehouse/lakehouse, blending with sales, inventory, and supply chain signals for end-to-end profitability analytics.
Architecture and performance considerations
- Minimize requests:
- Use Time-series to backfill large ranges.
- Cache immutable historical days in your DB and CDN.
- Normalize units:
- Persist both ounces-per-USD (raw) and USD-per-gram (derived) for flexibility.
- Document rounding rules (e.g., display to 2 decimals for INR/gram; 4 for USD/gram in internal analytics).
- Handle market closures:
- Expect unchanged values on weekends.
- Drive schedules using a trading calendar to preempt “no update” confusion.
- Retry and backoff:
- Implement exponential backoff on transient network/5xx responses.
- Fall back to cached values for non-critical views.
- Security:
- Keep your access_key server-side and out of client bundles.
- Use HTTPS-only and rotate keys if leaked.
Data validation and quality controls
- Bounds checks: Reject per-gram values far outside historical quantiles to catch input or conversion mistakes.
- Monotonic sanity: Overnight close-to-close moves should typically fall within known volatility bands; flag outliers for review.
- Unit audit: Keep explicit unit fields (oz_per_usd, usd_per_gram) in your models to prevent silent unit drift.
- FX alignment: If converting to INR, ensure the FX timestamp aligns with the metals close to avoid cross-day mismatches.
Practical developer workflow
- Obtain your API key from the Metals-API Website.
- Verify the symbol in Metals-API Supported Symbols (KANP-24k).
- For daily operations:
- Call OHLC for the target date to get the canonical close.
- Convert to per gram, cache, and persist.
- For historical backfills:
- Call Time-series for your date range.
- Compute per-gram series and store with metadata (timestamp, base, unit).
- Implement monitoring and alerting for failures and data anomalies.
Additional notes for Kanpur-centric operations
- Local market hours: Your commercial “close” in Kanpur may align differently than UTC day boundaries. Translate UTC timestamps to IST for reporting and operational cutoffs.
- Holidays: Combine Metals-API with local holiday calendars to schedule jobs and pre-warn stakeholders about stagnant values.
- Downstream controls: If your POS or ERP expects INR/gram, do the FX conversion consistently and document the rate source and timestamp.
Comparing the two endpoints for this use case
| Endpoint | Best for | Pros | Considerations |
|---|---|---|---|
| OHLC (by date) | Single-day canonical close | Explicit close field; precise snapshot | One-day at a time; use Time-series for ranges |
| Time-series | Historical ranges and backfills | Minimizes requests; range-based | Returns single value per day; derive close logic per documentation |
Troubleshooting checklist
- Symbol not found: Re-check the exact code in Supported Symbols.
- Unexpected zero or null values: Confirm market closure dates and ensure you are querying valid business days.
- Wrong units displayed: Did you invert ounces-per-USD to USD-per-ounce before dividing by 31.1034768?
- Inconsistent FX conversion: Align FX and metals timestamps or keep your canonical store in USD/gram and convert on display.
- Rate limiting: Cache immutable historical data; batch with Time-series to reduce call volume. For plan capabilities and request cadence, see the documentation.
Security and compliance considerations
- API key hygiene: Store keys in secrets managers; rotate on schedule or upon suspicion of leakage.
- Access control: Expose an internal API for downstream teams to shield the raw key and enforce quotas.
- Auditability: Persist request metadata (timestamp, endpoint, parameters) and raw JSON for critical financial processes.
- Transport: Enforce TLS. Validate hostnames and certs in backends.
Why Metals-API fits KANP-24k historical pricing
Metals-API balances precision, breadth, and developer ergonomics. Its OHLC and Time-series endpoints provide exactly what Kanpur-focused operations need: canonical daily closes and efficient historical backfills, delivered in clean JSON with explicit units. Combined with robust documentation and symbol listings, it streamlines building reliable pipelines for product pricing, analytics, and hedging.
Explore the full capabilities and authentication patterns in the Metals-API Documentation, and confirm the latest symbol coverage at Metals-API Supported Symbols. Ready to implement? Get your free API key now and start integrating KANP-24k into your stack today.
Appendix: Additional example payloads
Another OHLC example for a different date
{
"success": true,
"timestamp": 1790036135,
"base": "USD",
"date": "2026-09-22",
"rates": {
"KANP-24k": {
"open": 0.000487,
"high": 0.000490,
"low": 0.000483,
"close": 0.000485
}
},
"unit": "per troy ounce"
}
Time-series with weekday gaps (weekend omitted)
{
"success": true,
"timeseries": true,
"start_date": "2026-09-16",
"end_date": "2026-09-23",
"base": "USD",
"rates": {
"2026-09-16": { "KANP-24k": 0.000486 },
"2026-09-17": { "KANP-24k": 0.000486 },
"2026-09-18": { "KANP-24k": 0.000485 },
"2026-09-23": { "KANP-24k": 0.000484 }
},
"unit": "per troy ounce"
}
Further reading and related resources
- Full Metals-API documentation for parameters, authentication, and endpoint behaviors.
- Symbols directory to verify KANP-24k availability and case sensitivity.
- Main website to obtain your access key and review plans.
- BIS statistics for macroeconomic context when correlating gold with rates and FX.
- Reserve Bank of India for domestic monetary context when modeling INR impacts.
Conclusion
To get Kanpur Gold 24k (KANP-24k) per-gram closing prices historically, use Metals-API’s OHLC endpoint for precise daily closes and the Time-series endpoint for efficient backfills. Always handle unit conversion carefully: invert ounces-per-USD to USD-per-ounce, then divide by 31.1034768 to get USD-per-gram. Apply FX conversion consistently if you require INR/gram, and standardize on UTC timestamps with clear rounding policies. With sensible caching, retry logic, and validation, you can deploy a resilient, auditable pricing and analytics pipeline for retail catalogs, trading dashboards, or ERP cost centers. Get started at the Metals-API Website and consult the Metals-API Documentation for full details.
FAQ
- Does Metals-API return per-gram values directly?
Responses are typically per troy ounce relative to the base currency (default USD). Convert to per gram by dividing USD-per-oz by 31.1034768. - How do I ensure I’m using the correct symbol?
Always confirm in the live directory: Supported Symbols. Use the exact code (KANP-24k) and case. - Which endpoint should I choose for a chart backfill?
Use the Time-series endpoint for ranges; it’s more efficient than calling single-day endpoints repeatedly. - How do weekends affect closes?
Expect fewer entries across weekends/holidays. Many systems forward-fill Friday’s close through Sunday for display; choose an approach consistent with your product. - Can I get INR directly?
The base is USD by default. You can combine metals data with FX conversion for INR. Align timestamps to avoid mismatches. - What about security?
Keep your access_key server-side, use HTTPS, rotate keys periodically, and log request metadata for audits.