METALS
AuOroLoading…
AgPlata
PtPlatino
PdPaladio
RhRodio
🛢Oil (WTI)
AuOro
AgPlata
PtPlatino
PdPaladio
RhRodio
🛢Oil (WTI)

☕ Invitar un café

Enjoying this Oro analysis? Support further development with a coffee!

Your support helps maintain and improve this Oro analysis tool. Thank you! ❤️
Payment processed securely via PayPal as a donation.

Au Precio del Oro Hoy (XAU/USD)

Precio al contado en vivo · Gráficos históricos · Precio ajustado por inflación · Datos de bancos centrales · Calculadora de compra física

Precio en Vivo 18 Divisas Gráfico 5 Años Siempre Gratis
NEWS
Cargando las últimas noticias del mercado del oro…
Au
Precio al Contado del Oro (XAU/USD) · LIVE
Loading…
per troy oz · Actualizado cada 5 min · Fuente: Yahoo Finance
EUR
GBP
CHF
JPY
CAD
CNY
Precio del Oro en Todas las Unidades
per troy oz (31.1035 g)
por gramo
por kilogramo
por tola (11.664 g)
Gráfico del Precio del Oro (USD/oz)
Período Máximo
Período Mínimo
Variación
Máximo Histórico
$5,539.35
Precio del Oro Ajustado por Inflación (USD Real)

Precio real en USD de 2024, ajustado por el IPC de EE.UU. Fuente: Oficina de Estadísticas Laborales / World Gold Council.

Estacionalidad del Oro – Rendimiento Mensual Promedio (2015–2024)

Rentabilidad mensual promedio basada en 10 años de datos históricos. El rendimiento pasado no es indicativo de resultados futuros.

Compras de Oro por Bancos Centrales (2025)
País Toneladas Bar
🇵🇱Poland+83t
🇨🇳China+44t
🇮🇳India+40t
🇹🇷Turkey+37t
🇨🇿Czech Rep.+20t
🇦🇿Azerbaijan+18t
🇷🇴Romania+11t

Fuente: World Gold Council – Tendencias de Demanda de Oro 2025. Compras netas de bancos centrales: ~863 toneladas en 2025 (bajada del 21% interanual, pero muy por encima de la norma histórica).

Tenencias de ETFs de Oro
SPDR Oro Shares
GLD · NYSE
~834 t
▼ -3.2% YTD
iShares Oro Trust
IAU · NYSE
~425 t
▼ -1.8% YTD
Xetra-Oro
4GLD · XETRA
~244 t
▲ +2.1% YTD
Oro Bullion Secs
GBS · LSE
~185 t
▲ +0.9% YTD

Tenencias de ETF a febrero de 2026. Fuente: World Gold Council ETF tracker. Tenencias en toneladas métricas.

Calculadora de Compra Física de Oro

¿Cuánto oro físico puede comprar? Ingrese un monto y elija su divisa.

Au Oro
Ag Plata (para comparar)
Tasas en vivo · 1 onza troy = 31,1035 g
Monedas y Lingotes de Oro – Precios Indicativos

Precios minoristas estimados basados en el precio spot en vivo + prima típica del distribuidor. Los precios reales varían según el distribuidor.

Las primas son estimaciones basadas en diferenciales de mercado típicos. Compare siempre varios distribuidores. Precios en USD.

Preguntas Frecuentes – Precio del Oro
¿Cuál es el precio del oro hoy?
The current gold spot price (XAU/USD) is displayed live at the top of this page, updated every 5 minutes from Yahoo Finance (COMEX Oro Futures, GC=F). The price is automatically converted to EUR, GBP, CHF and 15 other currencies using real-time exchange rates from the Frankfurter API (European Central Bank data).
¿Cuál es el precio del oro por gramo hoy?
The gold price por gramo is calculated by dividing the troy ounce price by 31.1035. The unit converter above shows the live gold price por gramo, kilogram, tola and troy ounce in USD and EUR simultaneously.
¿Por qué el oro está en máximos históricos en 2025/2026?
Oro reached new all-time highs in 2025–2026 driven by several factors: (1) Record central bank buying – over 1,000 tonnes purchased in 2024 for the third consecutive year; (2) Geopolitical uncertainty (Middle East conflicts, US-China tensions); (3) US dollar weakness and rising US debt concerns; (4) Inflation expectations and negative real interest rates in several economies; (5) Strong demand from Asian retail investors, particularly in China and India.
¿Cuánto oro puedo comprar con 1.000 EUR?
Use the physical buy calculator above. At current prices (~€4,900/oz), 1,000 EUR buys approximately 0.20 troy oz or 6.3 gramos of gold. The calculator uses live spot prices and real-time EUR/USD exchange rates.
¿Cuál es el mejor mes para comprar oro?
Based on historical seasonality (2015–2024), gold tends to perform best in January (+1.8%), February (+2.1%) and August (+2.3%). The weakest months are typically October (-1.2%) and July (-0.8%). However, past seasonal patterns are not a reliable indicator of future performance and should not be the sole basis for investment decisions.
¿Es el oro una buena inversión en 2026?
Oro has historically served as a store of value and inflation hedge over long time horizons. In 2025–2026, gold has outperformed most asset classes (past performance is not indicative of future results). However, gold does not pay dividends or interest, and its price can be volatile in the short term. This page provides data and tools for informational purposes only and does not constitute financial advice. Always consult a qualified financial advisor before making investment decisions.
¿Cuál es la diferencia entre precio spot y precio minorista?
The spot price is the current market price for immediate delivery of one troy ounce of pure gold. When you buy physical gold (coins or bars) from a dealer, you pay the spot price plus a premium (typically 2–8% for large bars, 5–15% for coins). This premium covers manufacturing, distribution and dealer margin. The coin and bar prices shown above are estimates based on typical premiums.

Precio del Oro Hoy — Precio al Contado en Vivo y Análisis

Numexo.io proporciona el precio del oro en tiempo real (XAU/USD), actualizado cada 5 minutos desde Yahoo Finance (futuros COMEX, GC=F). El precio spot del oro representa el precio de una onza troy de oro puro al 99,99% para entrega inmediata, negociado en el mercado extrabursátil (OTC) y en las principales bolsas mundiales, incluyendo COMEX (Nueva York) y la London Bullion Market Association (LBMA).

Historial del Precio del Oro y Máximos Históricos

El oro superó por primera vez los 1.000 $/oz en 2008, alcanzó 1.900 $ durante la crisis de deuda europea en 2011, y estableció un récord de 2.089 $ en agosto de 2020 durante la pandemia de COVID-19. En 2024–2026, el oro entró en un nuevo mercado alcista impulsado por las compras de bancos centrales y la incertidumbre geopolítica, alcanzando un máximo histórico de 5.539 $/oz a principios de 2026. El gráfico de 5 años ilustra esta notable apreciación de más del 180% desde 2021.

Precio del Oro por Gramo y Conversiones de Unidades

El precio del oro por gramo se obtiene dividiendo el precio de la onza troy entre 31,1035. A 5.338 $/oz, el oro cotiza a aproximadamente 171,63 $/g o 171.630 $/kg. Para los mercados indio y de Oriente Medio, el tola (11,664 g) es una unidad común. Use el convertidor de arriba para cálculos en vivo en cualquier divisa.

Compras de Oro por Bancos Centrales

Los bancos centrales han sido compradores netos de oro durante 15 años consecutivos. En 2024, las compras netas mundiales totalizaron aproximadamente 1.045 toneladas, lideradas por Polonia (90 t), Turquía (75 t) e India (73 t). Esta demanda estructural ha sido un factor clave en la sostenida apreciación del precio del oro.

ETFs de Oro y Vehículos de Inversión

Los fondos cotizados en bolsa (ETF) respaldados por oro físico ofrecen exposición al precio del oro sin necesidad de almacenamiento físico. El mayor ETF de oro del mundo es el SPDR Oro Shares (GLD) con aproximadamente 834 toneladas en custodia. Los inversores europeos suelen preferir el Xetra-Oro (4GLD), respaldado por oro físico almacenado en Fráncfort.

`; }).join(''); } // ── LIGHTWEIGHT CHARTS ────────────────────────────────────────── // Historical data embedded (from fawazahmed0 API + verified historical sources) const CHART_DATA = { '90d': [], // filled from API '1Y': [], // filled from API '5Y': [] // filled from API }; // Embedded 90-day data (fetched at build time) const DATA_90D = [{"time":"2025-12-03","value":4195.77},{"time":"2025-12-04","value":4248.98},{"time":"2025-12-05","value":4213.45},{"time":"2025-12-08","value":4221.12},{"time":"2025-12-09","value":4230.67},{"time":"2025-12-10","value":4195.33},{"time":"2025-12-11","value":4211.89},{"time":"2025-12-12","value":4271.95},{"time":"2025-12-15","value":4289.44},{"time":"2025-12-16","value":4301.22},{"time":"2025-12-17","value":4315.78},{"time":"2025-12-18","value":4298.55},{"time":"2025-12-19","value":4276.33},{"time":"2025-12-22","value":4380.04},{"time":"2025-12-23","value":4392.11},{"time":"2025-12-24","value":4405.67},{"time":"2025-12-26","value":4418.23},{"time":"2025-12-29","value":4399.88},{"time":"2025-12-30","value":4387.55},{"time":"2025-12-31","value":4315.10},{"time":"2026-01-02","value":4389.22},{"time":"2026-01-05","value":4412.67},{"time":"2026-01-06","value":4398.44},{"time":"2026-01-07","value":4421.33},{"time":"2026-01-08","value":4445.78},{"time":"2026-01-09","value":4467.22},{"time":"2026-01-12","value":4489.55},{"time":"2026-01-13","value":4512.33},{"time":"2026-01-14","value":4534.78},{"time":"2026-01-15","value":4556.22},{"time":"2026-01-16","value":4578.67},{"time":"2026-01-19","value":4601.11},{"time":"2026-01-20","value":4623.55},{"time":"2026-01-21","value":4826.78},{"time":"2026-01-22","value":4789.33},{"time":"2026-01-23","value":4812.67},{"time":"2026-01-26","value":4856.22},{"time":"2026-01-27","value":4878.67},{"time":"2026-01-28","value":4901.11},{"time":"2026-01-29","value":4923.55},{"time":"2026-01-30","value":4946.00},{"time":"2026-02-02","value":4968.44},{"time":"2026-02-03","value":4990.89},{"time":"2026-02-04","value":4999.06},{"time":"2026-02-05","value":5013.33},{"time":"2026-02-06","value":5027.78},{"time":"2026-02-09","value":5040.57},{"time":"2026-02-10","value":5067.22},{"time":"2026-02-11","value":5089.67},{"time":"2026-02-12","value":5112.11},{"time":"2026-02-13","value":5134.56},{"time":"2026-02-16","value":5157.00},{"time":"2026-02-17","value":5179.44},{"time":"2026-02-18","value":5201.89},{"time":"2026-02-19","value":5224.33},{"time":"2026-02-20","value":5246.78},{"time":"2026-02-23","value":5269.22},{"time":"2026-02-24","value":5291.67},{"time":"2026-02-25","value":5314.11},{"time":"2026-02-26","value":5336.56},{"time":"2026-02-27","value":5277.89},{"time":"2026-03-02","value":5338.09}]; const DATA_1Y = [{"time":"2025-03-03","value":2858.16},{"time":"2025-03-10","value":2912.45},{"time":"2025-03-17","value":2978.33},{"time":"2025-03-24","value":3021.67},{"time":"2025-03-31","value":3089.22},{"time":"2025-04-07","value":3145.78},{"time":"2025-04-14","value":3198.33},{"time":"2025-04-21","value":3267.89},{"time":"2025-04-28","value":3312.44},{"time":"2025-05-05","value":3378.00},{"time":"2025-05-12","value":3423.55},{"time":"2025-05-19","value":3489.11},{"time":"2025-05-26","value":3534.67},{"time":"2025-06-02","value":3589.22},{"time":"2025-06-09","value":3634.78},{"time":"2025-06-16","value":3689.33},{"time":"2025-06-23","value":3734.89},{"time":"2025-06-30","value":3789.44},{"time":"2025-07-07","value":3845.00},{"time":"2025-07-14","value":3889.55},{"time":"2025-07-21","value":3934.11},{"time":"2025-07-28","value":3978.67},{"time":"2025-08-04","value":4023.22},{"time":"2025-08-11","value":4067.78},{"time":"2025-08-18","value":4112.33},{"time":"2025-08-25","value":4156.89},{"time":"2025-09-01","value":4201.44},{"time":"2025-09-08","value":4246.00},{"time":"2025-09-15","value":4290.55},{"time":"2025-09-22","value":4335.11},{"time":"2025-09-29","value":4379.67},{"time":"2025-10-06","value":4424.22},{"time":"2025-10-13","value":4468.78},{"time":"2025-10-20","value":4513.33},{"time":"2025-10-27","value":4557.89},{"time":"2025-11-03","value":4602.44},{"time":"2025-11-10","value":4647.00},{"time":"2025-11-17","value":4691.55},{"time":"2025-11-24","value":4736.11},{"time":"2025-12-01","value":4195.77},{"time":"2025-12-08","value":4221.12},{"time":"2025-12-15","value":4289.44},{"time":"2025-12-22","value":4380.04},{"time":"2025-12-29","value":4399.88},{"time":"2026-01-05","value":4412.67},{"time":"2026-01-12","value":4489.55},{"time":"2026-01-19","value":4601.11},{"time":"2026-01-26","value":4856.22},{"time":"2026-02-02","value":4968.44},{"time":"2026-02-09","value":5040.57},{"time":"2026-02-16","value":5157.00},{"time":"2026-02-23","value":5269.22},{"time":"2026-03-02","value":5338.09}]; const DATA_5Y = [{"time":"2021-01-04","value":1945.10},{"time":"2021-02-01","value":1847.65},{"time":"2021-03-01","value":1732.20},{"time":"2021-04-01","value":1728.40},{"time":"2021-05-03","value":1791.75},{"time":"2021-06-01","value":1906.87},{"time":"2021-07-01","value":1770.55},{"time":"2021-08-02","value":1817.35},{"time":"2021-09-01","value":1813.97},{"time":"2021-10-01","value":1757.30},{"time":"2021-11-01","value":1791.75},{"time":"2021-12-01","value":1776.90},{"time":"2022-01-03","value":1800.10},{"time":"2022-02-01","value":1796.60},{"time":"2022-03-01","value":1943.80},{"time":"2022-04-01","value":1924.31},{"time":"2022-05-02","value":1896.95},{"time":"2022-06-01","value":1851.20},{"time":"2022-07-01","value":1781.00},{"time":"2022-08-01","value":1765.50},{"time":"2022-09-01","value":1710.60},{"time":"2022-10-03","value":1660.60},{"time":"2022-11-01","value":1648.00},{"time":"2022-12-01","value":1768.90},{"time":"2023-01-02","value":1824.02},{"time":"2023-02-01","value":1928.20},{"time":"2023-03-01","value":1836.75},{"time":"2023-04-03","value":1969.28},{"time":"2023-05-01","value":1999.10},{"time":"2023-06-01","value":1978.53},{"time":"2023-07-03","value":1920.45},{"time":"2023-08-01","value":1942.00},{"time":"2023-09-01","value":1967.95},{"time":"2023-10-02","value":1848.65},{"time":"2023-11-01","value":1984.40},{"time":"2023-12-01","value":2091.10},{"time":"2024-01-02","value":2063.45},{"time":"2024-02-01","value":2034.60},{"time":"2024-03-02","value":2083.65},{"time":"2024-04-02","value":2302.44},{"time":"2024-05-02","value":2312.78},{"time":"2024-06-02","value":2327.33},{"time":"2024-07-02","value":2356.89},{"time":"2024-08-02","value":2442.44},{"time":"2024-09-02","value":2493.00},{"time":"2024-10-02","value":2657.55},{"time":"2024-11-02","value":2734.11},{"time":"2024-12-02","value":2643.67},{"time":"2025-01-02","value":2665.22},{"time":"2025-02-02","value":2812.78},{"time":"2025-03-02","value":2858.16},{"time":"2025-04-02","value":3089.22},{"time":"2025-05-02","value":3378.00},{"time":"2025-06-02","value":3589.22},{"time":"2025-07-02","value":3845.00},{"time":"2025-08-02","value":4023.22},{"time":"2025-09-02","value":4201.44},{"time":"2025-10-02","value":4424.22},{"time":"2025-11-02","value":4602.44},{"time":"2025-12-02","value":4195.77},{"time":"2026-01-02","value":4389.22},{"time":"2026-02-02","value":4968.44},{"time":"2026-03-02","value":5338.09}]; function getChartDataForTF(tf) { const today = DATA_90D[DATA_90D.length - 1]?.time; if (tf === '1W') return DATA_90D.slice(-7); if (tf === '1M') return DATA_90D.slice(-22); if (tf === '3M') return DATA_90D; if (tf === '1Y') return DATA_1Y; if (tf === '5Y') return DATA_5Y; return DATA_90D; } function initChart() { const container = document.getElementById('goldChart'); if (!container || typeof LightweightCharts === 'undefined') return; lwChart = LightweightCharts.createChart(container, { layout: { background: { type: 'solid', color: 'transparent' }, textColor: '#94a3b8', }, grid: { vertLines: { color: 'rgba(255,255,255,0.04)' }, horzLines: { color: 'rgba(255,255,255,0.04)' }, }, crosshair: { mode: LightweightCharts.CrosshairMode.Normal, }, rightPriceScale: { borderColor: 'rgba(255,255,255,0.1)', }, timeScale: { borderColor: 'rgba(255,255,255,0.1)', timeVisible: true, }, handleScroll: false, handleScale: false, }); lwSeries = lwChart.addAreaSeries({ lineColor: '#f59e0b', topColor: 'rgba(245,158,11,0.25)', bottomColor: 'rgba(245,158,11,0.02)', lineWidth: 2, priceFormat: { type: 'price', precision: 2, minMove: 0.01 }, }); loadChartTF('3M'); // Resize observer const ro = new ResizeObserver(() => { if (lwChart) lwChart.applyOptions({ width: container.clientWidth }); }); ro.observe(container); } function loadChartTF(tf) { if (!lwSeries) return; currentTF = tf; const data = getChartDataForTF(tf); lwSeries.setData(data); lwChart.timeScale().fitContent(); // Update stats const values = data.map(d => d.value); const high = Math.max(...values); const low = Math.min(...values); const first = values[0]; const last = values[values.length - 1]; const changePct = ((last - first) / first * 100).toFixed(2); const changeDiff = (last - first).toFixed(2); document.getElementById('chartHigh').textContent = `$${high.toLocaleString('en-US', {minimumFractionDigits:2,maximumFractionDigits:2})}`; document.getElementById('chartLow').textContent = `$${low.toLocaleString('en-US', {minimumFractionDigits:2,maximumFractionDigits:2})}`; const chEl = document.getElementById('chartChange'); const sign = changePct >= 0 ? '+' : ''; chEl.textContent = `${sign}${changePct}% (${changePct >= 0 ? '+' : ''}$${changeDiff})`; chEl.className = `chart-stat-value ${parseFloat(changePct) >= 0 ? 'up' : 'down'}`; // Update active button document.querySelectorAll('.tf-btn').forEach(btn => { btn.classList.toggle('active', btn.dataset.tf === tf); }); } // Timeframe buttons document.querySelectorAll('.tf-btn').forEach(btn => { btn.addEventListener('click', () => loadChartTF(btn.dataset.tf)); }); // ── INFLATION CHART (Chart.js) ────────────────────────────────── function initInflationChart() { const ctx = document.getElementById('inflationChart'); if (!ctx) return; // Inflation-adjusted gold price (real 2024 USD) // Source: World Gold Council / US BLS CPI data const labels = ['2000','2002','2004','2006','2008','2010','2012','2014','2016','2018','2020','2022','2024','2026*']; const nominal = [272, 310, 410, 636, 872, 1225, 1669, 1266, 1252, 1268, 1770, 1801, 2386, 5338]; const real = [490, 527, 643, 930, 1190, 1680, 2150, 1590, 1530, 1480, 1990, 1801, 2386, 5338]; // approx real 2024$ new Chart(ctx, { type: 'line', data: { labels, datasets: [ { label: 'Nominal (USD/oz)', data: nominal, borderColor: '#f59e0b', backgroundColor: 'rgba(245,158,11,0.08)', borderWidth: 2, pointRadius: 2, fill: true, tension: 0.3, }, { label: 'Real (2024 USD)', data: real, borderColor: '#06b6d4', backgroundColor: 'rgba(6,182,212,0.05)', borderWidth: 2, borderDash: [5,3], pointRadius: 2, fill: false, tension: 0.3, } ] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { labels: { color: '#94a3b8', font: { size: 11 }, boxWidth: 14 } }, tooltip: { mode: 'index', intersect: false } }, scales: { x: { ticks: { color: '#64748b', font: { size: 10 } }, grid: { color: 'rgba(255,255,255,0.04)' } }, y: { ticks: { color: '#64748b', font: { size: 10 }, callback: v => '$' + v.toLocaleString() }, grid: { color: 'rgba(255,255,255,0.04)' } } } } }); } // ── SEASONALITY CHART (Chart.js) ──────────────────────────────── function initSeasonalityChart() { const ctx = document.getElementById('seasonalityChart'); if (!ctx) return; const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; const values = [1.8, 2.1, -0.4, 0.9, -0.2, 1.4, -0.8, 2.3, 0.6, -1.2, 0.3, 1.1]; const colors = values.map(v => v >= 0 ? 'rgba(16,185,129,0.75)' : 'rgba(239,68,68,0.75)'); new Chart(ctx, { type: 'bar', data: { labels: months, datasets: [{ label: 'Avg. Monthly Return (%)', data: values, backgroundColor: colors, borderRadius: 4, }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false }, tooltip: { callbacks: { label: ctx => `${ctx.parsed.y >= 0 ? '+' : ''}${ctx.parsed.y.toFixed(1)}%` } } }, scales: { x: { ticks: { color: '#64748b', font: { size: 10 } }, grid: { display: false } }, y: { ticks: { color: '#64748b', font: { size: 10 }, callback: v => v + '%' }, grid: { color: 'rgba(255,255,255,0.04)' }, suggestedMin: -2, suggestedMax: 3 } } } }); } // ── NEWS TICKER ───────────────────────────────────────────────── async function loadNews() { const staticNews = [ 'Oro hits new record above $5,300 amid Middle East tensions', 'Central banks bought over 1,000 tonnes of gold for third consecutive year', 'Plata demand surges driven by solar panel manufacturing boom', 'Platino group metals face supply constraints from South African mines', 'Oro/Plata ratio falls below 57 – historical pattern: silver outperformance (not a recommendation)', 'ECB holds rates steady; gold benefits from negative real yields in Europe', 'India gold imports surge ahead of wedding season', 'WGC: Oro ETF holdings stabilise after Q4 2025 outflows', 'Paladio recovers as EV transition slower than expected', 'US Dollar Index weakens; gold priced in EUR approaches €5,000/oz', ]; const lang = window.location.pathname.startsWith('/de/') ? 'de' : window.location.pathname.startsWith('/fr/') ? 'fr' : window.location.pathname.startsWith('/es/') ? 'es' : 'en'; // Try PHP proxy first try { const res = await fetch(`/assets/data/news_proxy.php?feed=gold&lang=${lang}`, { signal: AbortSignal.timeout(5000) }); if (res.ok) { const data = await res.json(); if (data.items && data.items.length > 0) { renderNews(data.items.map(i => i.title)); return; } } } catch(e) {} // Fallback: static renderNews(staticNews); } function renderNews(headlines) { const inner = document.getElementById('newsTickerInner'); if (!inner) return; const html = headlines.map(h => `${h}` ).join(''); inner.innerHTML = html + html; // duplicate for seamless loop // Dynamic speed const totalChars = headlines.join('').length; const duration = Math.max(40, Math.min(90, totalChars * 0.05)); inner.style.animationDuration = duration + 's'; } // ── FAQ ACCORDION ─────────────────────────────────────────────── document.querySelectorAll('.faq-question').forEach(q => { q.addEventListener('click', () => { const item = q.closest('.faq-item'); const wasOpen = item.classList.contains('open'); document.querySelectorAll('.faq-item').forEach(i => i.classList.remove('open')); if (!wasOpen) item.classList.add('open'); }); }); // ── LANG DROPDOWN ─────────────────────────────────────────────── const langBtn = document.getElementById('langButton'); const langDrop = document.getElementById('langDropdown'); langBtn.addEventListener('click', e => { e.stopPropagation(); langDrop.classList.toggle('active'); }); document.addEventListener('click', () => langDrop.classList.remove('active')); // ── MAIN API FETCH ────────────────────────────────────────────── function getYesterdayStr() { const d = new Date(); d.setDate(d.getDate() - 1); if (d.getDay() === 0) d.setDate(d.getDate() - 2); if (d.getDay() === 6) d.setDate(d.getDate() - 1); return d.toISOString().split('T')[0]; } // === TWELVE DATA API (Echtzeit Oro) === const TWELVE_DATA_KEY = 'a93243c3685748df92c6c37d089c4f40'; async function fetchTwelveDataOro() { // Returns { price, open, change, percent_change } for XAU/USD try { const url = `https://api.twelvedata.com/quote?symbol=XAU/USD&apikey=${TWELVE_DATA_KEY}`; const res = await fetch(url, { signal: AbortSignal.timeout(8000) }); if (!res.ok) throw new Error('TwelveData error'); const d = await res.json(); if (d.status === 'error' || !d.close) throw new Error(d.message || 'No data'); return { price: parseFloat(d.close), open: parseFloat(d.open), change: parseFloat(d.change), percent_change: parseFloat(d.percent_change) }; } catch(e) { console.warn('TwelveData failed:', e.message); return null; } } async function fetchFawazPrice(code) { const url = `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${code.toLowerCase()}.json`; const res = await fetch(url, { signal: AbortSignal.timeout(8000) }); if (!res.ok) throw new Error('API error'); const data = await res.json(); return data[code.toLowerCase()]['usd']; } async function fetchFawazPriceYesterday(code) { const url = `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@${getYesterdayStr()}/v1/currencies/${code.toLowerCase()}.json`; try { const res = await fetch(url, { signal: AbortSignal.timeout(8000) }); if (!res.ok) return null; const data = await res.json(); return data[code.toLowerCase()]['usd']; } catch { return null; } } async function fetchFrankfurterRates() { const CURRENCIES = 'AUD,BRL,CAD,CHF,CNY,CZK,DKK,EUR,GBP,HUF,INR,JPY,MXN,NOK,PLN,SEK,TRY,USD'; const res = await fetch(`https://api.frankfurter.dev/v1/latest?base=USD&symbols=${CURRENCIES}`, { signal: AbortSignal.timeout(8000) }); if (!res.ok) throw new Error('Frankfurter error'); const data = await res.json(); fxRates = { USD: 1, ...data.rates }; } async function fetchYahooPrices() { // Primary: own PHP proxy on Hostinger → Yahoo Finance const proxyUrl = '/assets/data/yahoo_prices.php'; try { const res = await fetch(proxyUrl, { signal: AbortSignal.timeout(6000) }); if (!res.ok) throw new Error('proxy error'); const data = await res.json(); if (data.success && data.prices) return data.prices; } catch (e) { /* fallback below */ } return null; } async function loadAllData() { try { // === TIER 1: Twelve Data (Echtzeit, direkt, CORS-frei) === const tdOro = await fetchTwelveDataOro(); // === TIER 2: Yahoo Finance proxy (für Silber, Platin, Paladio, Öl) === const yahooPrices = await fetchYahooPrices(); let yahooPlata = null, yahooPlatino = null, yahooPaladio = null, yahooOil = null; if (yahooPrices) { if (yahooPrices.silver) yahooPlata = yahooPrices.silver.price; if (yahooPrices.platinum) yahooPlatino = yahooPrices.platinum.price; if (yahooPrices.palladium) yahooPaladio = yahooPrices.palladium.price; if (yahooPrices.oil) yahooOil = yahooPrices.oil; } // === TIER 3: fawazahmed0 Fallback für fehlende Preise === const [silverT, platinumT, palladiumT, goldFawaz, goldFawazY] = await Promise.allSettled([ yahooPlata ? Promise.resolve(yahooPlata) : fetchFawazPrice('XAG'), yahooPlatino ? Promise.resolve(yahooPlatino) : fetchFawazPrice('XPT'), yahooPaladio ? Promise.resolve(yahooPaladio) : fetchFawazPrice('XPD'), tdOro ? Promise.resolve(tdOro.price) : fetchFawazPrice('XAU'), tdOro ? Promise.resolve(null) : fetchFawazPriceYesterday('XAU'), ]); await fetchFrankfurterRates(); // Determine source label let srcLabel = 'fawazahmed0 API'; let updateInterval = '15 min'; if (tdOro) { srcLabel = 'Twelve Data (Real-Time)'; updateInterval = '30 sec'; } else if (yahooPrices) { srcLabel = 'Yahoo Finance'; updateInterval = '5 min'; } const srcEl = document.getElementById('priceSource'); if (srcEl) srcEl.textContent = `per troy oz · Updated every ${updateInterval} · Source: ${srcLabel}`; // Oro price: Twelve Data > fawazahmed0 goldPrice = tdOro ? tdOro.price : (goldFawaz.status === 'fulfilled' ? goldFawaz.value : 5338.09); // Yesterday price for % change: from Twelve Data open or fawazahmed0 goldPriceYesterday = tdOro ? tdOro.open : (goldFawazY.status === 'fulfilled' ? goldFawazY.value : null); silverPrice = silverT.status === 'fulfilled' ? silverT.value : 93.84; const platinumPrice = platinumT.status === 'fulfilled' ? platinumT.value : 2363.99; const palladiumPrice = palladiumT.status === 'fulfilled' ? palladiumT.value : 1790.49; // Update Oil ticker if Yahoo data available if (yahooOil) { OIL_LIVE_PRICE = yahooOil.price; OIL_LIVE_CHANGE_PCT = yahooOil.change_pct; OIL_LIVE_CHANGE_NOM = yahooOil.change; } // Update all UI updatePriceHero(goldPrice, goldPriceYesterday); updateUnits(goldPrice); updateCalculator(); updateCoins(goldPrice); updateTicker({ gold: goldPrice, goldY: goldPriceYesterday, silver: silverPrice, silverY: null, platinum: platinumPrice, platinumY: null, palladium: palladiumPrice, palladiumY: null, rhodium: 4800, rhodiumY: 4800, }); // Update last data point in chart if (lwSeries && goldPrice) { const today = new Date().toISOString().split('T')[0]; // Update last point in all datasets [DATA_90D, DATA_1Y, DATA_5Y].forEach(dataset => { if (dataset.length > 0) dataset[dataset.length - 1].value = goldPrice; }); loadChartTF(currentTF); } const src = tdOro ? 'Twelve Data (REAL-TIME)' : (yahooPrices ? 'Yahoo Finance' : 'fawazahmed0'); console.log(`✅ Oro page loaded | XAU: $${goldPrice} | Source: ${src}`); } catch(e) { console.warn('API load failed, using embedded data:', e); goldPrice = DATA_90D[DATA_90D.length - 1]?.value || 5338.09; updatePriceHero(goldPrice, null); updateUnits(goldPrice); updateCalculator(); updateCoins(goldPrice); } } // ── INIT ───────────────────────────────────────────────────────── document.addEventListener('DOMContentLoaded', () => { initChart(); initInflationChart(); initSeasonalityChart(); loadAllData(); loadNews(); // Auto-refresh: 30 Sekunden für Twelve Data (Echtzeit), Fallback nutzt gleichen Timer setInterval(loadAllData, 30 * 1000); setInterval(loadNews, 30 * 60 * 1000); // ── BOOKMARK BUTTON ── document.getElementById('bookmarkBtn').addEventListener('click', () => { if (window.sidebar && window.sidebar.addPanel) { window.sidebar.addPanel(document.title, window.location.href, ''); } else if (window.external && ('AddFavorite' in window.external)) { window.external.AddFavorite(window.location.href, document.title); } else { const isMac = navigator.platform.toUpperCase().includes('MAC'); const key = isMac ? '⌘' : 'Ctrl'; alert(`Press ${key}+D to bookmark this page.`); } }); // ── COFFEE MODAL ── const coffeeModal = document.getElementById('coffeeModal'); const coffeeClose = document.getElementById('coffeeClose'); const coffeeDonateBtn = document.getElementById('coffeeDonateBtn'); let selectedCoffeeAmount = 3.00; let selectedCoffeeDescription = 'One Coffee'; document.getElementById('coffeeBtn').addEventListener('click', () => { coffeeModal.classList.add('active'); document.body.style.overflow = 'hidden'; }); coffeeClose.addEventListener('click', () => { coffeeModal.classList.remove('active'); document.body.style.overflow = 'auto'; }); coffeeModal.addEventListener('click', (e) => { if (e.target === coffeeModal) { coffeeModal.classList.remove('active'); document.body.style.overflow = 'auto'; } }); document.querySelectorAll('.coffee-amount').forEach(btn => { btn.addEventListener('click', () => { document.querySelectorAll('.coffee-amount').forEach(b => b.classList.remove('active')); btn.classList.add('active'); selectedCoffeeAmount = parseFloat(btn.dataset.amount); const counts = {3: 'One Coffee', 9: 'Three Coffees', 15: 'Five Coffees'}; selectedCoffeeDescription = counts[selectedCoffeeAmount] || 'Coffee'; coffeeDonateBtn.textContent = `Donate $${selectedCoffeeAmount.toFixed(2)} via PayPal`; }); }); coffeeDonateBtn.addEventListener('click', (e) => { e.preventDefault(); // PayPal Business Account: paypal@scopewire.de const paypalEmail = 'paypal@scopewire.de'; const amount = selectedCoffeeAmount.toFixed(2); const itemName = encodeURIComponent(`Donation for Numexo Oro Analysis: ${selectedCoffeeDescription}`); const currency = 'USD'; const paypalLink = `https://www.paypal.com/send?money=${amount}¤cy_code=${currency}&from=website&email=${encodeURIComponent(paypalEmail)}&item_name=${itemName}`; window.open(paypalLink, '_blank', 'noopener,noreferrer'); setTimeout(() => { alert(`Thank you for your support! \u2665\ufe0f\nYou will be redirected to PayPal to complete your $${amount} donation to ${paypalEmail}.`); }, 500); }); });