From 0d01539338e9919fde3b6a21b8e88947f4ced51c Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Thu, 10 Sep 2026 02:18:01 -0500 Subject: [PATCH] Report DLL-locked accounts as finished at a loss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An account Tradovate flips to liquidate-only at the daily loss limit is done for the day, but the reporter only counted a loss when the booked realizedPnL was already negative — so a locked-out account whose P&L hadn't caught up (or that had no matching config) showed as still to trade. Count inactive accounts as traded at a loss. Co-Authored-By: Claude Fable 5 --- lib/master-protocol.ts | 3 ++- lib/reporter.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/master-protocol.ts b/lib/master-protocol.ts index b41aef5..9b1c6e1 100644 --- a/lib/master-protocol.ts +++ b/lib/master-protocol.ts @@ -16,7 +16,8 @@ export interface AccountTypeStats { inTrade: number; /** Of the accounts that finished trading today (traded, no open position): * how many ended with the day's profit target hit, in profit but short of - * the target, or at a realized loss. Optional so an older master simply + * the target, or at a realized loss (an account locked out at the daily + * loss limit counts as a loss). Optional so an older master simply * ignores them. */ targetHit?: number; partial?: number; diff --git a/lib/reporter.ts b/lib/reporter.ts index 766b924..6185c06 100644 --- a/lib/reporter.ts +++ b/lib/reporter.ts @@ -88,6 +88,17 @@ function collectFirmStats() { continue; } + // DLL lockout: Tradovate flips the account to liquidate-only, so + // its day is over at a loss even when the booked realizedPnL + // hasn't caught up yet (or the account has no matching config). + if (!acc.active) { + accountsTraded++; + slice.accountsTraded++; + lossCount++; + slice.loss = (slice.loss ?? 0) + 1; + continue; + } + // Check if target was hit today if (cfg) { // Same combined-day view as the trade path: for a combining