diff --git a/lib/master-protocol.ts b/lib/master-protocol.ts index bbdb4b4..1e99470 100644 --- a/lib/master-protocol.ts +++ b/lib/master-protocol.ts @@ -47,8 +47,9 @@ 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), + /** Live accounts by days traded in the current cycle โ€” the instance + * 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 * hits finished the cycle. Lets the master show "Day 1 3/5 ยท Day 2 1/4". * Optional: older instances omit it. */ diff --git a/lib/reporter.ts b/lib/reporter.ts index b9e3e6c..ae5ff7e 100644 --- a/lib/reporter.ts +++ b/lib/reporter.ts @@ -123,11 +123,14 @@ 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. + // Days traded, for the master's per-day pass counts โ€” the same + // number as the local dashboard's Days Traded column + // (app/api/state): only days reaching minDayPnL when it is set, + // today included once it books. 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; const dayEntry = dayOn === null ? null : ((slice.dayStats ??= {})[dayOn] ??= { total: 0, targetHit: 0 }); if (dayEntry) dayEntry.total++;