From 95e743394105d09035f332945c72689b954cbe55 Mon Sep 17 00:00:00 2001 From: Senofy <63175905+Senofy@users.noreply.github.com> Date: Mon, 9 Mar 2026 17:38:04 -0500 Subject: [PATCH] Simplify min-day amount expression, remove extra variable Co-Authored-By: Claude Sonnet 4.6 --- lib/trading-logic.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/trading-logic.ts b/lib/trading-logic.ts index 99e06af..08b070c 100644 --- a/lib/trading-logic.ts +++ b/lib/trading-logic.ts @@ -79,11 +79,8 @@ export function computeDailyTarget( // Floor: must make at least minDayPnL today (or whatever is left if less) const floor = Math.min(effectiveMinDay, remaining); - // When consistency = 0% (baseAmount = 0), there's no consistency-based upper bound — - // target cappedByFuture directly (make as much as possible today, reserve future days). - // When consistency > 0%, treat baseAmount as the consistency cap. - const consistencyCapped = baseAmount > 0 ? Math.min(baseAmount, cappedByFuture) : cappedByFuture; - const amount = Math.max(floor, consistencyCapped); + // 0% consistency → no upper bound, take cappedByFuture; otherwise cap at baseAmount + const amount = Math.max(floor, baseAmount > 0 ? Math.min(baseAmount, cappedByFuture) : cappedByFuture); return { amount: Math.round(amount * 100) / 100, path }; }