fix: comparable periods pick one example per market cycle

Instead of showing 5 recent days with similar scores (all from the same
2-week window), now picks one example per cycle:
- pre-2016, 2016-17 Bull, 2018-19 Bear, 2020-21 Bull, 2022-23 Bear, 2024+
- Sorted by closest score match, then picks one per cycle
- Shows cycle label in brackets next to each example
- Much more representative of how the score performed across different eras
This commit is contained in:
BizzleBot
2026-03-21 22:21:14 +00:00
parent 6398c6c8f4
commit 6bfbd30e3d
3 changed files with 128 additions and 10 deletions
+3 -2
View File
@@ -1307,10 +1307,11 @@ function renderContext() {
// Examples
const list = document.getElementById('ctxComparables');
if (ctx.examples && ctx.examples.length) {
let html = '<h2 style="margin-top:12px">Comparable Historical Periods</h2>';
let html = '<h2 style="margin-top:12px">Comparable Historical Periods <span style="color:var(--muted);font-size:.7em;font-weight:normal">(one per market cycle)</span></h2>';
for (const ex of ctx.examples) {
const fr = ex.forward_returns || {};
html += '<div class="comparable-item"><span>' + ex.date + ' — Score ' + ex.score + '' + fmtPrice(ex.price) + '</span>';
const cycleTag = ex.cycle ? '<span style="color:var(--accent);font-size:.75em;opacity:.7;margin-left:6px">[' + ex.cycle + ']</span>' : '';
html += '<div class="comparable-item"><span>' + ex.date + ' — Score ' + ex.score + '' + fmtPrice(ex.price) + cycleTag + '</span>';
html += '<span>';
if (fr['30d'] != null) html += '<span class="' + retClass(fr['30d']) + '">30d: ' + fmtPct(fr['30d']) + '</span> ';
if (fr['90d'] != null) html += '<span class="' + retClass(fr['90d']) + '">90d: ' + fmtPct(fr['90d']) + '</span> ';