Reporter: per-day target-hit counts for each account type

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-09-23 10:11:01 -05:00
co-authored by Claude Opus 5.5
parent 1d4d45bd79
commit a47a86a59c
2 changed files with 15 additions and 0 deletions
+5
View File
@@ -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<number, number>;
/** 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<number, { total: number; targetHit: number }>;
/** 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
+10
View File
@@ -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;