Prioritize profitTarget over consistency in min-day reservation

The min-day block was capping the target at baseAmount (consistency-derived)
via Math.min(baseAmount, cappedByFuture), which could produce a target too
low to hit profitTarget with min-day reservations for remaining days.

Now uses cappedByFuture directly so the target always stays on track to
hit profitTarget when there are remaining mandatory days. Consistency can
still be enforced via the firm's consistency setting (1.0 = no cap).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-04-20 20:01:09 -05:00
co-authored by Claude Opus 4.6
parent 255cf2dd83
commit 1dbaebb7d8
+3 -2
View File
@@ -140,8 +140,9 @@ export function computeDailyTarget(
// Floor: must make at least minDayPnL today (or whatever is left if less)
const floor = Math.min(effectiveMinDay, remaining);
// 0% consistency → no upper bound, take cappedByFuture; otherwise cap at baseAmount
const amount = Math.max(floor, baseAmount > 0 ? Math.min(baseAmount, cappedByFuture) : cappedByFuture);
// Target what's needed to stay on track for profitTarget (cappedByFuture), floored at minDayPnL.
// Consistency-based baseAmount is intentionally ignored here — profitTarget takes priority.
const amount = Math.max(floor, cappedByFuture);
return { amount: Math.round(amount * 100) / 100, path };
}