Moldovan Leu (MDL) - N/A Spot Price — Real-time API endpoints and response examples
You need to quote Moldovan Leu (MDL) alongside metals prices in your app, update MDL conversions in real time, and store a clean audit trail for pricing or P&L. By the end of this guide, you’ll fetch the latest MDL rate from Metals-API, understand how to read and cache it, and combine it with metal units (troy ounces) for downstream pricing, alerts, and backtesting.
What you’re building: MDL spot access for pricing, conversion, and charting
Many fintech and trading tools don’t need a full currency stack—just one or two quote currencies to price inventory, ecommerce SKUs, or hedges. If your users in Moldova expect prices in MDL, you’ll want a reliable MDL feed you can merge with metals data and store historically. Metals-API returns MDL in the same response envelope used for metals, simplifying your pipeline and allowing unified caching, logging, and alerting.
This article focuses on two endpoints that cover the core workflow:
- Latest (real-time MDL quote)
- Time-series or Historical (for backfilling and charting) — referenced with notes and parameters to consider
We’ll also show how to combine MDL with metal units (troy ounce) at the application layer without multiplying requests.
Key concepts: base currency, units, and symbol selection
- Base currency: Metals-API responds with base set to USD by default. That means each rate is “units per 1 USD.” For a currency like MDL, a rate of 17.93 means 1 USD equals 17.93 MDL.
- Inverse pairs: Some responses include a derived inverse like USDMDL (USD per 1 MDL). This is the algebraic inverse of MDL (1 / 17.93 ≈ 0.0557).
- Units for metals: Metals are quoted per troy ounce. If you price in grams or kilograms, convert units after retrieving the API rate. 1 troy ounce = 31.1034768 grams.
- Symbols: Confirm your target codes on the symbols page and keep your requests tight to reduce payload size and speed up parsing. See Metals-API Supported Symbols.
Latest MDL: one request to power pricing and UI refreshes
Use the Latest endpoint to fetch real-time MDL alongside any other symbols you need. The response includes a timestamp and a human-readable date. Treat the timestamp as a Unix epoch (seconds) and assume UTC when storing or comparing times across systems.
Copy-paste curl request
curl "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=MDL,USD,USDMDL"
Official JSON response (MDL)
{"success":true,"timestamp":1792714140,"date":"2026-10-23","base":"USD","rates":{"MDL":17.9369425,"USD":1,"USDMDL":0.05575086166441131}}
What these fields mean for your code
- success: Boolean status flag. Confirm this before reading fields.
- timestamp: 1792714140 (Unix seconds). Use it to version cache entries and detect staleness.
- date: 2026-10-23 (UTC calendar date). Handy for labeling charts and daily jobs.
- base: USD (rates are “per 1 USD”).
- rates.MDL: 17.9369425. Interpretation: 1 USD = 17.9369425 MDL.
- rates.USD: 1. Provided for convenience when you include it in symbols; often not needed.
- rates.USDMDL: 0.05575086166441131. Interpretation: 1 MDL = 0.05575086166441131 USD (inverse of MDL).
Minimal Python example: fetch and convert
import requests
from decimal import Decimal, ROUND_HALF_UP
API_URL = "https://metals-api.com/api/latest"
API_KEY = "YOUR_API_KEY"
params = {
"access_key": API_KEY,
"symbols": "MDL,USD,USDMDL"
}
r = requests.get(API_URL, params=params, timeout=10)
r.raise_for_status()
data = r.json()
if not data.get("success"):
raise RuntimeError(f"API error: {data}")
timestamp = data["timestamp"] # Unix seconds
rates = data["rates"]
mdl_per_usd = Decimal(str(rates["MDL"]))
usd_per_mdl = Decimal(str(rates["USDMDL"]))
# Example: convert 10,000 MDL to USD
amount_mdl = Decimal("10000")
amount_usd = (amount_mdl * usd_per_mdl).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
# Example: convert USD to MDL
amount_usd_in = Decimal("2500")
amount_mdl_out = (amount_usd_in * mdl_per_usd).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
print({
"timestamp": timestamp,
"mdl_per_usd": str(mdl_per_usd),
"usd_per_mdl": str(usd_per_mdl),
"10000_mdl_in_usd": str(amount_usd),
"2500_usd_in_mdl": str(amount_mdl_out),
})
Notes:
- Use Decimal for financial accuracy.
- Round at the presentation layer (e.g., to 2 decimals for fiat) and keep full precision internally for P&L and tax reports.
How to combine MDL with metal prices in your app
When you also fetch a metal rate (quoted per troy ounce) you can convert to MDL client-side without making additional currency calls:
- Take the metal’s rate relative to USD (per 1 USD).
- Invert it to get USD per troy ounce, then multiply by MDL per USD for MDL per troy ounce.
- If your product is in grams, divide by 31.1034768 to get per gram.
This design keeps your currency layer separate and cached, which is useful when you need to price many metals or SKUs in MDL in one sweep.
Historical and time-series MDL for charts and backfills
For charting, perform backfills with either the Historical endpoint (single date) or Time-series (range). You’ll use the same symbol (MDL) and interpret the rate as “MDL per 1 USD” for each date in the series. Store both the timestamp and date fields to detect and reconcile calendar gaps (weekends, holidays, or market maintenance windows).
Implementation pointers:
- Query a compact symbol set (e.g., MDL only) during backfills to minimize payload and reduce job time.
- If you also store USD per MDL in your database, compute it deterministically as the inverse when writing records to avoid inconsistencies.
- When your charting UI requests MDL data, serve it from your cache or warehouse and only call Latest to refresh the most recent point.
For request parameters and data limits, consult the Metals-API Documentation.
Caching, update cadence, and reliability
- Update frequency: The Latest endpoint updates in intervals tied to your plan. Use the timestamp to confirm freshness before updating UI or trades.
- Cache strategy:
- Short-TTL edge cache (e.g., 30–120 seconds) for end-user views.
- Longer cache for server-side calculations where intra-minute precision isn’t critical.
- Key your cache by symbol set and endpoint. Store the raw JSON and a parsed “view model.”
- Weekend/holiday behavior: Expect fewer changes in off-hours. Always rely on the timestamp and date fields rather than assuming an update just occurred.
- Idempotency: When persisting, include the timestamp in your natural key to avoid duplicate inserts.
Precision, units, and rounding when mixing MDL with metals
- Currency formatting: Present 2 decimals for MDL to end users, but keep higher precision internally.
- Troy ounce vs metric: Metals are per troy ounce. Convert with 1 ozt = 31.1034768 g. Keep a canonical converter function in your codebase to avoid drift.
- Inversion checks: If you use both MDL and USDMDL, verify they’re consistent (rate × inverse ≈ 1.0 within your precision tolerance) before using them in sensitive calculations.
Error handling and fallbacks
- Schema checks: Confirm success is true and that rates.MDL exists before calculation.
- Graceful degradation: If Latest is temporarily unavailable, serve the last known good rate with a staleness banner or watermark. Record the timestamp of the data you show.
- Monitoring: Alert if the timestamp is older than your SLA threshold or if the rate deviates beyond set bands since the last N observations.
Production checklist for MDL integration
- Keys and plans:
- Get your API key and restrict it to your environments. Use environment variables or secret managers.
- If you need copper-focused workloads, Copper Monthly is $19.99/mo. Align your polling frequency with your plan’s update cadence.
- Data model:
- Store raw JSON responses for compliance/audit.
- Normalize fields: base, date, timestamp, symbol, value, and optionally inverse.
- Testing:
- Unit tests for unit conversions and inversions.
- Replay tests using recorded responses with fixed timestamps.
- Docs and discovery:
- Confirm symbol codes and availability on the Supported Symbols list.
- Bookmark the API Documentation for endpoint details and parameters.
Smart integrations: MDL in digital metals workflows
Whether you’re running a pricing engine or a data science pipeline, MDL pairs neatly with metals data to automate quoting and reporting across Moldova-centric commerce or procurement. As markets adopt more data-driven automation, the ability to stream a fiat like MDL alongside metals unlocks practical workflows:
- Real-time ecommerce repricing: Update MDL shelf prices when your metals feed or currency feed crosses a threshold.
- Intraday margin monitoring: Recompute MDL-denominated inventory value and hedges on a schedule.
- Supply chain analytics: Measure cost drift in MDL across time windows and reconcile with invoices and purchase orders.
For organizations tracking industrial inputs (including refractory metals), consolidating fiat and metal rates in one API simplifies digital transformation: fewer moving parts, shared observability, and consistent math across dashboards and reports.
Operational guardrails: latency, retries, and security
- Latency: Keep symbol lists minimal (e.g., “MDL” only if that’s all you need) to trim payload and TTFB.
- Retries: Use short, bounded retries with jitter for transient network errors; never infinite retries. Log all failures with request IDs.
- Security: Pass the API key over HTTPS only. Do not expose it in front-end code; proxy via your backend where possible.
- Versioning: If you normalize to an internal schema, add a schema_version column to allow for painless migrations later.
When you also handle metals: unit coherence and downstream math
Because metals are quoted per troy ounce and MDL is a fiat currency, your code should keep the following practices:
- Normalize all “per unit” rates first (e.g., per troy ounce and per USD). Only then apply MDL conversion.
- Separate precision by domain: high precision (4–6+ decimals) for intermediate calculations; user-facing rounding at the end.
- If you store both MDL and a metal rate for the same timestamp, link them in your DB via the common timestamp and date fields to simplify joins.
Where to go next
- Get an API key to start calling these endpoints: Register.
- Read detailed parameters and examples: Metals-API Documentation.
- Confirm symbol availability and metadata: Metals-API Supported Symbols.
- Explore commercial options for managed connectivity: MCP.
FAQ
Why does the response include both MDL and USDMDL?
They’re inverses of each other: MDL is “MDL per 1 USD,” and USDMDL is “USD per 1 MDL.” Some workflows prefer one direction. If you store both, verify their product is approximately 1 within your precision tolerance.
How should I handle timezones?
Use the provided timestamp as your source of truth and treat it as Unix epoch seconds (UTC). If you display local times, convert at the presentation layer and keep UTC in storage for consistency across services and regions.
How often should I poll Latest for MDL?
Match your polling interval to your plan’s update cadence and business needs. For quote pages, short caches (30–120 seconds) balance freshness and stability. For back-office reporting, polling every few minutes with strict timestamp checks is usually sufficient.
What happens on weekends or holidays?
Rates may update less frequently. Always rely on the timestamp/date returned rather than assuming a fresh tick. Build UI indicators for staleness if the timestamp exceeds your freshness threshold.
Can I convert MDL for unit costs priced in grams?
Yes. Convert the metal’s per–troy ounce rate to per-gram (divide by 31.1034768), then multiply by MDL per USD. Keep unit conversions in a single, well-tested utility.
Ready to implement? Create your API key and ship a production-grade MDL integration today. Start here: Register. For endpoint details, parameters, and usage notes, see the Documentation, and confirm symbol coverage on Symbols. If you need managed connectivity options, explore MCP.