How to Get Real-Time Uniswap (UNI) - N/A Prices with Metals-API in Node.js for live dashboards
Building a live dashboard that shows real-time Uniswap (UNI) prices in Node.js often runs into a practical constraint: your data providers. If you’re evaluating Metals-API for this, the first thing to know is that Uniswap (UNI) is not a supported symbol on Metals-API. In other words, Uniswap is “N/A” here. That doesn’t make Metals-API any less valuable for a real-time dashboard—in fact, it’s an excellent backbone for live pricing of precious and industrial metals and currency rates you can align to your UNI view, for things like real-time USD conversion, volatility context, and historical baselining. This guide shows how to: verify that UNI is unsupported; detect and display N/A gracefully; power the rest of your Node.js dashboard with real-time metals and FX data from Metals-API; and stitch the pieces together into a robust live dashboard architecture.
Why combine a UNI dashboard with Metals-API?
Most live dashboards need more than just a single asset stream. You typically want:
- Normalized currency conversion into the user’s base currency (USD by default, or any supported fiat currency).
- A timebase you can trust: timestamps, timezone normalization, and historical backfilling for charts.
- Auxiliary economic context to interpret UNI’s price move—such as broad risk-on/risk-off trends in precious or industrial metals.
- Reliable API structure, consistent JSON formats, and predictable endpoints to build clean services.
Metals-API delivers this with low-latency JSON endpoints for latest prices, time-series data, conversion, OHLC, and more. While Uniswap (UNI) data itself is not provided (N/A), you can design your Node.js app to query Metals-API continuously for everything it does offer, and to treat UNI as a “not supported” symbol gracefully. When UNI data is available elsewhere, your dashboard already has the scaffolding for historical alignment, unit conversions, and consistent uptime monitoring.
Check symbol availability first (UNI is N/A)
If your dashboard includes assets from multiple data sources, always start by detecting which symbols an API supports. Metals-API provides a Metals-API Supported Symbols page you can use to confirm what’s available before you build. You will not find Uniswap (UNI) there. Plan accordingly: in your UI, show “N/A” for UNI from Metals-API and avoid making per-request symbol filters for unsupported assets. This keeps your requests efficient and your UX clear.
Endpoints you actually need for a live dashboard
To keep your implementation focused, we’ll cover only the endpoints that are most useful in a real-time dashboard alongside a not-supported asset like UNI:
- Latest Rates Endpoint: Fetch current prices for supported symbols; use this as the heartbeat for your dashboard’s update loop.
- Time-series Endpoint: Backfill historical data for your charts and stats windows (e.g., 7D, 30D, YTD).
- Convert Endpoint: Convert values between currencies and metals units to generate normalized displays or PnL metrics.
For the full list of features and advanced options, see the Metals-API Documentation.
Authentication and setup
Sign up at the Metals-API Website and get your free API key. You’ll pass it as the access_key query parameter on every request. Keep your key secure—do not embed it directly in client-side code in production. Use environment variables and a server-side proxy when building web dashboards.
Call to action: Ready to try it? Visit the Metals-API Website now to get a free API key and start integrating within minutes.
A note on units, base currency, and time
- Units: Price quotes are provided with a unit field (for example, “per troy ounce”). When converting or calculating per-gram or per-kilogram values, convert units accurately (1 troy ounce ≈ 31.1034768 grams).
- Base currency: By default, exchange rates are relative to USD. If you want to display everything in EUR, convert with the Convert endpoint to avoid confusion.
- Timestamps and timezone: Timestamps are Unix epoch seconds, and dates are in ISO format (YYYY-MM-DD). Normalize to UTC in your backend and render timezones in the client.
- Market closures: Metals markets may have weekend or holiday gaps. Your dashboard should handle days without new bars by carrying forward the last known price or clearly flagging closures.
UNI on Metals-API: how to display N/A cleanly
Because Uniswap (UNI) is not a supported symbol on Metals-API, the safe pattern is:
- Do not request UNI as a filtered symbol parameter to Metals-API endpoints. Instead, request supported symbols or leave it broad.
- In your Node.js code, check whether the response includes a “UNI” entry. It won’t. Display “N/A” accordingly.
- Keep a consistent UI experience by showing last-updated time and data source, even when a symbol is unavailable.
Endpoint 1: Latest Rates for live updates
The Latest Rates endpoint returns a snapshot of current exchange rates with a consistent JSON schema. While UNI won’t be present, this payload powers your dashboard clock, your unit conversions, and your ancillary charts.
Example: curl request (no symbol filter)
This example fetches all available rates. Replace YOUR_API_KEY with your actual key.
curl -s "https://metals-api.com/api/latest?access_key=YOUR_API_KEY"
Example: JSON response
The following is a realistic example of a successful response. Notice that the base is USD, timestamps are Unix epoch, and unit is per troy ounce. As expected, there is no “UNI” field under rates.
{
"success": true,
"timestamp": 1789691363,
"base": "USD",
"date": "2026-09-18",
"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"
}
Interpreting the latest payload
- success: true indicates a valid payload you can trust.
- timestamp: Use this to set your dashboard’s “Last updated” and to compute staleness alerts.
- base: “USD” means the numbers under rates are how many troy ounces 1 USD buys for each symbol. For example, rates.XAU = 0.000482 means $1 buys 0.000482 troy ounces of gold.
- rates: A dictionary keyed by symbol. Metals-API symbols are listed here: Metals-API Supported Symbols. You will not find “UNI”.
- unit: “per troy ounce” clarifies the metals unit for all returned symbols.
Node.js: polling latest, handling UNI as N/A, and normalizing to USD
The snippet below shows how to poll the Latest Rates endpoint in Node.js, detect that UNI is not present, and surface N/A in your live dashboard while still updating other tiles.
const https = require('https');
const ACCESS_KEY = process.env.METALS_API_KEY; // set this in your environment
function fetchLatest() {
return new Promise((resolve, reject) => {
const url = `https://metals-api.com/api/latest?access_key=${ACCESS_KEY}`;
https.get(url, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
try {
const json = JSON.parse(data);
if (!json.success) return reject(new Error('API returned success=false'));
resolve(json);
} catch (e) {
reject(e);
}
});
}).on('error', reject);
});
}
async function updateDashboard() {
try {
const latest = await fetchLatest();
// Metals and FX context
const ts = latest.timestamp;
const base = latest.base;
const unit = latest.unit;
// Example: derive a price per troy ounce in USD for XAU
// rates are "per USD". To get USD per troy ounce: invert.
const xauPerUsd = latest.rates.XAU;
const usdPerXau = xauPerUsd ? (1 / xauPerUsd) : null;
// UNI is N/A on Metals-API
// Attempting to access latest.rates.UNI will give undefined
const uniRate = latest.rates.UNI; // undefined
const uniDisplay = (typeof uniRate === 'number') ? uniRate : 'N/A';
// Update your dashboard store
const state = {
lastUpdated: ts,
baseCurrency: base,
unit,
xauUsd: usdPerXau,
uni: uniDisplay
};
console.log('Dashboard state:', state);
} catch (err) {
console.error('Update failed:', err.message);
}
}
// Poll every 30s (configurable to your plan/needs)
setInterval(updateDashboard, 30000);
updateDashboard();
Key points:
- Never assume a symbol exists—check presence and type explicitly.
- Metals-API uses “per USD” rates. Invert to get USD per unit of metal for display (if that’s what your users expect).
- Separate your fetch layer, transformation layer, and UI update layer for robust code and easier testing.
Endpoint 2: Time-series for backfilling and charts
For historical charts, you need a reliable timeseries. Use the Time-series endpoint for supported symbols. UNI will not appear here either, so your logic should gracefully skip it while still populating other charts.
Example: JSON response for a date range
The following shows a successful time-series payload between start_date and end_date. You can chart the series for supported symbols and display N/A for UNI.
{
"success": true,
"timeseries": true,
"start_date": "2026-09-11",
"end_date": "2026-09-18",
"base": "USD",
"rates": {
"2026-09-11": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-09-13": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-09-18": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Field-by-field usage
- timeseries: true confirms this is a time-series result.
- start_date and end_date: Use these to validate your chart window and detect partial days.
- rates[YYYY-MM-DD]: Map day keys to chart buckets. Handle missing days (weekends, holidays) by forward-filling or marking gaps in the UI.
- Each day’s object contains only supported symbols; UNI won’t be there. Your chart code should check for the symbol key before plotting.
Practical charting notes
- Interpolation: Avoid interpolating market closures as real trades. Use a step or hold-last-value strategy for continuity but indicate non-trading days.
- Normalization: If your dashboard uses USD per unit (e.g., USD/oz), invert the per-USD values on ingest.
- Caching: Cache time-series responses in your server or CDN. Historical data doesn’t change retroactively often; this saves requests and latency.
Endpoint 3: Convert for consistent currency display
Even though UNI data is N/A here, your dashboard can still leverage Metals-API as the source of truth for currency conversions and metals unit conversions. This is especially useful when users toggle dashboard currency (USD/EUR/etc.).
Example: JSON response for a conversion
This shows converting a USD amount into a metal unit (e.g., gold troy ounces). The same structure applies if you simply need to convert USD amounts across your widgets.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789691363,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
How to use Convert for dashboard UX
- When users toggle the quote currency, convert numeric displays consistently. If you show UNI (from another source) in USD, you can use Metals-API to calculate an equivalent EUR display.
- When you aggregate or compare assets, bring them into a shared unit and currency first (usually USD).
- Persist the rate and timestamp alongside the computed result to explain slight differences between tiles (if they’re refreshed at different times).
Multiple JSON scenarios you should handle
Here are several different JSON responses from the endpoints above, to ensure your dashboard code is resilient.
Latest Rates: successful snapshot
{
"success": true,
"timestamp": 1789691363,
"base": "USD",
"date": "2026-09-18",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815
},
"unit": "per troy ounce"
}
Time-series: subset of symbols on some dates
{
"success": true,
"timeseries": true,
"start_date": "2026-09-11",
"end_date": "2026-09-18",
"base": "USD",
"rates": {
"2026-09-11": { "XAU": 0.000485 },
"2026-09-12": {},
"2026-09-13": { "XAU": 0.000483, "XAG": 0.0382 },
"2026-09-18": { "XAU": 0.000482 }
},
"unit": "per troy ounce"
}
Convert: stable result with timestamped rate
{
"success": true,
"query": { "from": "USD", "to": "XAU", "amount": 250 },
"info": { "timestamp": 1789691363, "rate": 0.000482 },
"result": 0.1205,
"unit": "troy ounces"
}
OHLC: using daily bars for analytics tiles
While not strictly necessary for a minimal live dashboard, OHLC helps produce accurate open/high/low/close tiles for supported symbols. Your UNI tile should remain N/A in this context.
{
"success": true,
"timestamp": 1789691363,
"base": "USD",
"date": "2026-09-18",
"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
}
},
"unit": "per troy ounce"
}
Data architecture for a mixed-source dashboard
When an asset like UNI is not available in Metals-API, structure your system like this:
- Ingestion layer: One service per data provider. Your Metals-API service handles metals and currency rates; it never attempts to fetch UNI.
- Normalization layer: Standardize on UTC timestamps, base currency (USD), and numeric precision. Store the invertible relationship (per USD vs USD per unit) explicitly to avoid confusion.
- Cache layer: Cache latest and time-series responses. For example, cache the latest for 10–60 seconds depending on your plan update frequency.
- Presentation layer: Each widget declares its data source. UNI’s tile shows “N/A from Metals-API” if you choose to display it in that context, while still drawing correct currency conversions for your other tiles.
Performance considerations
- Batch where possible: If you plan to show multiple metals, prefer one unfiltered latest call over many filtered calls. Extract the keys you need client-side.
- CDN caching: For time-series and historical endpoints, cache aggressively. Use conditional requests or server-side caches to reduce latency and cost.
- Backoff and jitter: Implement exponential backoff with jitter on transient network errors to avoid thundering herds after outages.
- Numeric stability: Store both the raw per-USD rate and its inverted USD-per-unit form to avoid repeated floating-point inversions.
Security best practices
- API key hygiene: Keep your Metals-API key on the server. If building a web dashboard, expose a proxy endpoint that your frontend calls.
- Input validation: Sanitize query parameters and symbol lists. Even if you don’t send UNI to Metals-API, validate any user-provided inputs you accept.
- Secrets management: Use environment variables or a secrets manager. Rotate keys periodically.
- Observability: Log API response metadata (timestamp, success flag) and your request IDs. Store minimal PII if any.
Error handling and recovery strategies
- Fallbacks: On a failed latest request, show the last cached snapshot with a “stale” indicator.
- Graceful degradation: If time-series fetch fails, keep the last N bars and visually indicate missing data rather than blanking the chart.
- Retry policies: Use capped exponential backoff, with separate budgets for read paths to maintain responsiveness.
- Detect unsupported symbols: Don’t assume UNI is present; treat absence as a first-class state (N/A).
Caching and request minimization
- Server cache: Cache latest for the shortest interval consistent with your subscription’s update frequency. For example, if updates are every 10 minutes, caching for 30–60 seconds reduces burst load without adding staleness.
- Client cache: Memoize expensive transforms (e.g., unit inversions, derived statistics) keyed by timestamp.
- Conditional logic: Skip redundant time-series calls when the date range hasn’t changed.
Advanced analytics layers you can build
- Volatility bands: Use time-series to compute standard deviation bands for metals; display alongside UNI’s volatility from your other source for context.
- Cross-asset normalization: Convert everything to a single currency and compute correlation matrices. UNI remains a separate feed, but the normalization logic stays consistent.
- Event overlays: Align timestamped economic events to your metals charts to help interpret UNI’s moves in macro context.
Digital transformation in industrial metals: a UNI-adjacent insight
While your dashboard focuses on UNI, the industrial metals narrative—especially Nickel—can provide meaningful macro context. Nickel underpins batteries and advanced manufacturing, and its pricing often reflects supply chain health and innovation cycles. Using a high-quality feed like Metals-API for Nickel (symbol XNI) lets you:
- Quantify macro shifts that may correlate with risk appetite in DeFi.
- Build predictive features using metals time-series alongside blockchain metrics.
- Integrate smart alerts in your dashboard when industrial metals signal stress or expansion.
For a full list of symbols (including XNI for Nickel), refer to the Metals-API Supported Symbols.
Handling weekends and market closures
- Daily bars: Expect no new bars on weekends/holidays for many symbols. Use forward-fill for charts but visually distinguish non-trading periods.
- Comparative stats: When computing week-over-week move, align like-for-like business days.
- Alerting: Suppress “no update” alerts during known closures to avoid noise.
Practical dashboard patterns for “N/A” assets like UNI
- Explicit source labels: Each widget displays its data source. For UNI: “Source: N/A via Metals-API.”
- Unified last updated: Use the Metals-API timestamp to update your dashboard clock. For the UNI tile, show “N/A” but still display the global clock for consistency.
- Conversion-first UX: Let users pick a quote currency; apply Metals-API conversion rates to all monetary widgets. UNI stays N/A, but your currency scaffolding is consistent everywhere.
Troubleshooting common pitfalls
- “Why is UNI missing in the response?” Because Uniswap is not supported by Metals-API. Validate against the supported symbols list and treat UNI as N/A.
- “Numbers look inverted.” Remember rates are “per USD.” Invert to get USD per troy ounce for human-readable pricing.
- “My charts have gaps.” Use Metals-API time-series and handle non-trading days. Forward-fill or mark gaps; don’t interpolate with a line that implies trading.
- “Users see different prices within a minute.” Standardize on when you refresh each tile and show the timestamp. Use a store that fans out a single payload to all widgets.
Scaling your Node.js integration
- Worker pool: Offload API calls to a lightweight worker process that updates a shared cache (Redis or in-memory with clustering).
- Rate alignment: Schedule updates in line with your plan’s update frequency to avoid over-polling without added benefit.
- Bulk hydration: On startup, hydrate all widgets from cached latest and time-series data before making new calls, then backfill deltas.
Linking out for reference and planning
- Explore the complete set of capabilities: Metals-API Documentation
- Confirm whether a symbol is supported: Metals-API Supported Symbols
- Sign up for an API key: Metals-API Website
Putting it all together: a reliable UNI + metals dashboard
Even though Uniswap (UNI) is not provided by Metals-API, you can still build a robust live dashboard in Node.js by designing for N/A support and leaning on Metals-API for the rest: real-time metals and currency rates, time-series for historical context, consistent timestamps, and conversions. The result is a cleaner architecture where each data provider is used for its strengths, and your user experience stays predictable and highly performant.
FAQ
Does Metals-API provide Uniswap (UNI) prices?
No. UNI is not supported on Metals-API; treat it as N/A within this data source. Check the Metals-API Supported Symbols list to confirm availability for any asset you plan to display.
Can I still use Metals-API for my UNI dashboard?
Yes—for everything around UNI: currency conversions, timebase normalization, historical chart scaffolding, and context via metals prices. Your UNI tile will show N/A from Metals-API while other tiles remain fully powered.
Which endpoints should I start with?
Start with Latest Rates for live updates, Time-series for chart backfill, and Convert for currency and unit normalization. Consult the Metals-API Documentation for optional endpoints like OHLC and Bid/Ask.
How do I display prices in USD per troy ounce?
Metals-API returns rates “per USD.” Invert the number to get USD per troy ounce. For example, if rates.XAU = 0.000482, then USD per oz = 1 / 0.000482.
What should I do about weekends and holidays?
Expect missing bars on closures. Forward-fill or visually mark gaps in charts and suppress unnecessary “no update” alerts during those periods.
How do I get started quickly?
Grab your key at the Metals-API Website, test with a simple curl call to the Latest Rates endpoint, then wire a Node.js polling loop as shown above. Expand to time-series and conversion as you add charts and currency toggles.