diff --git a/lib/master-protocol.ts b/lib/master-protocol.ts index 516961d..53d3457 100644 --- a/lib/master-protocol.ts +++ b/lib/master-protocol.ts @@ -23,8 +23,10 @@ export interface AccountTypeStats { partial?: number; loss?: number; /** Live accounts by trading days completed toward the current target: - * {daysTraded: accountCount}. Feeds the master's payout calendar. - * Optional so an older master simply ignores it. */ + * {daysTraded: accountCount}. Feeds the master's payout calendar, so + * accounts that are dead, DLL-locked, or in the red are left out — the + * calendar only projects accounts still on the winning path. Optional so + * an older master simply ignores it. */ daysHist?: Record; } diff --git a/lib/reporter.ts b/lib/reporter.ts index 6dc23f6..4140415 100644 --- a/lib/reporter.ts +++ b/lib/reporter.ts @@ -83,11 +83,14 @@ function collectFirmStats() { // Same combined-day view as the trade path: for a combining firm, // "today" spans the holiday stretch. Computed for every live // account — including ones mid-trade — so the days-traded - // histogram below covers the whole slice. + // histogram below covers the whole slice. Accounts in the red or + // DLL-locked stay OUT of the histogram: the payout calendar + // projects from "on the winning path", which they are not. + // (Dead accounts never reach here — the auto-liq check above.) const combined = cfg ? combineCmeSessions( cfg.combineCmeHolidays, client.dailyPnL[acc.id] ?? [], currentTradeDateCT(), cash.realizedPnL, ) : null; - if (combined) { + if (cfg && combined && acc.active && cash.amount - cfg.accountSize >= 0) { const hist = (slice.daysHist ??= {}); hist[combined.daysTraded] = (hist[combined.daysTraded] ?? 0) + 1; }