Brass (BRASS) - Per Troy Ounce Latest Price API with endpoints for tick, OHLC, and timezone-aware timestamps

Metals-API 8 min read
Brass (BRASS) - Per Troy Ounce Latest Price API with endpoints for tick, OHLC, and timezone-aware timestamps

You need to quote and hedge products that reference brass in real time, plot a daily candle for risk review, and timestamp every update correctly for audit. By the end of this walkthrough, you’ll fetch the latest per–troy ounce price for Brass (BRASS), derive USD/oz from the response, read an OHLC daily bar, and handle timezone-aware timestamps reliably.

What you’re building: live brass pricing with daily candle context

Common use cases we see:

Illustration: Brass (BRASS) - Per Troy Ounce Latest Price API with endpoints for tick, OHLC, and timezone-aware timestamps
  • E-commerce: price brass-based SKUs dynamically in USD using a live BRASS per–troy ounce rate.
  • Trading/research: display a daily open-high-low-close (OHLC) for BRASS next to an intraday tick chart.
  • ERP/MRP: value work-in-progress and purchase orders in USD with correct timestamps and unit conversions (oz ↔ kg).

We’ll focus on two core endpoints that matter for this workflow:

  • Latest Rates: to get the live BRASS quote and its USD inversion in a single call.
  • OHLC: to retrieve the daily candle you need for charts, risk, and journaling.

For symbol reference and availability across plans, see the live catalog at Metals-API Supported Symbols.

Fetch the latest BRASS price per troy ounce (and USD/oz)

The Latest endpoint returns exchange rates relative to a base currency. By default, base is USD. For metals, you will often see both the “oz per USD” rate and its inversion “USD per oz.” Metals-API returns both directly when you include USDBRASS alongside BRASS.

Latest request (curl)

curl -s "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=BRASS,USDBRASS"

Official JSON response example

{"success":true,"timestamp":1793664480,"date":"2026-11-03","base":"USD","rates":{"BRASS":5.976762295082,"USD":1,"USDBRASS":0.167314668147812}}

How to read this

  • base: "USD" — all rates are quoted relative to USD.
  • rates.BRASS: 5.976762295082 — troy ounces of BRASS per 1 USD (oz/USD).
  • rates.USDBRASS: 0.167314668147812 — USD per 1 troy ounce of BRASS (USD/oz).
  • unit: not present in this terse example, but Metals-API metals are quoted per troy ounce unless otherwise stated.
  • timestamp: 1793664480 — Unix epoch seconds (UTC). Convert it in your app and always store it as UTC for consistency.

If USDBRASS is not requested/returned for your plan, compute USD per oz as 1 / rates.BRASS. Always check for divide-by-zero and nulls.

End-to-end example in Python

This example requests BRASS and USDBRASS, normalizes to USD per troy ounce, converts to common units for pricing (grams and kilograms), and parses the UTC timestamp.

import requests
from datetime import datetime, timezone

API_URL = "https://metals-api.com/api/latest"
API_KEY = "YOUR_API_KEY"

params = {
    "access_key": API_KEY,
    "symbols": "BRASS,USDBRASS"
}

r = requests.get(API_URL, params=params, timeout=10)
r.raise_for_status()
data = r.json()

if not data.get("success", False):
    raise RuntimeError(f"API error: {data}")

ts = data["timestamp"]  # Unix seconds, UTC
as_utc = datetime.fromtimestamp(ts, tz=timezone.utc)

rates = data["rates"]
oz_per_usd = rates.get("BRASS")  # oz/USD
usd_per_oz = rates.get("USDBRASS") or (1.0 / oz_per_usd if oz_per_usd else None)

if usd_per_oz is None:
    raise ValueError("Unable to determine USD per troy ounce for BRASS")

# Unit conversions
TROY_OUNCE_TO_GRAM = 31.1034768
usd_per_gram = usd_per_oz / TROY_OUNCE_TO_GRAM
usd_per_kg = usd_per_gram * 1000.0

quote = {
    "timestamp_utc": as_utc.isoformat(),
    "usd_per_oz": usd_per_oz,
    "usd_per_gram": usd_per_gram,
    "usd_per_kg": usd_per_kg
}

print(quote)

Notes:

  • Timestamps are UTC. Keep your storage and analytics UTC; convert to a local timezone only at the UI layer.
  • If you price inventory in grams or kilograms, convert from troy ounces using 1 troy ounce = 31.1034768 grams.
  • Cache this response in memory or Redis with a TTL aligned to your update frequency. The Latest endpoint updates depend on plan; for specifics, see the Documentation.

Daily OHLC for BRASS (open, high, low, close)

Daily candles help operators and quants reason about volatility, gap risk, and daily settlement. Metals-API exposes an OHLC endpoint that returns open, high, low, and close for a given date.

Pattern:

GET https://metals-api.com/api/open-high-low-close/YYYY-MM-DD?access_key=YOUR_API_KEY&symbols=BRASS,USDBRASS

Usage tips:

  • Request both BRASS and USDBRASS if you want USD/oz directly; otherwise invert BRASS.
  • Dates are calendar dates; weekends/holidays typically carry forward the most recent close. Handle nulls gracefully.
  • Normalize candle timestamps to midnight UTC for storage consistency. Tag with the API’s date field for display.

For full field-level behavior and plan scope on OHLC, refer to the endpoint details in the Documentation.

Tick-level options: when you need intraday detail

If your application needs finer-than-daily moves (for example, tick-by-tick or minute bars), Metals-API offers:

  • Intraday Endpoint: request intraday data for a single symbol on supported plans.
  • WebSocket Streaming Endpoint: stream live prices into your application.

Pick one based on your system architecture and latency goals. For coverage and parameters, see the BRASS symbol on the Symbols page and the streaming/intraday sections in the Documentation.

Interpreting base currency and inversion correctly

Metals-API defaults to base=USD:

  • rates.BRASS = troy ounces per 1 USD (oz/USD).
  • rates.USDBRASS = USD per 1 troy ounce (USD/oz).

If USDBRASS is not part of your response, compute USD/oz as 1 / rates.BRASS. This inversion is exact to floating-point precision and supports unit conversions without ambiguity.

Units that matter in production

  • Troy ounce vs. avoirdupois: metals quote per troy ounce. 1 troy ounce = 31.1034768 grams; 1 avoirdupois ounce = 28.349523125 grams. Do not mix them.
  • From USD/oz to USD/kg: divide by 31.1034768 to get USD/gram; multiply by 1000 for USD/kg.
  • Lot and sheet pricing: if your BOM consumes sheets, derive USD/sheet by mass (thickness × area × density) and multiply by USD/kg. Keep this calculation server-side so your SKUs update atomically.

If you audit conversions, embed unit metadata in your price object (e.g., unit="USD/oz" before converting to "USD/kg").

Timezone-aware timestamps and weekend behavior

  • Timestamp field: a Unix epoch in seconds, UTC. Convert with your platform’s UTC utilities and store as UTC.
  • Date field: ISO date associated with the quote/candle. Treat it as a trading calendar date, not a wall-clock assumption.
  • Market closures and weekends: expect the latest endpoint to return a valid timestamp and the most recent trading date on weekends/holidays. For charting, forward-fill sensibly and visually differentiate non-trading days.

For handling timezones in client UIs, convert from UTC to local on render; server-side aggregation should remain in UTC to avoid DST drift.

Caching, retries, and throughput hygiene

  • Cache the Latest response for the update interval of your plan (for example, 60 or 10 minutes as available). This reduces latency and request volume.
  • Use a single source of truth: one pricing service pulls Metals-API and publishes internally via a message bus or cache.
  • Retry with backoff on transient network failures; do not retry on 4xx errors without changing the request.
  • Precompute common units (USD/oz, USD/g, USD/kg) and round only at the presentation tier to avoid cumulative rounding error in rollups.

Comparing endpoints for live pricing, candles, and ticks

Endpoint Primary use Symbol example Time granularity Notes
latest Live spot snapshot BRASS, USDBRASS Plan-dependent refresh Returns oz/USD and USD/oz if both symbols requested.
open-high-low-close/YYYY-MM-DD Daily candle BRASS, USDBRASS Daily Use for charts, P&L buckets, and daily settlements.
intraday / websocket Ticks / streaming BRASS Intraday Choose based on latency requirements and architecture.

Practical integration patterns

E-commerce price engine

  • Pull latest BRASS and USDBRASS once per refresh interval.
  • Convert to USD/kg and apply SKU-specific loss factors and fabrication premiums.
  • Cache per-SKU results with a TTL slightly shorter than the API refresh to absorb clock skew.

Trading dashboard

  • Use latest for the top-of-book tile and OHLC for the daily summary card.
  • If you need intraday charts, subscribe via WebSocket and downsample to 1m/5m bars.
  • Alert when USD/oz crosses thresholds; store UTC timestamps for audit.

ERP/Manufacturing

  • Snapshot daily USD/oz BRASS at a fixed UTC cut-off to stabilize standard costs.
  • Track variances by comparing PO-time price to current USD/kg derived from BRASS.
  • When backfilling, use OHLC by date to align with accounting periods.

Cost awareness and planning

Plan selection affects update frequency and endpoint availability. As a reference point, Copper Monthly is $19.99/month. To match your brass workload (snapshot vs. intraday vs. streaming), evaluate plan features and request volume in the MCP portal after registering.

cURL you can paste into CI/CD or a terminal

This is the same latest request shown earlier, suitable for scripts and health checks. Replace YOUR_API_KEY and parse JSON with jq or your preferred tool.

curl -s "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=BRASS,USDBRASS"

Validation and data hygiene

  • Schema-check: assert success=true, presence of timestamp, base, and rates.BRASS (and/or rates.USDBRASS).
  • Monotonicity: for OHLC, assert low ≤ open/close ≤ high; reject candles that break invariants.
  • Reasonableness: alert on multi-sigma moves between refreshes to catch integration mistakes.
  • Idempotency: tag every stored price with timestamp and date from the response; avoid writing duplicates.

Why BRASS data, now: digital transformation in commodities

Brass pricing used to live in spreadsheets and vendor PDFs. Exposing BRASS as a programmable symbol unlocks:

  • Automated repricing of catalogs and quotes.
  • Real-time exposure management in procurement.
  • Backtesting fabrication premia against OHLC series to tune margins.

With APIs, the same feed powers mobile, web, and internal tools consistently. See all available symbols and verify BRASS at the Symbols directory.

Additional references

FAQ

How do I convert the API’s oz/USD rate to USD/oz if USDBRASS is missing?
Compute 1 / rates.BRASS and handle floating-point precision carefully. Keep at least 6–8 decimal places for internal math; round only for display.

What timezone is the timestamp in?
UTC. It’s a Unix epoch in seconds. Convert on display; store in UTC to keep aggregates and audits consistent across DST changes.

How should I handle weekends and holidays?
Expect the latest endpoint to reflect the most recent available trading date with a current timestamp. Forward-fill charts for those days and annotate non-trading sessions if needed.

Can I request both BRASS and USDBRASS in one call?
Yes—pass symbols=BRASS,USDBRASS to avoid manual inversion and get both oz/USD and USD/oz.

What’s the best way to reduce request volume?
Cache the Latest response for the plan’s refresh interval, serve your apps from that cache, and only invalidate when a newer timestamp arrives.

Ready to ship brass pricing into your product? Get your API key and start integrating today: Register. Explore parameters and endpoint specifics in the Documentation, and manage your plan and usage in MCP.