Get LBMA Platinum Pm (LBXPTPM) - Per Troy Ounce prices using this API with a Python example
Need to display LBMA Platinum Pm (LBXPTPM) prices per troy ounce inside a trading dashboard, an ERP pricing engine, or a research notebook—reliably and in real time? This guide shows how to pull platinum benchmarks and live platinum (XPT) rates with the Metals-API, compute USD-per-oz values correctly, and integrate the data into your Python workflow. Along the way, you’ll see complete REST requests, a runnable Python example, and best practices for units, timestamps, caching, weekends/market closures, and production-ready error handling—all centered on LBMA Platinum Pm and platinum (XPT) data.
Why LBMA Platinum Pm per troy ounce matters for developers
LBMA Platinum Pm is a widely referenced afternoon benchmark for platinum pricing. If you’re building pricing, risk, or analytics features, accessing LBMA Platinum Pm (often stylized as LBXPTPM in symbol lists) helps you:
- Mark products and contracts to a recognized benchmark (jewelry, catalysts, manufacturing inputs).
- Standardize historical analysis and backtests against a stable fixing reference.
- Synchronize with counterparty or supplier price calculations that reference LBMA PM fixes.
- Control unit consistency across your system in “per troy ounce”—the market-standard unit for precious metals.
With Metals-API Website, you can query real-time and historical platinum data (XPT), benchmark-oriented series like LBMA fixes where supported, and analytics endpoints such as time series, OHLC, bid/ask, and fluctuation—all returned as compact JSON optimized for developer consumption.
Quick orientation: symbols, units, and base currency
Before you write code, align on three fundamentals that will make or break your integration:
- Symbols: Platinum is “XPT” in Metals-API. LBMA Platinum Pm may be available under a dedicated code (often represented as LBXPTPM in symbol lists). Always verify the exact code first using the up-to-date symbols catalog at Metals-API Supported Symbols.
- Units: Metals-API precious metals rates are returned “per troy ounce.” Troy ounces differ from avoirdupois ounces. 1 troy ounce ≈ 31.1034768 grams. Always propagate this unit everywhere in your UI and calculations.
- Base currency: By default, the API returns rates relative to USD as the base. That means rates for metals are expressed as “number of troy ounces per USD,” not “USD per ounce.” To get USD/oz, invert the rate: price_usd_per_oz = 1 / rate.
Verifying symbol availability
Because exchange listings evolve, use the symbols endpoint or symbols documentation to confirm availability of LBMA Platinum Pm (LBXPTPM). If the LBMA-specific symbol is not present in your plan or the catalog, you can still work with platinum (XPT) live rates, OHLC, intraday, time series, and historical endpoints and document your benchmark substitution strategy for downstream stakeholders.
| Concept | Typical Symbol | Notes |
|---|---|---|
| Platinum (spot/reference) | XPT | General platinum rate; “per troy ounce,” base USD by default. |
| LBMA Platinum Pm (benchmark) | LBXPTPM (verify) | Check availability in your plan and the catalog: Supported Symbols. |
Platinum’s role in clean tech and digital transformation
Platinum’s utility goes far beyond jewelry. In green technology and sustainable innovation, platinum’s catalytic properties are mission-critical:
- Hydrogen economy: Platinum is used in proton-exchange membrane (PEM) electrolyzers and fuel cells, powering mobility and stationary energy systems in clean energy solutions.
- Automotive emissions control: Platinum-based catalysts help reduce NOx, CO, and hydrocarbons in internal combustion engines and are part of transition strategies.
- Smart manufacturing: Platinum’s stability supports sensors and high-temperature process controls in Industry 4.0, linking material supply with digital twins and predictive maintenance.
For digital platforms integrating sustainability KPIs, Metals-API enables precise platinum pricing streams, allowing product teams to connect materials cost dynamics with the economic metrics of green technology deployments.
End-to-end workflow: from API key to USD/oz LBMA Platinum Pm display
Here is the practical path to integrate LBMA Platinum Pm and platinum (XPT):
- Get your API key at the Metals-API Website. There is a free option—ideal for prototyping.
- Confirm the precise symbol for LBMA Platinum Pm in the Supported Symbols catalog.
- Prototype with general platinum (XPT) using the Latest, OHLC, and Time-series endpoints.
- Compute USD per troy ounce correctly (invert the rate if base is USD).
- Implement caching, fallback logic for weekends/market holidays, and error handling.
- Roll into your UI/alerts/pipelines with monitoring on latency and data freshness.
First request: latest platinum (XPT) per troy ounce using curl
Use the Latest Rates endpoint to get current platinum data and then compute USD/oz if needed. Replace YOUR_API_KEY with your actual key.
curl "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&base=USD&symbols=XPT"
Example JSON (structure representative of the Metals-API response format):
{
"success": true,
"timestamp": 1789605480,
"base": "USD",
"date": "2026-09-17",
"rates": {
"XPT": 0.000912
},
"unit": "per troy ounce"
}
How to read this:
- base: USD. Rates are quoted as ounces per 1 USD for metals.
- rates.XPT: 0.000912 means 1 USD buys 0.000912 troy ounces of platinum.
- Compute USD per troy ounce: 1 / 0.000912 ≈ 1096.49 USD/oz (do this calculation in your app; numbers shown here are for illustration from the example format).
- timestamp/date: Use to determine staleness and display “as of” times. Timestamps are UNIX seconds.
Python example: fetch XPT and compute USD per troy ounce
The snippet below shows a minimal pattern to fetch platinum data and return USD/oz. Add retries, timeouts, and caching in production.
import json
import math
import os
import time
import urllib.request
API_KEY = os.environ.get("METALS_API_KEY", "YOUR_API_KEY")
BASE_URL = "https://metals-api.com/api"
def get_latest_xpt_usd_per_oz():
url = f"{BASE_URL}/latest?access_key={API_KEY}&base=USD&symbols=XPT"
with urllib.request.urlopen(url, timeout=10) as resp:
data = json.load(resp)
if not data.get("success", False):
raise RuntimeError(f"API error: {data}")
rate = data["rates"]["XPT"] # ounces per 1 USD
usd_per_oz = 1.0 / rate if rate > 0 else float("nan")
as_of = data.get("timestamp")
unit = data.get("unit")
return {
"usd_per_oz": usd_per_oz,
"timestamp": as_of,
"unit": unit,
"raw_rate": rate
}
if __name__ == "__main__":
quote = get_latest_xpt_usd_per_oz()
print(quote)
Key points:
- rates.XPT is “per troy ounce” with base USD; invert it for USD/oz.
- timestamp is a UNIX epoch (UTC). Convert to your local timezone in the UI, but keep UTC internally to avoid DST issues.
- Always surface the “unit” string (“per troy ounce”) in logs/telemetry so you catch unexpected changes.
Working with LBMA Platinum Pm specifically
If your plan includes LBMA Platinum Pm and the symbol appears in the catalog (often displayed as LBXPTPM), you can pass it via the same Latest or Historical endpoints. If the catalog shows a different code for the afternoon fix, use that exact symbol. If LBMA-specific symbols are not available in your subscription or for your use case, use XPT with OHLC or Historical Time-series to approximate day’s PM levels, documenting the methodology.
To confirm availability and naming, consult the catalog: Metals-API Supported Symbols. If you need more details on parameters and endpoints, see the Metals-API Documentation.
Historical rates for LBMA analysis and backtesting
You will likely need to backfill historical platinum pricing—either the LBMA PM series when available or the general XPT series. Metals-API returns historical data using a date-based endpoint. Example response format:
{
"success": true,
"timestamp": 1789519080,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XPT": 0.000915
},
"unit": "per troy ounce"
}
Implementation guidance:
- Convert the “per USD” rate to USD/oz by inversion for consistent charting and analytics.
- If you need end-of-day consolidation, use the OHLC endpoint for a richer view (open, high, low, close).
- Handle weekends and market closures: some days may not update. Consider carrying forward the last available close or marking gaps distinctly in charts.
Time-series for LBMA PM windows, rolling stats, and anomaly detection
The Time-series endpoint delivers daily values in a date range. You can compute rolling averages, volatilities, and compare AM vs PM benchmarks when both are available. Example format:
{
"success": true,
"timeseries": true,
"start_date": "2026-09-10",
"end_date": "2026-09-17",
"base": "USD",
"rates": {
"2026-09-10": {
"XPT": 0.000915
},
"2026-09-12": {
"XPT": 0.000913
},
"2026-09-17": {
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Recommended techniques:
- Normalize to USD/oz on ingestion so that downstream pipelines don’t need to remember inversion rules.
- Compute rolling 5/20/60-day means on the normalized series and store analytics alongside raw data.
- For LBMA PM-specific workflows, partition your dataset by the timestamp associated with PM fixing updates, if provided in your plan, to align with internal batch processes.
Daily move tracking with Fluctuation
The Fluctuation endpoint summarizes changes between two dates—ideal for daily summaries or risk dashboards. Example format:
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-10",
"end_date": "2026-09-17",
"base": "USD",
"rates": {
"XPT": {
"start_rate": 0.000915,
"end_rate": 0.000912,
"change": -3.0e-6,
"change_pct": -0.33
}
},
"unit": "per troy ounce"
}
How to use:
- Invert start_rate and end_rate to get USD/oz if your UI expects that; compute change in USD terms accordingly.
- Display both absolute and percentage moves for clarity. Consider thresholds for alerting.
- When comparing LBMA PM benchmarks against spot (XPT), clearly label the series to avoid misinterpretation by users.
OHLC for trading views, candles, and backtesting fills
OHLC gives a structured daily summary—open, high, low, close—for each symbol. Example format:
{
"success": true,
"timestamp": 1789605480,
"base": "USD",
"date": "2026-09-17",
"rates": {
"XPT": {
"open": 0.000915,
"high": 0.000918,
"low": 0.00091,
"close": 0.000912
}
},
"unit": "per troy ounce"
}
Notes for integration:
- These are still expressed per troy ounce in ounces per USD. Invert each field for USD/oz candles.
- To chart, convert to your preferred timezone after ingestion; keep UTC in your data lake.
- For LBMA PM: if your plan provides LBMA OHLC-style data or day-level PM closes, use those directly; otherwise, XPT OHLC is a robust proxy for volatility visualization.
Bid/Ask for dealing spreads and execution simulations
If you run a pricing or quoting app, you’ll need bid/ask to simulate realistic execution. Example format:
{
"success": true,
"timestamp": 1789605480,
"base": "USD",
"date": "2026-09-17",
"rates": {
"XPT": {
"bid": 0.000911,
"ask": 0.000913,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
Implementation advice:
- Keep bid/ask in both native and USD/oz forms for flexibility. Invert each side independently to maintain correct spread in USD space.
- Use ask for buy-cost calculations and bid for sell proceeds.
- Store historical spreads to analyze liquidity conditions over time.
Convert endpoint: operational convenience for quoting
The Convert endpoint can help sanity-check calculations or provide quick conversions. Example format (USD to gold for illustration):
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789605480,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
For platinum, replace the “to” symbol with XPT (or your LBMA PM symbol if supported). This is helpful to return quantities in ounces directly for a given USD budget or invoice—particularly for ERP and e-commerce flows.
Intraday data for responsive trading tools
When your plan supports Intraday, fetch higher-frequency quotes for a single symbol. Use it for live dashboards, intraday alerts, and trade simulation. Ensure you:
- Throttle requests to your plan’s refresh cadence.
- Cache intraday snapshots for 15–60 seconds in the app tier to smooth traffic spikes.
- Persist quotes with timestamps so that post-trade audit can reconstruct decisions.
Lowest/Highest and analytics-driven guardrails
The lowest-highest/YYYY-MM-DD endpoint provides daily extremes. Use these to build guardrails—for example, rejecting outlier quotes outside of day’s observed band or flagging unexpected moves in anomaly detectors. Combine with OHLC to enrich analytics and support scenario planning.
Handling historical LME data
If you also cover industrial metals on LME, the historical-lme endpoint reaches back to 2008. For portfolios that cross-link platinum to industrial exposures (e.g., nickel in PGM alloys), consolidating series in one API simplifies governance. Verify symbol support for your metals in the catalog and plan coverage.
Authentication, error handling, and resilience
All endpoints require your API key via the access_key parameter. Best practices:
- Store keys in environment variables or a secret manager; never commit them to source control.
- Implement exponential backoff with jitter on 429/5xx responses.
- Create a structured error object in your app to normalize API errors (e.g., “success: false” responses) and transport-layer exceptions (timeouts, DNS issues).
- Surface failures with context: endpoint, parameters, timestamp, correlation ID.
Caching and performance optimization
For most apps, 60–120 second caching at your edge or application tier dramatically reduces latency and cost while improving reliability. Recommendations:
- Use an in-memory cache (e.g., Redis) keyed by endpoint+symbol+base+rounded-timestamp (e.g., minute) for the Latest endpoint.
- For historical endpoints, results are immutable; cache aggressively and even persist to your database for reproducibility.
- Version your normalization logic (e.g., inversion rules) in code and store both raw and normalized values.
Timestamps, timezones, and market closures
Metals-API timestamps are UNIX epoch seconds. Treat them as UTC in your backend. Notes:
- Weekends and holidays: Expect fewer updates; some series won’t change. Use last-known-good values with a visual indicator of staleness.
- LBMA PM fix: Align your batch windows with PM publication timing when explicitly working with LBMA PM benchmarks.
- Display: Convert UTC to the user’s local timezone at the presentation layer; never store as local time in persistence.
Data validation and sanitization
Protect downstream systems by validating:
- Structure: Confirm required fields (success, rates, base, unit) before use.
- Values: Check for non-positive rates; reject or quarantine negatives/zeros.
- Units: Assert “per troy ounce.” If your platform supports multiple units, tag and transform explicitly.
- Symbol whitelist: Enforce allowed symbols at ingress to prevent typos from contaminating datasets.
Security considerations
- Transport security: Always call HTTPS endpoints.
- Key management: Rotate keys periodically and on developer offboarding. Use least-privilege, separate prod and dev keys.
- Audit: Log request hashes and response checksums for forensic analysis, avoiding full-body sensitive logs in production.
- Third-party dependencies: Pin HTTP client versions and monitor for CVEs.
Architecture patterns for fintech and manufacturing
- Trading and quant research: Ingest Latest/Intraday to a Kafka topic, normalize to USD/oz, and store to a time-series DB (e.g., TimescaleDB). Compute OHLC and realized vol on the fly for dashboards.
- ERP and e-commerce: Schedule a job to fetch LBMA PM or XPT close, lock the day’s reference price, and update SKUs. Provide conversion endpoints to quote in customer currency if your stack does FX.
- Risk and portfolio analytics: Use Time-series and Fluctuation for VaR inputs and daily PnL explain. Merge LME historicals to test cross-metal hedges.
Real-world JSON examples you can reuse
Latest: multi-metal snapshot
{
"success": true,
"timestamp": 1789605480,
"base": "USD",
"date": "2026-09-17",
"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"
}
Use this when you want a single call for a dashboard covering multiple symbols. Still invert per metal to get USD/oz for display.
Historical single-day
{
"success": true,
"timestamp": 1789519080,
"base": "USD",
"date": "2026-09-16",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Time-series: rolling window
{
"success": true,
"timeseries": true,
"start_date": "2026-09-10",
"end_date": "2026-09-17",
"base": "USD",
"rates": {
"2026-09-10": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-09-12": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-09-17": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Fluctuation: move summary
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-10",
"end_date": "2026-09-17",
"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"
}
OHLC: day structure
{
"success": true,
"timestamp": 1789605480,
"base": "USD",
"date": "2026-09-17",
"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"
}
Bid/Ask: dealing context
{
"success": true,
"timestamp": 1789605480,
"base": "USD",
"date": "2026-09-17",
"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"
}
Pitfalls and troubleshooting
- Forgetting inversion: If your USD/oz looks too small by three orders of magnitude, you probably forgot to invert the rate.
- Unit drift: Mixing troy ounces and grams in the same report leads to silent errors. Always annotate units explicitly.
- Stale data: If timestamp hasn’t advanced, your cache may be too aggressive, or it’s a weekend/holiday. Show “as of” and use color cues.
- Symbol mismatch: LBMA PM naming can differ by provider. Verify actual symbol on the Supported Symbols page.
- Network timeouts: Set sane timeouts (e.g., 5–10 seconds) and implement retries with backoff. Fall back to last-known value on transient failures.
Advanced techniques for production systems
- Dual-source validation: If policy allows, periodically reconcile Metals-API results against a secondary source for critical reports. Document tolerance bands.
- Derived series: Compute LBMA-delta metrics comparing your LBMA PM benchmark to spot XPT to understand intraday drifts ahead of fixes.
- Event-driven updates: Trigger recalculations on timestamp changes rather than polling on a fixed timer to reduce cost and latency.
- Anomaly detection: Train a simple z-score model on inverted USD/oz to catch outliers; alert ops before users notice anomalies.
Where to go next
- Read the full Metals-API Documentation for endpoint coverage and parameter options.
- Explore the Supported Symbols list to confirm LBMA Platinum Pm availability and symbol code.
- Get your free API key at the Metals-API Website and start prototyping today.
Additional references for platinum markets
- LBMA Prices and Data for benchmark context and methodology.
- World Platinum Investment Council for supply/demand insights.
- CME Group Metals for futures context that complements spot and fix references.
Conclusion
Delivering LBMA Platinum Pm (LBXPTPM) and platinum (XPT) per troy ounce to your application is straightforward with the Metals-API: request, invert if base is USD, and then wire the data into charts, pricing, and analytics. With endpoints for Latest, Historical, Time-series, Fluctuation, OHLC, Bid/Ask, and more, you can support live dashboards, risk workflows, ERP pricing, and sustainability-linked cost tracking for green technology initiatives. Verify your benchmark symbol in the catalog, implement caching and robust error handling, and keep units and timestamps consistent across your stack. To get started, visit the Metals-API Website and grab a free API key, then consult the Metals-API Documentation for implementation details.
FAQ
Does Metals-API return USD/oz directly?
By default, metals are returned with base USD as “ounces per 1 USD.” Invert the rate to get USD per troy ounce.
What symbol should I use for LBMA Platinum Pm?
Check the current catalog at Supported Symbols. If LBMA PM is available, you will find the exact code there. If not, use XPT and document your methodology.
How should I handle weekends and holidays?
Expect fewer or no updates. Carry forward the last known value or mark data as stale. Display “as of” times using the UNIX timestamp from the API.
Can I get bid/ask for execution simulation?
Yes, use the Bid/Ask endpoint. Remember to invert bid and ask individually to get USD/oz.
What about grams or kilograms?
Metals-API returns “per troy ounce.” Convert units explicitly in your application: 1 troy ounce ≈ 31.1034768 grams. Always label the unit in outputs.
How do I improve performance and reduce costs?
Cache aggressively, especially historical and slow-moving endpoints. Batch symbols where it fits your UI. Implement retries with backoff and short timeouts.
Where can I find all parameters and examples?
See the Metals-API Documentation for endpoint-specific parameters, usage patterns, and additional examples.