From a47a86a59cf80855b3c9571f6c0308c143ca9140 Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Wed, 23 Sep 2026 10:11:01 -0500 Subject: [PATCH] Reporter: per-day target-hit counts for each account type Co-Authored-By: Claude Opus 5.5 --- lib/master-protocol.ts | 5 +++++ lib/reporter.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/master-protocol.ts b/lib/master-protocol.ts index 6e51340..5b3365e 100644 --- a/lib/master-protocol.ts +++ b/lib/master-protocol.ts @@ -31,6 +31,11 @@ export interface AccountTypeStats { * calendar only projects accounts still on the winning path. Optional so * an older master simply ignores it. */ daysHist?: Record; + /** Live accounts by the trading day they are on today (1 = first day of + * the current cycle, counting traded days before today's trade date), + * with how many of them hit today's target. Lets the master show + * "Day 1 3/5 ยท Day 2 1/4". Optional: older instances omit it. */ + dayStats?: Record; /** One entry per live account (negative ones included, dead ones not): * its actual progress toward the current target, so the master can * simulate the real required profit instead of assuming the winning diff --git a/lib/reporter.ts b/lib/reporter.ts index 50c8b0f..a98b636 100644 --- a/lib/reporter.ts +++ b/lib/reporter.ts @@ -103,6 +103,15 @@ function collectFirmStats() { cfg.targetSameEquity, cfg.withdrawalStages, client.priorProfit?.[acc.id] ?? 0, fundTxns, cfg.minDayPnL, ) : null; + // The day this account is on today, for the master's per-day pass + // counts. Days before today's trade date only, so it reads the + // same before and after today's P&L books. + const dayOn = combined + ? combined.dailyPnL.filter((d) => d.pnl !== 0 && d.date !== combined.tradeDate).length + 1 + : null; + const dayEntry = dayOn === null ? null : ((slice.dayStats ??= {})[dayOn] ??= { total: 0, targetHit: 0 }); + if (dayEntry) dayEntry.total++; + if (cfg && combined && acc.active && cash.amount - cfg.accountSize >= 0) { const hist = (slice.daysHist ??= {}); hist[combined.daysTraded] = (hist[combined.daysTraded] ?? 0) + 1; @@ -241,6 +250,7 @@ function collectFirmStats() { } else if (targetHit) { targetHitCount++; slice.targetHit = (slice.targetHit ?? 0) + 1; + if (dayEntry) dayEntry.targetHit++; } else { partialCount++; slice.partial = (slice.partial ?? 0) + 1;