How to Get Real-Time Aluminum Aug 2025 (ALQ25) - Per Metric Ton Prices with Metals-API in Python
Need real-time Aluminum Aug 2025 (ALQ25) prices per metric ton in Python? This step-by-step guide shows how to pull ALQ25 quotes from Metals-API, convert the default per–troy ounce unit to per–metric ton, and apply the data in trading, procurement, or pricing workflows. We’ll use just the endpoints you need, demonstrate a complete curl request and a concise Python example, and cover practical realities like base currency, timestamps, caching, weekends, and data integrity. If you don’t have access yet, start by getting a free API key at the Metals-API Website.
Why ALQ25 Matters and How Metals-API Helps
Aluminum is central to digital transformation in manufacturing, renewable energy, EVs, and aerospace. As supply chains modernize, developers and data teams need direct, programmable access to exchange-grade price signals. ALQ25 (Aluminum Aug 2025) is a forward-looking contract code used in many trading and planning scenarios, where precise, current pricing informs hedging, quotations, and budget scenarios. Metals-API abstracts the complexity with a simple REST API and a unified response format, meaning you can feed ALQ25 prices into dashboards, quant strategies, ERP cost models, or e-commerce pricing without building a custom market data stack.
Two quick notes up front:
- Base and unit: Metals-API returns rates relative to a base currency (USD by default) with the “unit” indicated in the payload. For metals, this is most commonly “per troy ounce.” We’ll show how to convert that to USD per metric ton.
- Symbol verification: Confirm ALQ25 support on the Metals-API Supported Symbols list. If you’re mapping from your venue’s codes, align symbol formats first to avoid 404/empty payloads.
What You’ll Build: ALQ25 Real-Time and Recent History in Python
We’ll do three things:
- Query the Latest endpoint for the current ALQ25 price.
- Convert the default “per troy ounce” unit to “per metric ton.”
- Use Time-Series and OHLC endpoints to backfill and validate intraday or daily analytics for ALQ25.
You can integrate the resulting price stream into any system: RFQ automation, dynamic offers, the cost model in your ERP, an alerting service, or a trading signal pipeline.
Get Ready: API Key, Symbols, and Minimal Setup
To call the API you need an access_key. If you’re new here, visit the Metals-API Website to create an account and get a free key. Keep the key secret—store it in environment variables or your vault of choice. For symbol details (tickers, units, metadata), go to the Metals-API Supported Symbols page and verify ALQ25.
Security tip
- Never hardcode keys in public repos.
- Use HTTPS only (Metals-API enforces TLS).
- If calling from the frontend, proxy through your backend to protect the key.
The Three Endpoints We’ll Use for ALQ25
We’ll focus on these:
- Latest: real-time snapshot for ALQ25.
- Time-Series: daily history for a defined period (e.g., past week/month) to validate trends or compute rolling metrics.
- OHLC: open/high/low/close on a given date for ALQ25 to support charting or signal verification.
For the rest of the platform features and limits, refer to the Metals-API Documentation.
Understanding Units: Per Troy Ounce vs Per Metric Ton
Metals-API commonly returns prices with unit “per troy ounce,” where each rate is the metal amount per 1 unit of base currency. For most pricing workflows in aluminum, you need USD per metric ton.
- 1 troy ounce = 31.1034768 grams
- 1 metric ton = 1,000,000 grams
- 1 metric ton = 1,000,000 / 31.1034768 = 32,150.7466 troy ounces
Conversion recipe:
- From the API, read rate = troy_ounces_per_USD (because base is USD).
- USD per troy ounce = 1 / rate.
- USD per metric ton = (USD per troy ounce) × 32,150.7466.
We’ll implement this safely in Python below.
Endpoint 1: Latest ALQ25 (Real-Time Snapshot)
Purpose
Get the most recent ALQ25 quote. Depending on your plan, updates are available on the schedule described in the documentation. Use it for live pricing, quoting, and alerts.
Request
Query the Latest endpoint for ALQ25 in USD (default base):
curl -s "https://metals-api.com/api/latest?access_key=YOUR_ACCESS_KEY&symbols=ALQ25&base=USD"
Example response (illustrative)
{
"success": true,
"timestamp": 1790209194,
"base": "USD",
"date": "2026-09-24",
"rates": {
"ALQ25": 0.000431
},
"unit": "per troy ounce"
}
Field meanings:
- success: Boolean request status.
- timestamp: Unix epoch seconds for this snapshot (UTC).
- base: Quoted against USD by default.
- date: ISO date of the quote (UTC calendar date).
- rates.ALQ25: troy ounces per 1 USD for Aluminum Aug 2025.
- unit: Unit for the metal leg (per troy ounce).
Using the response
- USD per troy ounce = 1 / 0.000431 ≈ 2320.65 USD/oz (illustrative only; always compute from the payload you get).
- USD per metric ton = USD/oz × 32,150.7466.
Note: The response format is stable. Always trust the provided unit field and base when converting.
Endpoint 2: Time-Series for ALQ25 (Daily History)
Purpose
Backfill daily history for ALQ25 between two dates to calculate moving averages, backtest strategies, or validate month-over-month cost drift in procurement models.
Request
Query daily rates between two dates (UTC):
curl -s "https://metals-api.com/api/timeseries?access_key=YOUR_ACCESS_KEY&start_date=2026-09-01&end_date=2026-09-24&base=USD&symbols=ALQ25"
Example response (illustrative)
{
"success": true,
"timeseries": true,
"start_date": "2026-09-01",
"end_date": "2026-09-24",
"base": "USD",
"rates": {
"2026-09-01": { "ALQ25": 0.000445 },
"2026-09-02": { "ALQ25": 0.000442 },
"2026-09-03": { "ALQ25": 0.000439 },
"2026-09-04": { "ALQ25": 0.000441 },
"2026-09-05": { "ALQ25": 0.000441 },
"2026-09-06": { "ALQ25": 0.000441 },
"2026-09-09": { "ALQ25": 0.000438 },
"2026-09-10": { "ALQ25": 0.000437 },
"2026-09-11": { "ALQ25": 0.000435 },
"2026-09-12": { "ALQ25": 0.000435 },
"2026-09-13": { "ALQ25": 0.000435 },
"2026-09-16": { "ALQ25": 0.000434 },
"2026-09-17": { "ALQ25": 0.000433 },
"2026-09-18": { "ALQ25": 0.000432 },
"2026-09-19": { "ALQ25": 0.000432 },
"2026-09-20": { "ALQ25": 0.000432 },
"2026-09-23": { "ALQ25": 0.000431 },
"2026-09-24": { "ALQ25": 0.000431 }
},
"unit": "per troy ounce"
}
Notes:
- Weekends/holidays: Some dates may repeat or hold the previous business day’s rate (depending on market calendars), as shown where weekend values remain constant.
- All values are troy ounces per USD; convert per the same formula to get USD per metric ton for each day.
Endpoint 3: OHLC for ALQ25 (Daily Candles)
Purpose
Retrieve open, high, low, and close values for ALQ25 on a specific date. Use it for charting, verifying price ranges, or calculating technical indicators.
Request
Query the OHLC endpoint by date (UTC):
curl -s "https://metals-api.com/api/open-high-low-close/2026-09-24?access_key=YOUR_ACCESS_KEY&base=USD&symbols=ALQ25"
Example response (illustrative)
{
"success": true,
"timestamp": 1790209194,
"base": "USD",
"date": "2026-09-24",
"rates": {
"ALQ25": {
"open": 0.000432,
"high": 0.000434,
"low": 0.000430,
"close": 0.000431
}
},
"unit": "per troy ounce"
}
Usage tips:
- Convert each OHLC field to USD/oz and then to USD/metric ton as needed.
- Candle validation: check that low ≤ open/close ≤ high to spot data anomalies before using the values in trading logic.
Complete Python Example: Fetch ALQ25 and Convert to USD/Metric Ton
This example requests the latest ALQ25 quote, converts the unit, and prints a clean result. Replace YOUR_ACCESS_KEY with your actual key. Keep it in an environment variable in production.
import os
import math
import time
import requests
API_BASE = "https://metals-api.com/api"
ACCESS_KEY = os.getenv("METALS_API_KEY") or "YOUR_ACCESS_KEY"
SYMBOL = "ALQ25"
BASE = "USD"
TROY_OZ_PER_METRIC_TON = 32150.7466
def fetch_latest_alq25():
url = f"{API_BASE}/latest"
params = {
"access_key": ACCESS_KEY,
"symbols": SYMBOL,
"base": BASE
}
r = requests.get(url, params=params, timeout=10)
r.raise_for_status()
data = r.json()
if not data.get("success"):
raise RuntimeError(f"API returned error: {data}")
rate = data["rates"].get(SYMBOL)
unit = data.get("unit", "per troy ounce")
ts = data.get("timestamp")
if rate is None:
raise ValueError(f"Symbol {SYMBOL} missing in response: {data}")
if unit != "per troy ounce":
# Update this logic if your plan/endpoint returns a different unit.
raise ValueError(f"Unexpected unit: {unit}")
# rate is troy_ounces_per_USD
usd_per_troy_oz = 1.0 / rate
usd_per_metric_ton = usd_per_troy_oz * TROY_OZ_PER_METRIC_TON
return {
"timestamp": ts,
"base": BASE,
"symbol": SYMBOL,
"usd_per_troy_oz": usd_per_troy_oz,
"usd_per_metric_ton": usd_per_metric_ton
}
if __name__ == "__main__":
try:
quote = fetch_latest_alq25()
print({
"symbol": quote["symbol"],
"timestamp": quote["timestamp"],
"price_usd_per_metric_ton": round(quote["usd_per_metric_ton"], 2),
"price_usd_per_troy_oz": round(quote["usd_per_troy_oz"], 4)
})
except Exception as e:
print(f"Error: {e}")
What this does:
- Calls the Latest endpoint for ALQ25 in USD.
- Parses rate (troy ounces per USD) and unit.
- Converts to USD per troy ounce, then to USD per metric ton.
- Prints a concise payload suitable for logging or downstream consumption.
Practical Considerations Developers Often Miss
1) Base currency
Default is USD. If you need per metric ton in EUR, you can request base=EUR, then perform the same unit math. When mixing currencies across services, normalize in one place to avoid subtle FX drift. Keep a single source of truth for base and FX conversions in your data layer.
2) Timestamps and timezone
- timestamp is Unix epoch seconds (UTC). Use it for ordering and caching keys.
- date is the UTC calendar date. Don’t assume local time—align your UI with UTC to ensure day rolls and candles match the data.
3) Weekends and market closures
- Expect unchanged rates on non-trading days. Your time-series may show repeated values across weekends/holidays.
- Guard your analytics to handle stale days and flat candles gracefully.
4) Caching and request efficiency
- Cache latest snapshots keyed by timestamp and symbol (e.g., ALQ25@1790209194) to avoid re-processing duplicates.
- Batch symbols when practical. For single-symbol workflows, keep calls minimal and respect plan limits.
- Implement exponential backoff on transient HTTP failures.
5) Data validation
- Check success==true before reading fields.
- Confirm the unit returned is what you expect, especially if you switch endpoints.
- Validate OHLC ordering: low ≤ open/close ≤ high.
From Data to Decisions: Where to Use ALQ25 Per Metric Ton
- Automated quoting in procurement portals: Convert real-time ALQ25 to per–metric ton and add your surcharge and delivery curve.
- Hedging dashboards: Overlay ALQ25 with internal exposure (tons per month) to trigger hedge proposals.
- Manufacturing ERP: Roll ALQ25 into your bill-of-materials cost engine to keep finished goods pricing in lockstep with market shifts.
- E-commerce: Update displayed prices or discounts for aluminum-based SKUs at safe intervals (respect caching and your plan’s update cadence).
- Research and data science: Build anomaly detectors or seasonality models using Time-Series and OHLC.
Deep Dive: Field-by-Field Guidance
- success: Always gate downstream logic on this. On false, inspect error fields and retry rules.
- timestamp: Unix seconds in UTC. Good for idempotency keys in your pipelines. Useful to reconcile to internal bars.
- base: The currency leg; ensure consistent base across all retrieved data when you compute spreads or aggregates.
- rates[symbol]: Rate as returned by endpoint. For metals with unit “per troy ounce,” interpret as troy_ounces_per_1_base_unit.
- unit: The price unit for the metal leg. Use it to drive your conversion factors and UI labels.
Error Handling and Recovery
- HTTP 4xx: Verify access_key, query parameters (symbols, dates), and your plan’s endpoint access.
- HTTP 5xx/timeouts: Retry with exponential backoff and jitter. Keep a last-known-good cache for continuity.
- Malformed payloads: Validate JSON schema; fail fast and alert. Persist raw responses for forensic debugging.
- Empty or missing symbol field: Confirm symbol on the Metals-API Supported Symbols page and ensure you passed it exactly as listed (ALQ25).
Performance and Scaling Tips
- Cache stable data: Time-Series results don’t change retroactively for closed days in most scenarios—persist them to avoid re-fetching.
- Windowing: Fetch history in rolling windows (e.g., last 30 days) so your trend calculations are bounded and efficient.
- Vectorized conversions: Convert units (troy ounce → metric ton) in batch to minimize overhead and preserve numerical precision.
- Asynchronous requests: If you expand beyond ALQ25, use async I/O or job queues to parallelize safely within your plan limits.
Security Best Practices
- Key storage: Use environment variables, secret managers, or KMS. Rotate keys regularly.
- Server-side calls: Proxy all client calls through your backend to avoid exposing credentials.
- Input sanitization: Treat symbols and dates as untrusted input—validate whitelist symbols and strict YYYY-MM-DD dates.
- Observability: Log request IDs, timestamps, and symbol sets for audit trails and incident response.
Real-World Workflow Examples
1) Procurement and RFQ automation
As new RFQs arrive, query Latest ALQ25, convert to USD/metric ton, apply your margin, freight, and alloying costs, and return a quote with a timestamp. Cache quotes per timestamp to ensure consistent pricing within an acceptance window.
2) Hedging signal checks
Use Time-Series to compute rolling averages and volatility for ALQ25. Combine with OHLC to confirm signal triggers (e.g., close crossing 20D MA). Alert traders or auto-stage hedge proposals when conditions are met.
3) ERP cost rollups
On a daily schedule, pull ALQ25 via Latest at a consistent hour (e.g., 16:00 UTC), convert to USD/metric ton, and push into your ERP’s cost tables to refresh BOMs. Maintain a history to audit pricing decisions.
Advanced Considerations
- Numerical precision: Use decimal types where financial precision matters. Round at presentation, not storage.
- Anomaly detection: Set sanity bands using historical percentiles to catch outliers in real time.
- Reconciliation: If you have a second source, periodically reconcile ALQ25 levels and log divergences for risk oversight.
- Lifecycle: As ALQ25 approaches maturity, confirm symbol lifecycle in your symbol master (roll to the next month as needed).
Detailed Endpoint Notes and Pitfalls
Latest
Parameters:
- access_key: required
- symbols=ALQ25: required for our use case
- base=USD: optional (USD default)
Common pitfalls:
- Forgetting symbols parameter returns a broad payload; filter server-side to save bandwidth.
- Assuming unit is per ton—always check unit field and convert accordingly.
Performance:
- Respect refresh cadence—don’t hammer the endpoint faster than updates occur.
- Cache by timestamp to avoid recomputing when the server timestamp hasn’t advanced.
Time-Series
Parameters:
- access_key: required
- start_date, end_date: required, YYYY-MM-DD
- symbols=ALQ25: required
- base=USD: optional
Pitfalls:
- Weekend handling: Expect repeated values or gaps by design—don’t treat them as nulls unless your logic needs business-day-only series.
- Date limits: Large ranges may be constrained by plan. Use rolling windows and persist data.
Performance:
- Persist historical results; daily bars won’t change post close for most users’ workflows.
OHLC
Parameters:
- access_key: required
- Date in path: open-high-low-close/YYYY-MM-DD
- symbols=ALQ25
- base=USD
Pitfalls:
- Intra-day usage: These are daily candles; don’t mix with tick-level assumptions.
- Validation: Ensure low ≤ high and the close lies within range before computing indicators.
Unit Conversion Patterns for Teams
Standardize conversion in a shared utility:
- Store rate_type and unit metadata alongside each record.
- Convert once near ingestion; store canonical USD/metric ton to simplify analytics.
- Retain original payloads for auditing and reprocessing if your conversion rules evolve.
Linking Technology and Strategy: Aluminum’s Data-Driven Future
As industrials become software-defined, ALQ25 feeds not just finance dashboards but also smart factory systems, predictive sourcing models, and autonomous procurement agents. With APIs like Metals-API, developers can embed reliable aluminum pricing into microservices, event-driven workflows, and ML pipelines. The combination of programmatic access, consistent structure, and straightforward unit conversion enables rapid prototyping and iterative optimization across your stack.
Where to Go Next
- Review parameters, limits, and advanced features at the Metals-API Documentation.
- Verify ALQ25 and related listings at the Metals-API Supported Symbols index.
- Get your free API key and start integrating today on the Metals-API Website.
FAQ
Does Metals-API return ALQ25 in USD per metric ton?
By default, rates are relative to the base currency (often USD) and expressed “per troy ounce.” Use the unit field in the response to confirm, then convert to USD per metric ton by multiplying USD per troy ounce by 32,150.7466.
How often is the Latest endpoint updated?
Update frequency depends on your subscription plan. Cache by timestamp and avoid polling faster than the documented cadence. See the Metals-API Documentation for plan-specific intervals.
What if I get the same rate on weekends or holidays?
That’s expected. Some markets don’t trade on weekends/holidays. Time-Series may show unchanged values for those dates. Your analytics should handle flat days gracefully.
How do I convert to EUR per metric ton?
Request base=EUR, then apply the same troy ounce → metric ton conversion. Alternatively, use USD base and convert currency separately in your FX layer—just be consistent across your system.
How should I store the data?
Persist raw responses and your standardized fields (e.g., USD/metric ton, timestamp, symbol, unit version). This supports audits, reconciliation, and reproducibility of analytics.
Is there an intraday or bid/ask feed for ALQ25?
Metals-API provides multiple endpoints. For details and eligibility per plan, consult the official documentation. Choose the endpoint that aligns with your precision and latency needs.
Can I use ALQ25 data in production pricing?
Yes—many customers integrate Metals-API into pricing services, ERPs, and trading tools. Implement caching, retries, monitoring, and unit tests to ensure robustness in production.