Sync workspace source: rank tracker module + routes, Grid DB admin page, flaskfactory AI probe + analytics zone, nav.js v16 Blog pill, template refresh
c8c30b4 Download templates/admin_grid_db.html from deanpowers/blind-monkeys: direct link, hf CLI and curl.
- Browser
- Download file 9.3 kB
-
https://huggingface.co/deanpowers/blind-monkeys/resolve/main/templates/admin_grid_db.html
- Command line
-
hf download hf://deanpowers/blind-monkeys/templates/admin_grid_db.html
-
curl -L -o admin_grid_db.html https://huggingface.co/deanpowers/blind-monkeys/resolve/main/templates/admin_grid_db.html
9.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Grid DB — Admin — 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; } | |
| .page-content { max-width: 1000px; margin: 0 auto; padding: 32px 20px; } | |
| h1 { font-size: 24px; margin: 0 0 4px; } | |
| .sub { color: #8b949e; font-size: 14px; margin-bottom: 24px; } | |
| h2 { font-size: 18px; color: #58a6ff; margin: 26px 0 10px; } | |
| .card { background: #1e2329; border: 2px solid #30363d; border-radius: 12px; padding: 18px 20px; } | |
| table { width: 100%; border-collapse: collapse; font-size: 13.5px; } | |
| th { text-align: left; color: #8b949e; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 7px 10px 7px 0; border-bottom: 1px solid #30363d; } | |
| td { padding: 7px 10px 7px 0; border-bottom: 1px solid #262c33; white-space: nowrap; } | |
| tr:last-child td { border-bottom: none; } | |
| .num { text-align: right; } | |
| th.num { text-align: right; } | |
| .pos { color: #3fb950; } | |
| .neg { color: #f85149; } | |
| .gold { color: #f0b90b; font-weight: 700; } | |
| .summary { color: #8b949e; font-size: 13px; margin-top: 10px; } | |
| .scrollx { overflow-x: auto; } | |
| .weights { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; } | |
| .wbox { flex: 1; min-width: 130px; background: #0d1117; border: 1px solid #30363d; border-radius: 10px; padding: 12px 14px; } | |
| .wbox .wl { color: #8b949e; font-size: 12px; margin-bottom: 4px; } | |
| .wbox .wv { color: #f0b90b; font-size: 22px; font-weight: 700; } | |
| </style> | |
| <link rel="icon" type="image/svg+xml" href="/static/favicon.svg"> | |
| </head> | |
| <body> | |
| <nav class="nav-bar"> | |
| <div class="nav-brand">🙈 Blind Monkeys</div> | |
| <div class="nav-links"> | |
| <a href="/settings/" class="nav-link">⚙️ Settings</a> | |
| <a href="/profile/" class="nav-link">👤 Profile</a> | |
| <a href="/logout" class="nav-link">🚪 Logout</a> | |
| </div> | |
| </nav> | |
| <div class="page-content"> | |
| <div class="breadcrumbs"><a href="/">Home</a><span class="bc-sep">›</span><a href="/admin">Admin</a><span class="bc-sep">›</span><span class="bc-current">Grid DB</span></div> | |
| <h1>🗄️ Grid DB</h1> | |
| <p class="sub">The grid system's database — live bots, the archive, and the learned score weights. Data from the scanner/trader services, cached on this page's APIs.</p> | |
| <h2>Active Grid Bots</h2> | |
| <div class="card"> | |
| <div class="scrollx"><table id="active-tbl"> | |
| <tr><th>Symbol</th><th>Opened</th><th class="num">Invested</th><th class="num">Grid Profit</th><th class="num">P&L</th><th class="num">Last Price</th><th class="num">Lev</th><th>Status</th></tr> | |
| </table></div> | |
| <div class="summary" id="active-sum">Loading…</div> | |
| </div> | |
| <h2>Archived Grid Bots</h2> | |
| <div class="card"> | |
| <div class="scrollx"><table id="arch-tbl"> | |
| <tr><th>Symbol</th><th>Archived</th><th class="num">Invested</th><th class="num">Grid Profit</th><th class="num">P&L</th><th>Status</th></tr> | |
| </table></div> | |
| <div class="summary" id="arch-sum">Loading…</div> | |
| </div> | |
| <h2>Learned Score Weights</h2> | |
| <div class="card"> | |
| <div class="weights" id="w-now"><div class="wl" style="color:#8b949e;font-size:13px;">Loading…</div></div> | |
| <div class="summary" style="margin-bottom:10px;" id="w-note"></div> | |
| <div class="scrollx"><table id="w-tbl"> | |
| <tr><th>Date</th><th class="num">Osc</th><th class="num">ADX</th><th class="num">Drift</th><th class="num">24h</th></tr> | |
| </table></div> | |
| </div> | |
| </div> | |
| <script src="/css/nav.js?v=16"></script> | |
| <script> | |
| function money(v, sign) { | |
| var n = parseFloat(v); | |
| if (isNaN(n)) return '—'; | |
| var s = '$' + Math.abs(n).toFixed(2); | |
| if (sign && n > 0) return '+' + s; | |
| if (n < 0) return '−' + s; | |
| return s; | |
| } | |
| function cls(v) { | |
| var n = parseFloat(v); | |
| if (isNaN(n) || n === 0) return ''; | |
| return n > 0 ? 'pos' : 'neg'; | |
| } | |
| function dt(ms) { | |
| if (!ms) return '—'; | |
| var d = new Date(Number(ms)); | |
| return d.toISOString().slice(0, 10); | |
| } | |
| fetch('/api/grid-bots').then(function (r) { return r.json(); }).then(function (bots) { | |
| var tbl = document.getElementById('active-tbl'); | |
| var sum = document.getElementById('active-sum'); | |
| if (!Array.isArray(bots)) { sum.textContent = 'Error loading active bots.'; return; } | |
| var totInv = 0, totPnl = 0, totGp = 0; | |
| bots.forEach(function (b) { | |
| var inv = parseFloat(b.invested) || 0; | |
| var pnl = parseFloat(b.pnl) || 0; | |
| var gp = parseFloat(b.grid_profit) || 0; | |
| totInv += inv; totPnl += pnl; totGp += gp; | |
| var tr = document.createElement('tr'); | |
| tr.innerHTML = '<td><a href="https://charts.blindmonkeys.org/grid/bot?bot_id=' + encodeURIComponent(b.bot_id || '') + | |
| '" style="color:#f0b90b;text-decoration:none;">' + (b.symbol || '—') + '</a></td>' + | |
| '<td>' + dt(b.opened_ms) + '</td>' + | |
| '<td class="num">' + money(inv) + '</td>' + | |
| '<td class="num pos">' + money(gp) + '</td>' + | |
| '<td class="num ' + cls(pnl) + '">' + money(pnl, true) + '</td>' + | |
| '<td class="num">' + (b.last_price || '—') + '</td>' + | |
| '<td class="num">' + (b.leverage || '—') + 'x</td>' + | |
| '<td>' + (b.status_label || '—') + '</td>'; | |
| tbl.appendChild(tr); | |
| }); | |
| if (!bots.length) { sum.textContent = 'No active grid bots.'; return; } | |
| sum.innerHTML = '<b class="gold">' + bots.length + '</b> active · invested <b>' + money(totInv) + | |
| '</b> · grid profit <b class="pos">' + money(totGp) + '</b> · total P&L <b class="' + cls(totPnl) + '">' + money(totPnl, true) + '</b>'; | |
| }).catch(function () { | |
| document.getElementById('active-sum').textContent = 'Could not load active bots.'; | |
| }); | |
| fetch('/api/grid-archived').then(function (r) { return r.json(); }).then(function (bots) { | |
| var tbl = document.getElementById('arch-tbl'); | |
| var sum = document.getElementById('arch-sum'); | |
| if (!Array.isArray(bots)) { sum.textContent = 'Error loading archive.'; return; } | |
| var totInv = 0, totPnl = 0, totGp = 0; | |
| bots.forEach(function (b) { | |
| var inv = parseFloat(b.invested) || 0; | |
| var pnl = parseFloat(b.pnl) || 0; | |
| var gp = parseFloat(b.grid_profit) || 0; | |
| totInv += inv; totPnl += pnl; totGp += gp; | |
| var tr = document.createElement('tr'); | |
| tr.innerHTML = '<td>' + (b.symbol || '—') + '</td>' + | |
| '<td>' + dt(b.archived_ms) + '</td>' + | |
| '<td class="num">' + money(inv) + '</td>' + | |
| '<td class="num pos">' + money(gp) + '</td>' + | |
| '<td class="num ' + cls(pnl) + '">' + money(pnl, true) + '</td>' + | |
| '<td>' + (b.status_label || '—') + '</td>'; | |
| tbl.appendChild(tr); | |
| }); | |
| if (!bots.length) { sum.textContent = 'Archive is empty.'; return; } | |
| sum.innerHTML = '<b class="gold">' + bots.length + '</b> archived · invested <b>' + money(totInv) + | |
| '</b> · grid profit <b class="pos">' + money(totGp) + '</b> · total P&L <b class="' + cls(totPnl) + '">' + money(totPnl, true) + '</b>'; | |
| }).catch(function () { | |
| document.getElementById('arch-sum').textContent = 'Could not load archive.'; | |
| }); | |
| fetch('/api/grid-score-weights-history').then(function (r) { return r.json(); }).then(function (hist) { | |
| var nowBox = document.getElementById('w-now'); | |
| var note = document.getElementById('w-note'); | |
| var tbl = document.getElementById('w-tbl'); | |
| var dates = Object.keys(hist || {}).sort(); | |
| if (!dates.length) { nowBox.innerHTML = '<div class="wl">No weight history yet.</div>'; return; } | |
| var latest = dates[dates.length - 1]; | |
| var w = hist[latest]; | |
| var labels = { osc: 'Oscillations', adx: 'ADX', drift: '7d Drift', w24: '24h Width' }; | |
| nowBox.innerHTML = ''; | |
| ['osc', 'adx', 'drift', 'w24'].forEach(function (k) { | |
| var box = document.createElement('div'); | |
| box.className = 'wbox'; | |
| box.innerHTML = '<div class="wl">' + labels[k] + '</div><div class="wv">' + (Number(w[k] || 0).toFixed(2)) + '</div>'; | |
| nowBox.appendChild(box); | |
| }); | |
| note.textContent = 'Current weights (learned from realized grid returns, as of ' + latest + '). Recent history:'; | |
| dates.slice(-14).reverse().forEach(function (d) { | |
| var x = hist[d]; | |
| var tr = document.createElement('tr'); | |
| tr.innerHTML = '<td>' + d + '</td>' + | |
| '<td class="num">' + Number(x.osc || 0).toFixed(2) + '</td>' + | |
| '<td class="num">' + Number(x.adx || 0).toFixed(2) + '</td>' + | |
| '<td class="num">' + Number(x.drift || 0).toFixed(2) + '</td>' + | |
| '<td class="num">' + Number(x.w24 || 0).toFixed(2) + '</td>'; | |
| tbl.appendChild(tr); | |
| }); | |
| }).catch(function () { | |
| document.getElementById('w-now').innerHTML = '<div class="wl">Could not load score weights.</div>'; | |
| }); | |
| </script> | |
| </body> | |
| </html> | |