Treat Challenge Payout cash changes as fund transactions

Some firms record payouts as "Challenge Payout" in the Cash History
rather than "Fund Transaction" or "Manual Adjustment". Without this the
payout was summed into that day's P&L (a -2,000 payout turned a +1,416
day into -584) and never reset the cycle, so daysTraded kept counting
and the stage never advanced.

Verified against a captured report: the payout is now recorded as a
fund transaction, excluded from daily P&L, and because its timestamp
precedes the day's first trade the day's trades land in the new cycle.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-08-21 18:34:25 -05:00
co-authored by Claude
parent e37c39a7d1
commit 24a54c6642
+1 -1
View File
@@ -557,7 +557,7 @@ export class TradovateClient {
const firstTradeTsMap: { [date: string]: string } = {};
for (const row of rows) {
const changeType = (row['Cash Change Type'] ?? '').trim();
if (changeType === 'Fund Transaction' || changeType === 'Manual Adjustment') {
if (changeType === 'Fund Transaction' || changeType === 'Manual Adjustment' || changeType === 'Challenge Payout') {
const delta = parseFloat((row['Delta'] ?? '0').replace(/,/g, ''));
if (!isNaN(delta)) {
fundMap[row['Date']] = (fundMap[row['Date']] ?? 0) + delta;