Simplify Mode A to compare equityProfit against profitTarget

Previously Mode A computed effective target = profitTarget - (priorProfit
+ totalWithdrawals), which produced inflated targets after withdrawals.

Since computeDailyTarget now uses equityProfit (amount - accountSize)
directly, Mode A just needs to return the base profitTarget unchanged.
The equity-based comparison naturally handles 'get back to same target
above accountSize' semantics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-04-20 20:16:51 -05:00
co-authored by Claude Opus 4.6
parent 9c2b2278eb
commit c0d60dfe8d
+4 -6
View File
@@ -19,12 +19,10 @@ export function resolveEffectiveConfig(
fundTransactions: { date: string; amount: number }[]
): { profitTarget: number; consistency: number; minTradingDays: number } {
if (targetSameEquity) {
// Withdrawals reduce the profit remaining in the account
const totalWithdrawals = fundTransactions
.filter((f) => f.amount < 0)
.reduce((s, f) => s + f.amount, 0); // negative sum
const remainingProfit = priorProfit + totalWithdrawals;
return { profitTarget: Math.max(0, profitTarget - remainingProfit), consistency, minTradingDays };
// Simple Mode A: effective target = profitTarget - equityProfit, computed in computeDailyTarget.
// Since computeDailyTarget already compares (amount - accountSize) against profitTarget,
// no adjustment needed here — just return the base values.
return { profitTarget, consistency, minTradingDays };
}
if (withdrawalStages.length > 0) {
const withdrawalCount = fundTransactions.filter((f) => f.amount < 0).length;