Spaces:
Running
Running
Download test_quant.html from EvilElves/chronos-world: direct link, hf CLI and curl.
- Browser
- Download file 17.8 kB
-
https://huggingface.co/spaces/EvilElves/chronos-world/resolve/main/test_quant.html
- Command line
-
hf download hf://spaces/EvilElves/chronos-world/test_quant.html
-
curl -L -o test_quant.html https://huggingface.co/spaces/EvilElves/chronos-world/resolve/main/test_quant.html
17.8 kB
| <html lang="ru"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>CHRONOS // Квантовый Модуль Оценки Рисков & Тепловая Матрица</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400&family=Orbitron:wght@600;800;900&display=swap" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --bg: #020612; | |
| --panel-bg: rgba(6, 12, 28, 0.94); | |
| --panel-border: rgba(0, 240, 255, 0.25); | |
| --card-bg: rgba(10, 20, 42, 0.85); | |
| --card-border: rgba(0, 240, 255, 0.15); | |
| --neon-cyan: #00f0ff; | |
| --neon-pink: #ff0055; | |
| --neon-green: #39ff14; | |
| --neon-orange: #ffaa00; | |
| --neon-purple: #bd00ff; | |
| --text-dim: #7f99b8; | |
| --text-main: #e2f1ff; | |
| --font-mono: 'JetBrains Mono', monospace; | |
| --font-display: 'Orbitron', sans-serif; | |
| } | |
| * { box-sizing: border-box; margin: 0; padding: 0; } | |
| body { | |
| background: var(--bg); | |
| color: var(--text-main); | |
| font-family: var(--font-mono); | |
| min-height: 100vh; | |
| padding: 24px; | |
| overflow-x: hidden; | |
| background-image: | |
| radial-gradient(circle at 10% 20%, rgba(0, 240, 255, 0.05) 0%, transparent 40%), | |
| radial-gradient(circle at 90% 80%, rgba(255, 0, 85, 0.04) 0%, transparent 40%); | |
| } | |
| /* Header */ | |
| .quant-header { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| padding: 16px 24px; | |
| background: var(--panel-bg); | |
| border: 1px solid var(--panel-border); | |
| border-radius: 12px; | |
| margin-bottom: 24px; | |
| box-shadow: 0 0 35px rgba(0, 240, 255, 0.12); | |
| flex-wrap: wrap; | |
| gap: 16px; | |
| } | |
| .brand { display: flex; align-items: center; gap: 14px; } | |
| .brand-logo { | |
| width: 14px; | |
| height: 14px; | |
| background: var(--neon-cyan); | |
| box-shadow: 0 0 16px var(--neon-cyan); | |
| border-radius: 3px; | |
| animation: pulse-glow 2.5s infinite alternate; | |
| } | |
| @keyframes pulse-glow { 0% { opacity: 0.5; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1.2); } } | |
| .brand-title { | |
| font-family: var(--font-display); | |
| font-size: 1.25rem; | |
| font-weight: 900; | |
| letter-spacing: 2px; | |
| color: #fff; | |
| } | |
| .brand-sub { | |
| font-size: 0.72rem; | |
| color: var(--neon-cyan); | |
| letter-spacing: 1px; | |
| } | |
| .controls-panel { | |
| display: flex; | |
| gap: 10px; | |
| align-items: center; | |
| flex-wrap: wrap; | |
| } | |
| .btn-action { | |
| background: rgba(0, 240, 255, 0.08); | |
| border: 1px solid var(--neon-cyan); | |
| color: var(--neon-cyan); | |
| font-family: var(--font-mono); | |
| font-size: 0.75rem; | |
| font-weight: 700; | |
| padding: 8px 14px; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| } | |
| .btn-action:hover { | |
| background: var(--neon-cyan); | |
| color: #000; | |
| box-shadow: 0 0 16px rgba(0, 240, 255, 0.4); | |
| } | |
| .btn-action.active { | |
| background: var(--neon-cyan); | |
| color: #000; | |
| } | |
| /* Main Grid Layout */ | |
| .quant-grid { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 24px; | |
| margin-bottom: 24px; | |
| } | |
| @media (max-width: 1080px) { | |
| .quant-grid { grid-template-columns: 1fr; } | |
| } | |
| /* Glass Panels */ | |
| .panel { | |
| background: var(--panel-bg); | |
| border: 1px solid var(--panel-border); | |
| border-radius: 12px; | |
| padding: 20px; | |
| box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); | |
| } | |
| .panel-title { | |
| font-family: var(--font-display); | |
| font-size: 0.95rem; | |
| font-weight: 800; | |
| color: #fff; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| margin-bottom: 16px; | |
| border-bottom: 1px solid rgba(0, 240, 255, 0.15); | |
| padding-bottom: 10px; | |
| } | |
| /* Asset Risk Cards */ | |
| .assets-card-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); | |
| gap: 14px; | |
| } | |
| .asset-card { | |
| background: var(--card-bg); | |
| border: 1px solid var(--card-border); | |
| border-radius: 8px; | |
| padding: 14px; | |
| transition: transform 0.2s, border-color 0.2s; | |
| } | |
| .asset-card:hover { | |
| transform: translateY(-2px); | |
| border-color: var(--neon-cyan); | |
| } | |
| .asset-card-head { | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: flex-start; | |
| margin-bottom: 8px; | |
| } | |
| .asset-name { font-weight: 700; color: #fff; font-size: 0.85rem; } | |
| .asset-symbol { font-size: 0.68rem; color: var(--text-dim); } | |
| .asset-price { font-family: var(--font-display); font-size: 1.1rem; color: var(--neon-green); font-weight: 800; } | |
| .risk-metrics-row { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 8px; | |
| margin: 10px 0; | |
| font-size: 0.72rem; | |
| } | |
| .metric-pill { | |
| background: rgba(0, 240, 255, 0.05); | |
| border: 1px solid rgba(0, 240, 255, 0.15); | |
| padding: 6px 8px; | |
| border-radius: 4px; | |
| } | |
| .metric-pill span { color: var(--text-dim); display: block; font-size: 0.62rem; margin-bottom: 2px; } | |
| .metric-pill b { color: #fff; font-size: 0.75rem; } | |
| .timesfm-corridor { | |
| background: rgba(255, 170, 0, 0.05); | |
| border: 1px solid rgba(255, 170, 0, 0.2); | |
| border-radius: 6px; | |
| padding: 8px; | |
| font-size: 0.70rem; | |
| margin-top: 8px; | |
| } | |
| .corridor-bar { | |
| display: flex; | |
| justify-content: space-between; | |
| font-size: 0.65rem; | |
| color: var(--neon-orange); | |
| margin-top: 4px; | |
| font-weight: 700; | |
| } | |
| /* Heatmap styling */ | |
| .heatmap-cell { | |
| cursor: pointer; | |
| user-select: none; | |
| } | |
| .heatmap-cell:hover { | |
| box-shadow: inset 0 0 10px #fff; | |
| } | |
| /* Intelligence detail card */ | |
| .intel-inspector { | |
| background: rgba(0, 240, 255, 0.04); | |
| border: 1px solid var(--neon-cyan); | |
| border-radius: 8px; | |
| padding: 14px; | |
| margin-top: 16px; | |
| } | |
| .intel-inspector-title { | |
| font-family: var(--font-display); | |
| font-size: 0.85rem; | |
| color: var(--neon-cyan); | |
| margin-bottom: 6px; | |
| } | |
| /* Scenario Bar */ | |
| .scenario-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); | |
| gap: 12px; | |
| margin-top: 12px; | |
| } | |
| .scenario-btn { | |
| background: rgba(10, 20, 42, 0.9); | |
| border: 1px solid rgba(255, 170, 0, 0.3); | |
| padding: 12px; | |
| border-radius: 8px; | |
| color: #fff; | |
| font-family: var(--font-mono); | |
| font-size: 0.72rem; | |
| cursor: pointer; | |
| text-align: left; | |
| transition: all 0.2s; | |
| } | |
| .scenario-btn:hover { | |
| border-color: var(--neon-orange); | |
| box-shadow: 0 0 16px rgba(255, 170, 0, 0.25); | |
| } | |
| .scenario-btn b { color: var(--neon-orange); display: block; margin-bottom: 4px; } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- Top Header --> | |
| <header class="quant-header"> | |
| <div class="brand"> | |
| <div class="brand-logo"></div> | |
| <div> | |
| <div class="brand-title">CHRONOS // QUANT RISK & ASYMMETRY</div> | |
| <div class="brand-sub">TIMESFM DOWN-TAIL RISK ENGINE & INTERACTIVE HEATMAP v2.0</div> | |
| </div> | |
| </div> | |
| <div class="controls-panel"> | |
| <button class="btn-action active" id="btnConf95" onclick="setConfidence(0.95)">VaR 95%</button> | |
| <button class="btn-action" id="btnConf99" onclick="setConfidence(0.99)">VaR 99%</button> | |
| <button class="btn-action" onclick="recalculateAll()">🔄 ПЕРЕСЧИТАТЬ</button> | |
| <button class="btn-action" onclick="exportQuantJSON()">💾 JSON</button> | |
| </div> | |
| </header> | |
| <!-- Macro Scenarios Bar --> | |
| <section class="panel" style="margin-bottom: 24px;"> | |
| <div class="panel-title"> | |
| <span>⚡ МАКРО-КВАНТОВЫЙ СТРЕСС-ТЕСТЕР (ТАЙЛ-ШОКИ)</span> | |
| <span style="font-size: 0.7rem; color: var(--neon-orange);">МЕТОДОЛОГИЯ TIMESFM</span> | |
| </div> | |
| <div style="font-size: 0.75rem; color: var(--text-dim); margin-bottom: 12px;"> | |
| Активируйте экзогенные геополитические или геомагнитные сценарии для симуляции смещения хвостовой асимметрии и межрыночной ковариации: | |
| </div> | |
| <div class="scenario-grid"> | |
| <button class="scenario-btn" onclick="applyScenario('hormuz')"> | |
| <b>🚨 Ормузский пролив (Шок нефти)</b> | |
| Brent +35%, Золото +14%, DXY +3%, Акции ИИ -12% | |
| </button> | |
| <button class="scenario-btn" onclick="applyScenario('solar')"> | |
| <b>☀️ Геомагнитный супершторм Kp=9.0</b> | |
| Kp 9.0 (G5), Акции ИИ -22%, Золото +18%, Нефть +6% | |
| </button> | |
| <button class="scenario-btn" onclick="applyScenario('uranium')"> | |
| <b>⚛️ Ядерный ренессанс & Датацентры</b> | |
| Уран +45%, Акции ИИ +28%, Нефть -4%, DXY -2% | |
| </button> | |
| <button class="scenario-btn" onclick="applyScenario('reset')"> | |
| <b>🔄 Базовый квантовый режим</b> | |
| Восстановление реальных рыночных котировок | |
| </button> | |
| </div> | |
| </section> | |
| <!-- Main 2-Column Dashboard --> | |
| <div class="quant-grid"> | |
| <!-- Left Column: Interactive Heatmap --> | |
| <div class="panel"> | |
| <div class="panel-title"> | |
| <span>🔥 ТЕПЛОВАЯ МАТРИЦА КОРРЕЛЯЦИЙ (6x6)</span> | |
| <span style="font-size: 0.7rem; color: var(--neon-cyan);">КОЭФФИЦИЕНТ ПИРСОНА (r)</span> | |
| </div> | |
| <div style="font-size: 0.72rem; color: var(--text-dim); margin-bottom: 12px;"> | |
| Цветовая шкала: <span style="color: var(--neon-cyan);">Голубой [-1.0]</span> (Инверсный хедж) • <span style="color: #667;">Темный [0.0]</span> (Ортогонально) • <span style="color: var(--neon-orange);">Оранжево-красный [+1.0]</span> (Синхронный риск). Кликните по ячейке для инспекции. | |
| </div> | |
| <div id="heatmapContainer"></div> | |
| <!-- Cell Intelligence Inspector --> | |
| <div class="intel-inspector" id="intelInspectorBox"> | |
| <div class="intel-inspector-title" id="intelTitle">Инспекция межрыночной связи</div> | |
| <div style="font-size: 0.78rem; color: var(--text-main); line-height: 1.4;" id="intelText"> | |
| Выберите ячейку в матрице для детального анализа механизма ковариации. | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Right Column: Asset Risk Profiles --> | |
| <div class="panel"> | |
| <div class="panel-title"> | |
| <span>📊 ПРОФИЛИ РИСКА & ХВОСТОВАЯ АСИММЕТРИЯ</span> | |
| <span style="font-size: 0.7rem; color: var(--neon-green);" id="liveStatusBadge">РЕЖИМ: ОНЛАЙН</span> | |
| </div> | |
| <div class="assets-card-grid" id="assetsGridContainer"> | |
| <!-- Rendered dynamically --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Load Quant Engine Script --> | |
| <script src="quant_risk_engine.js"></script> | |
| <script> | |
| let currentConfidence = 0.95; | |
| let customPriceOverrides = {}; | |
| let latestDossier = null; | |
| function setConfidence(conf) { | |
| currentConfidence = conf; | |
| document.getElementById('btnConf95').classList.toggle('active', conf === 0.95); | |
| document.getElementById('btnConf99').classList.toggle('active', conf === 0.99); | |
| recalculateAll(); | |
| } | |
| function recalculateAll() { | |
| if (!window.QuantRiskEngine) { | |
| console.error('QuantRiskEngine not found'); | |
| return; | |
| } | |
| latestDossier = window.QuantRiskEngine.generateFullQuantDossier(customPriceOverrides); | |
| renderAssetsCards(latestDossier); | |
| renderHeatmap(latestDossier); | |
| } | |
| function renderAssetsCards(dossier) { | |
| const container = document.getElementById('assetsGridContainer'); | |
| container.innerHTML = ''; | |
| dossier.assetDossiers.forEach(item => { | |
| const a = item.asset; | |
| const tf = item.timesFM; | |
| const card = document.createElement('div'); | |
| card.className = 'asset-card'; | |
| card.innerHTML = ` | |
| <div class="asset-card-head"> | |
| <div> | |
| <div class="asset-name">${a.name}</div> | |
| <div class="asset-symbol">${a.symbol} • ${a.category}</div> | |
| </div> | |
| <div class="asset-price">${item.currentPrice} <span style="font-size: 0.65rem; color: var(--text-dim);">${a.unit}</span></div> | |
| </div> | |
| <div class="risk-metrics-row"> | |
| <div class="metric-pill"> | |
| <span>ИСТ. ВОЛАТИЛЬНОСТЬ 30D</span> | |
| <b style="color: ${item.volatility30D > 40 ? 'var(--neon-pink)' : (item.volatility30D > 25 ? 'var(--neon-orange)' : 'var(--neon-green)')}"> | |
| ${item.volatility30D}% | |
| </b> | |
| </div> | |
| <div class="metric-pill"> | |
| <span>VaR (${(currentConfidence * 100).toFixed(0)}% CF 1D)</span> | |
| <b style="color: var(--neon-pink);">-${item.var95_1D_pct}%</b> | |
| </div> | |
| <div class="metric-pill"> | |
| <span>10-ДНЕВНЫЙ VaR</span> | |
| <b>-${item.var95_10D_pct}%</b> | |
| </div> | |
| <div class="metric-pill"> | |
| <span>EXPECTED SHORTFALL (CVaR)</span> | |
| <b style="color: var(--neon-orange);">-${item.cvar95_1D_pct}%</b> | |
| </div> | |
| </div> | |
| <div class="timesfm-corridor"> | |
| <div style="display: flex; justify-content: space-between;"> | |
| <span>TIMESFM 7D КОРИДОР:</span> | |
| <span style="color: ${tf.riskColor}; font-weight: 700;">${tf.riskCategory}</span> | |
| </div> | |
| <div class="corridor-bar"> | |
| <span>Q10: $${tf.q10_supportFloor}</span> | |
| <span>Q50: $${tf.q50_median}</span> | |
| <span>Q90: $${tf.q90_breakout}</span> | |
| </div> | |
| <div style="font-size: 0.65rem; color: var(--text-dim); margin-top: 4px; display: flex; justify-content: space-between;"> | |
| <span>Асимметрия: <b style="color: #fff;">${tf.asymmetryRatio}x</b></span> | |
| <span>Индекс угрозы: <b style="color: ${tf.riskColor};">${tf.tailSeverityIndex}/100</b></span> | |
| </div> | |
| </div> | |
| `; | |
| container.appendChild(card); | |
| }); | |
| } | |
| function renderHeatmap(dossier) { | |
| window.QuantRiskEngine.renderCorrelationHeatmap('heatmapContainer', dossier.correlationData, (rel, idA, idB, val) => { | |
| const sign = val > 0 ? '+' : ''; | |
| document.getElementById('intelTitle').innerHTML = `🔗 ${rel.label || idA + ' <-> ' + idB} (r = ${sign}${val.toFixed(2)})`; | |
| document.getElementById('intelText').innerHTML = rel.text; | |
| }); | |
| // Default highlight for Brent <-> DXY | |
| const relInit = window.QuantRiskEngine.CORRELATION_RELATIONSHIPS['BRENT_DXY']; | |
| if (relInit) { | |
| document.getElementById('intelTitle').innerHTML = `🔗 ${relInit.label} (r = ${relInit.corr})`; | |
| document.getElementById('intelText').innerHTML = relInit.text; | |
| } | |
| } | |
| function applyScenario(type) { | |
| if (type === 'hormuz') { | |
| customPriceOverrides = { | |
| 'BRENT': 132.80, | |
| 'DXY': 104.40, | |
| 'AI_EQUITIES': 109.50, | |
| 'GOLD': 3095.00, | |
| 'URANIUM': 122.50, | |
| 'NOAA_KP': 2.80 | |
| }; | |
| document.getElementById('liveStatusBadge').innerHTML = '⚠️ СЦЕНАРИЙ: ОРМУЗСКИЙ КРИЗИС'; | |
| document.getElementById('liveStatusBadge').style.color = 'var(--neon-pink)'; | |
| } else if (type === 'solar') { | |
| customPriceOverrides = { | |
| 'BRENT': 104.30, | |
| 'DXY': 101.50, | |
| 'AI_EQUITIES': 97.10, | |
| 'GOLD': 3200.00, | |
| 'URANIUM': 101.20, | |
| 'NOAA_KP': 9.00 | |
| }; | |
| document.getElementById('liveStatusBadge').innerHTML = '☀️ СЦЕНАРИЙ: ГЕОМАГНИТНЫЙ СУПЕРШТОРМ Kp=9.0'; | |
| document.getElementById('liveStatusBadge').style.color = 'var(--neon-pink)'; | |
| } else if (type === 'uranium') { | |
| customPriceOverrides = { | |
| 'BRENT': 94.50, | |
| 'DXY': 99.30, | |
| 'AI_EQUITIES': 159.40, | |
| 'GOLD': 2880.00, | |
| 'URANIUM': 154.40, | |
| 'NOAA_KP': 1.50 | |
| }; | |
| document.getElementById('liveStatusBadge').innerHTML = '⚛️ СЦЕНАРИЙ: ЯДЕРНЫЙ РЕНЕССАНС'; | |
| document.getElementById('liveStatusBadge').style.color = 'var(--neon-green)'; | |
| } else { | |
| customPriceOverrides = {}; | |
| document.getElementById('liveStatusBadge').innerHTML = 'РЕЖИМ: ОНЛАЙН'; | |
| document.getElementById('liveStatusBadge').style.color = 'var(--neon-green)'; | |
| } | |
| recalculateAll(); | |
| } | |
| function exportQuantJSON() { | |
| if (!latestDossier) return; | |
| const jsonStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(latestDossier, null, 2)); | |
| const a = document.createElement('a'); | |
| a.setAttribute("href", jsonStr); | |
| a.setAttribute("download", "chronos_quant_risk_matrix.json"); | |
| document.body.appendChild(a); | |
| a.click(); | |
| a.remove(); | |
| } | |
| window.addEventListener('load', () => { | |
| recalculateAll(); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |