Reporter: day stats keyed by Days Traded, matching the instance dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-09-23 20:16:28 -05:00
co-authored by Claude Opus 5.5
parent a7e01b0138
commit dd73222e00
2 changed files with 10 additions and 6 deletions
+3 -2
View File
@@ -47,8 +47,9 @@ export interface AccountTypeStats {
* calendar only projects accounts still on the winning path. Optional so * calendar only projects accounts still on the winning path. Optional so
* an older master simply ignores it. */ * an older master simply ignores it. */
daysHist?: Record<number, number>; daysHist?: Record<number, number>;
/** Live accounts by the trading day they are on today (1 = first day of /** Live accounts by days traded in the current cycle — the instance
* the current cycle, counting traded days before today's trade date), * dashboard's Days Traded number (minDayPnL-qualifying days, today
* included once booked) —
* with how many of them hit today's target; completed = how many of those * with how many of them hit today's target; completed = how many of those
* hits finished the cycle. Lets the master show "Day 1 3/5 · Day 2 1/4". * hits finished the cycle. Lets the master show "Day 1 3/5 · Day 2 1/4".
* Optional: older instances omit it. */ * Optional: older instances omit it. */
+7 -4
View File
@@ -123,11 +123,14 @@ function collectFirmStats() {
cfg.targetSameEquity, cfg.withdrawalStages, cfg.targetSameEquity, cfg.withdrawalStages,
client.priorProfit?.[acc.id] ?? 0, fundTxns, cfg.minDayPnL, client.priorProfit?.[acc.id] ?? 0, fundTxns, cfg.minDayPnL,
) : null; ) : null;
// The day this account is on today, for the master's per-day pass // Days traded, for the master's per-day pass counts — the same
// counts. Days before today's trade date only, so it reads the // number as the local dashboard's Days Traded column
// same before and after today's P&L books. // (app/api/state): only days reaching minDayPnL when it is set,
// today included once it books.
const dayOn = combined const dayOn = combined
? combined.dailyPnL.filter((d) => d.pnl !== 0 && d.date !== combined.tradeDate).length + 1 ? effective && effective.minDayPnL > 0
? combined.dailyPnL.filter((d) => d.pnl >= effective.minDayPnL).length
: combined.daysTraded
: null; : null;
const dayEntry = dayOn === null ? null : ((slice.dayStats ??= {})[dayOn] ??= { total: 0, targetHit: 0 }); const dayEntry = dayOn === null ? null : ((slice.dayStats ??= {})[dayOn] ??= { total: 0, targetHit: 0 });
if (dayEntry) dayEntry.total++; if (dayEntry) dayEntry.total++;