Dashboard: a stage's own daily loss limit shows its stop, its personal DLL and its min days

Since a withdrawal stage can carry its own daily loss limit, the engine
places that stop, but the dashboard and report still asked the type's base
limit whether the bot stops at all: with a base of 0 and no obfuscation
options the row showed no "stop $X", and a stopped-out red day read "Flat"
(and counted as a loss, not a personal DLL, in the report). botStopsActive
now takes the stage-resolved config. The state also carries the stage's
daily loss limit and min trading days, which the account page and the Days
column show instead of the type's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-10-27 14:15:02 -05:00
co-authored by Claude Opus 5.5
parent 952e4412c4
commit 4add379c68
7 changed files with 42 additions and 12 deletions
+16
View File
@@ -305,6 +305,22 @@ test('dllViable and botStopsActive', () => {
assert.equal(botStopsActive({ firstDayStop: true, minDayStop: false, dailyLossLimit: 0 }), true);
});
test('botStopsActive: the current stage\'s daily loss limit, which a stage may set on a type with none', () => {
const cfg = { firstDayStop: false, minDayStop: false, dailyLossLimit: 0 };
const stages = [{ profit: 3000, consistency: 0, minTradingDays: 0, dailyLossLimit: 3000 }];
const paidOnce = [{ date: '2026-10-25', amount: -1500 }];
// Stage 2 places its $3,000 stop: a red day there is the personal DLL.
const stage2 = resolveEffectiveConfig(1500, 0, 0, false, stages, 0, paidOnce, 0, { dailyLossLimit: 0 });
assert.equal(botStopsActive(cfg, stage2), true);
// Stage 1 of the same type places none.
assert.equal(botStopsActive(cfg, resolveEffectiveConfig(1500, 0, 0, false, stages, 0, [], 0, { dailyLossLimit: 0 })), false);
// A stage that sets 0 lifts the type's limit.
const lifted = resolveEffectiveConfig(1500, 0, 0, false, [{ ...stages[0], dailyLossLimit: 0 }], 0, paidOnce, 0, { dailyLossLimit: 1229 });
assert.equal(botStopsActive({ ...cfg, dailyLossLimit: 1229 }, lifted), false);
// The obfuscation stops count whatever the stage.
assert.equal(botStopsActive({ ...cfg, minDayStop: true }, lifted), true);
});
// ── sizing ───────────────────────────────────────────────────────────────────
const btcSigma = 0.03 / Math.sqrt(24); // 3%/day