blind-monkeys / static /index.html
deanpowers's picture
Sync workspace source: rank tracker module + routes, Grid DB admin page, flaskfactory AI probe + analytics zone, nav.js v16 Blog pill, template refresh
c8c30b4
Raw History Blame Contribute Delete
20.2 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blind Monkeys</title>
<link rel="stylesheet" href="/css/nav.css?v=4">
<style>
* { box-sizing: border-box; }
body { background: #0d1117; color: #e6edf3; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; margin: 0; }
.home-wrap { width: 90vw; max-width: 1600px; margin: 24px auto 40px; }
/* ---------- 4-card row ---------- */
.cards-row {
display: grid;
grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
gap: 16px;
margin-bottom: 24px;
}
@media (max-width: 1100px) { .cards-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .cards-row { grid-template-columns: 1fr; } }
.card {
background: #1e2329;
border: 2px solid #30363d;
border-radius: 12px;
padding: 16px 18px;
display: flex;
flex-direction: column;
min-height: 150px;
}
.card-title {
font-size: 11px;
font-weight: 700;
letter-spacing: 1px;
text-transform: uppercase;
color: #f0b90b;
margin-bottom: 8px;
}
.card-value {
font-size: 26px;
font-weight: 700;
font-family: 'SF Mono', Monaco, monospace;
color: #e6edf3;
line-height: 1.1;
}
.card-sub { font-size: 12px; color: #8b949e; margin-top: 4px; }
.sparkline { margin-top: auto; width: 100%; height: 44px; display: block; }
.gauge { width: 100%; max-width: 170px; height: auto; display: block; margin: 4px auto 2px; }
#regime-fng-needle, #regime-vix-needle { transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.fng-greed { color: #4ade80 !important; }
.fng-neutral { color: #f0b90b !important; }
.fng-fear { color: #f87171 !important; }
/* ---------- Market data card ---------- */
.market-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.market-row { display: flex; justify-content: space-between; align-items: center; font-family: 'SF Mono', Monaco, monospace; font-size: 13px; padding: 3px 0; }
.market-row .sym { color: #8b949e; font-weight: 700; }
.market-row .px { color: #e6edf3; }
.market-ts { font-size: 11px; color: #8b949e; margin-top: 8px; }
/* ---------- Diagnostic ---------- */
.diag-section { background: #1e2329; border: 2px solid #30363d; border-radius: 12px; padding: 20px; }
.diag-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.diag-title { font-size: 18px; font-weight: 700; color: #f0b90b; margin: 0; }
.diag-sub { font-size: 12px; color: #8b949e; margin-top: 2px; }
.diag-controls { display: flex; gap: 10px; align-items: center; }
.diag-controls select, .diag-controls button {
background: #0d1117; color: #e6edf3; border: 1px solid #30363d; border-radius: 8px;
padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
font-family: inherit;
}
.diag-controls select:focus, .diag-controls button:focus { outline: none; border-color: #f0b90b; }
.diag-controls button:hover { border-color: #f0b90b; color: #f0b90b; }
.diag-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
.diag-table { width: 100%; border-collapse: collapse; }
.diag-table th { text-align: right; padding: 10px 8px; color: #8b949e; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #30363d; white-space: nowrap; }
.diag-table th:first-child, .diag-table th:nth-child(2) { text-align: left; }
.diag-table td { padding: 10px 8px; border-bottom: 1px solid #21262d; font-size: 13px; font-family: 'SF Mono', Monaco, monospace; text-align: right; white-space: nowrap; }
.diag-table td:first-child, .diag-table td:nth-child(2) { text-align: left; }
.diag-table tr:last-child td { border-bottom: none; }
.diag-table .sym { color: #e6edf3; font-weight: 700; }
.diag-table .invest { color: #f0b90b; }
.diag-table .tp { color: #4ade80; }
.diag-table .sl { color: #f87171; }
.diag-table .empty { color: #8b949e; }
.signals-cell { font-size: 11px; line-height: 1.6; color: #8b949e; text-align: left; }
.signals-cell .pass { color: #4ade80; }
.signals-cell .fail { color: #f87171; }
.diag-note { font-size: 12px; color: #8b949e; margin-top: 12px; }
.diag-empty { text-align: center; padding: 32px 0; color: #8b949e; }
.diag-toggle { display: flex; gap: 6px; }
.diag-toggle button {
padding: 8px 16px;
border-radius: 8px;
font-size: 13px;
font-weight: 700;
cursor: pointer;
background: #0d1117;
border: 1px solid #30363d;
color: #8b949e;
font-family: inherit;
}
.diag-toggle button.active {
background: #3a2a1a;
border-color: #f0b90b;
color: #f0b90b;
}
.diag-toggle button.risk.active {
background: #3a1a1a;
border-color: #f87171;
color: #f87171;
}
#market-ts { display: none !important; }
</style>
<script defer src="https://analytics.zojax.com/em.js" data-domain="portfolio-agent-public-388170800364.us-central1.run.app"></script>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
</head>
<body>
<nav class="nav-bar">
<a href="/" class="nav-brand">🙈 Blind Monkeys</a>
<div class="nav-links">
<a href="/scan/" class="nav-link">🔍 Scan</a>
<a href="/positions/" class="nav-link">💼 Positions</a>
<a href="/portfolio/" class="nav-link">💼 Portfolio</a>
<a href="/settings/" class="nav-link">⚙️ Settings</a>
</div>
</nav>
<div class="home-wrap">
<div class="cards-row">
<div class="card" id="card-treasury">
<div class="card-title">10Y Treasury Yield</div>
<div class="card-value" id="treasury-value">—</div>
<div class="card-sub" id="treasury-sub">Loading…</div>
<svg class="sparkline" id="treasury-spark" viewBox="0 0 400 44" preserveAspectRatio="none"></svg>
</div>
<div class="card" id="card-fng">
<div class="card-title">Fear &amp; Greed</div>
<svg class="gauge" viewBox="0 0 200 118">
<defs>
<linearGradient id="grad-fng" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#4ade80"/>
<stop offset="50%" stop-color="#f0b90b"/>
<stop offset="100%" stop-color="#f87171"/>
</linearGradient>
</defs>
<path d="M 20 100 A 80 80 0 0 1 180 100" stroke="#30363d" stroke-width="14" fill="none" stroke-linecap="round"/>
<path d="M 20 100 A 80 80 0 0 1 180 100" stroke="url(#grad-fng)" stroke-width="14" fill="none" stroke-linecap="round" opacity="0.4"/>
<line id="regime-fng-needle" x1="100" y1="100" x2="100" y2="30" stroke="#e6edf3" stroke-width="3" stroke-linecap="round"/>
<circle cx="100" cy="100" r="6" fill="#e6edf3"/>
</svg>
<div class="card-value" id="fng-value">—</div>
<div class="card-sub" id="fng-sub">Loading…</div>
</div>
<div class="card" id="card-vix">
<div class="card-title">VIX</div>
<svg class="gauge" viewBox="0 0 200 118">
<defs>
<linearGradient id="grad-vix" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#4ade80"/>
<stop offset="50%" stop-color="#f0b90b"/>
<stop offset="100%" stop-color="#f87171"/>
</linearGradient>
</defs>
<path d="M 20 100 A 80 80 0 0 1 180 100" stroke="#30363d" stroke-width="14" fill="none" stroke-linecap="round"/>
<path d="M 20 100 A 80 80 0 0 1 180 100" stroke="url(#grad-vix)" stroke-width="14" fill="none" stroke-linecap="round" opacity="0.4"/>
<line id="regime-vix-needle" x1="100" y1="100" x2="100" y2="30" stroke="#e6edf3" stroke-width="3" stroke-linecap="round"/>
<circle cx="100" cy="100" r="6" fill="#e6edf3"/>
</svg>
<div class="card-value" id="vix-value">—</div>
<div class="card-sub" id="vix-sub">Loading…</div>
</div>
<div class="card" id="card-market">
<div class="card-title">Market Data</div>
<div style="display:flex;gap:8px;font-size:9px;color:#8b949e;letter-spacing:0.5px;margin-bottom:6px;text-transform:uppercase;">
<span style="min-width:50px;">Coin</span>
<span style="flex:1;text-align:right;">Price</span>
<span style="min-width:100px;text-align:right;">24 Hour Change</span>
<span style="width:14px;"></span>
</div>
<div class="market-list" id="market-list"></div>
<div style="display:flex;gap:6px;margin-top:10px;">
<input id="market-add-input" type="text" placeholder="Add symbol (e.g. DOGE)" maxlength="10" style="flex:1;padding:8px 10px;background:#0d1117;border:1px solid #30363d;border-radius:6px;color:#e6edf3;font-size:13px;text-transform:uppercase;">
<button id="market-add-btn" style="padding:8px 14px;background:#0d1117;color:#f0b90b;border:1px solid #f0b90b;border-radius:6px;font-size:13px;font-weight:600;cursor:pointer;">Add</button>
</div>
<div class="market-ts" id="market-ts">Loading…</div>
</div>
</div>
<div class="diag-section">
<div class="diag-header">
<div>
<h2 class="diag-title">📊 Coin Scan and Analysis</h2>
</div>
<div class="diag-controls">
<div class="diag-toggle">
<button class="active" data-mode="conservative" onclick="setDiagMode('conservative')">🛡️ Conservative</button>
<button class="risk" data-mode="risk" onclick="setDiagMode('risk')">🎲 Risk Taker</button>
</div>
<button id="refresh-btn">🔄 Refresh</button>
</div>
</div>
<div id="diag-content"><div class="diag-empty">Loading diagnostic…</div></div>
</div>
</div>
<script>
// ---------- Sparkline ----------
function sparklinePath(points, w, h) {
if (!points || points.length < 2) return '';
var vals = points.map(function(p){ return p[1]; });
var min = Math.min.apply(null, vals);
var max = Math.max.apply(null, vals);
var range = max - min || 0.001;
var stepX = w / (points.length - 1);
var pad = 3, usableH = h - pad * 2, d = '';
for (var i = 0; i < points.length; i++) {
var x = i * stepX;
var y = pad + (1 - (points[i][1] - min) / range) * usableH;
d += (i === 0 ? 'M' : 'L') + x.toFixed(1) + ',' + y.toFixed(1);
}
return d;
}
// ---------- Gauge ----------
function setGauge(needleId, value) {
var angle = (Math.max(0, Math.min(100, value)) - 50) * 1.8;
var el = document.getElementById(needleId);
if (el) el.setAttribute('transform', 'rotate(' + angle.toFixed(2) + ' 100 100)');
}
function fngClass(v) {
if (v >= 55) return 'fng-greed';
if (v >= 45) return 'fng-neutral';
return 'fng-fear';
}
function vixLabel(v) {
if (v == null) return '';
if (v < 15) return 'Low volatility';
if (v < 20) return 'Normal range';
if (v < 30) return 'Elevated — caution';
return 'Panic — high fear';
}
function fmtMoney(n) {
var parts = Math.abs(n).toFixed(2).split('.');
return (n < 0 ? '-' : '') + parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',') + '.' + parts[1];
}
function fmtPrice(n) {
if (n == null || isNaN(n)) return '—';
return '$' + Number(n).toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 6});
}
// ---------- Regime panel ----------
function loadRegimePanel() {
fetch('/api/regime-panel')
.then(function(r){ return r.json(); })
.then(function(d){
var t = d.treasury;
if (t && t.series && t.series.length) {
var series = t.series.slice(-365);
document.getElementById('treasury-value').textContent = t.current.toFixed(2) + '%';
document.getElementById('treasury-sub').textContent = 'as of ' + t.date;
var path = sparklinePath(series, 400, 44);
var vals = series.map(function(p){ return p[1]; });
var min = Math.min.apply(null, vals), max = Math.max.apply(null, vals);
var range = max - min || 0.001;
var lastY = 3 + (1 - (series[series.length-1][1] - min) / range) * (44 - 6);
document.getElementById('treasury-spark').innerHTML =
'<path d="' + path + '" fill="none" stroke="#f0b90b" stroke-width="1.5" vector-effect="non-scaling-stroke"/>' +
'<circle cx="400" cy="' + lastY.toFixed(1) + '" r="3" fill="#f0b90b"/>';
} else {
document.getElementById('treasury-value').textContent = 'n/a';
document.getElementById('treasury-sub').textContent = 'unavailable';
}
var f = d.fear_greed;
if (f) {
var fv = document.getElementById('fng-value');
fv.textContent = f.value;
fv.className = 'card-value ' + fngClass(f.value);
document.getElementById('fng-sub').textContent = f.classification;
setGauge('regime-fng-needle', f.value);
} else {
document.getElementById('fng-value').textContent = 'n/a';
document.getElementById('fng-sub').textContent = 'unavailable';
}
var v = d.vix;
if (v) {
document.getElementById('vix-value').textContent = v.value.toFixed(2);
document.getElementById('vix-sub').textContent = vixLabel(v.value) + ' · ' + v.date;
setGauge('regime-vix-needle', v.value);
} else {
document.getElementById('vix-value').textContent = 'n/a';
document.getElementById('vix-sub').textContent = 'unavailable';
}
})
.catch(function(e){ console.warn('regime failed:', e); });
}
// ---------- Diagnostic ----------
var DIAG_COINS = [];
// ---------- Diagnostic mode ----------
window.DIAG_MODE = 'conservative';
function setDiagMode(mode) {
window.DIAG_MODE = mode;
document.querySelectorAll('.diag-toggle button').forEach(function(b) {
b.classList.toggle('active', b.dataset.mode === mode);
});
loadDiagnostic();
}
window.setDiagMode = setDiagMode;
function renderDiagnostic() {
var el = document.getElementById('diag-content');
if (!DIAG_COINS.length) {
el.innerHTML = '<div class="diag-empty">No data yet — click Refresh.</div>';
return;
}
DIAG_COINS = DIAG_COINS.slice().sort(function (a, b) {
return (parseFloat(b.composite_score) || 0) - (parseFloat(a.composite_score) || 0);
});
var html = '<table class="diag-table"><thead><tr>';
html += '<th>#</th><th>Coin</th>';
html += '<th>Z</th><th>Mom</th><th>Vol</th><th>RSI</th><th>Score</th>';
html += '</tr></thead><tbody>';
DIAG_COINS.forEach(function(c, i) {
var z = parseFloat(c.zscore), m = parseFloat(c.momentum), v = parseFloat(c.volatility), r = parseFloat(c.rsi), s = parseFloat(c.composite_score);
html += '<tr>';
html += '<td class="empty">' + (i + 1) + '</td>';
html += '<td class="sym">' + (c.symbol || '?') + '</td>';
html += '<td>' + (isNaN(z) ? '—' : z.toFixed(2)) + '</td>';
html += '<td>' + (isNaN(m) ? '—' : m.toFixed(2)) + '</td>';
html += '<td>' + (isNaN(v) ? '—' : v.toFixed(2)) + '</td>';
html += '<td>' + (isNaN(r) ? '—' : r.toFixed(1)) + '</td>';
html += '<td>' + (isNaN(s) ? '—' : s.toFixed(2)) + '</td>';
html += '</tr>';
});
html += '</tbody></table>';
el.innerHTML = html;
}
function loadDiagnostic() {
var btn = document.getElementById('refresh-btn');
var el = document.getElementById('diag-content');
if (btn) { btn.disabled = true; btn.textContent = '⏳ Loading…'; }
el.innerHTML = '<div class="diag-empty">Loading latest scan…</div>';
fetch('/api/scan/latest?mode=' + (window.DIAG_MODE || 'conservative'))
.then(function(r){ return r.json(); })
.then(function(d){
if (d.error) {
el.innerHTML = '<div class="diag-empty">Error: ' + d.error + '</div>';
return;
}
DIAG_COINS = d.results || [];
renderDiagnostic();
})
.catch(function(e){
el.innerHTML = '<div class="diag-empty">Failed: ' + e.message + '</div>';
})
.finally(function(){
if (btn) { btn.disabled = false; btn.textContent = '🔄 Refresh'; }
});
}
// ---------- Init ----------
document.addEventListener('DOMContentLoaded', function() {
loadRegimePanel();
loadDiagnostic();
var btn = document.getElementById('refresh-btn');
if (btn) btn.addEventListener('click', loadDiagnostic);
});
</script>
<script src="/static/market-panel.js"></script>
<script src="/css/nav.js?v=16"></script>
<style>
.yt-section { width: 90vw; max-width: 1600px; margin: 40px auto 60px; }
.yt-title { color: #f0b90b; font-size: 22px; font-weight: 700; margin: 0 0 20px; }
.yt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); gap: 20px; }
.yt-item { background: #1e2329; border: 1px solid #30363d; border-radius: 12px; overflow: hidden; }
.yt-embed { position: relative; width: 100%; aspect-ratio: 9/16; background: #000; }
.yt-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.yt-caption { padding: 12px 16px; font-size: 14px; color: #e6edf3; line-height: 1.4; }
@media (max-width: 640px) { .yt-section { width: 95vw; } }
</style>
<section class="yt-section">
<div class="yt-head">
<h2 class="yt-title">📺 Recent Videos</h2>
<div id="ytAdminBar" style="display:none;">
<input id="ytInput" type="url" maxlength="200" placeholder="Paste YouTube URL">
<button id="ytAddBtn" class="yt-btn" type="button">Add video</button>
</div>
</div>
<div class="yt-grid" id="ytGrid"></div>
</section>
<style>
.yt-head { display:flex; align-items:center; gap:20px; flex-wrap:wrap; margin-bottom:20px; }
.yt-head .yt-title { margin:0; }
#ytAdminBar { display:flex; gap:8px; align-items:center; }
#ytInput { width:30ch; padding:8px 12px; border-radius:8px; border:1px solid #30363d; background:#1e2329; color:#e6edf3; font-size:14px; }
#ytInput:focus { outline:none; border-color:#f0b90b; }
.yt-btn { background:#f0b90b; color:#0b0e11; border:0; border-radius:8px; padding:8px 16px; font-weight:700; cursor:pointer; font-size:14px; }
.yt-btn:hover { background:#d9a70a; }
.yt-btn:disabled { opacity:0.6; cursor:not-allowed; }
.yt-empty { color:#8b949e; font-style:italic; padding:12px 0; }
</style>
<script src="/videos.js"></script>
<style>
#hsAlertBanner { position:sticky; top:0; z-index:1000; background:#3d1f00; border-bottom:2px solid #f0b90b; padding:10px 16px; display:none; }
#hsAlertBanner .hs-alert-item { display:flex; justify-content:space-between; align-items:center; color:#f0b90b; font-size:14px; padding:4px 0; max-width:1600px; margin:0 auto; }
#hsAlertBanner .hs-dismiss { background:transparent; border:1px solid #f0b90b; fetch color:#f0b90b; border-radius:6px;('/ width:26pxapi; height:26px; cursor:pointer;/al font-size:14px;erts line-height:1; }
#hsAlertB',anner .hs-dismiss:hover { background:#f0b90b; color:#0b0e11; }
</style>
<script src="/static/alerts.js?v=1"></script>
<!--Start of Tawk.to Script-->
<script type="text/javascript">
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/6ad326872ab00434d21793a2/1k54ic9h0';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->
</body>
</html>