Fix consistency bug, rename Random to Auto, add stop-after-all, direction pills, copy-trade

Bug fixes:
- Fix computeDailyTarget when consistency is 0% or 100%: treat as no constraint,
  letting min-day reservation or full remaining profit drive the target
- Rename 'Random' to 'Auto' across entire codebase (types, API, UI, scheduler)

Features:
- Add "Stop after all eligible" checkbox: auto-stops scheduler when all
  configured accounts are dead, inactive, already traded, or challenge complete
- Show position direction in status pill: "Long" (green) / "Short" (red)
  instead of generic "In Trade" (blue)
- Add "Copy to Max" button: copies current trade direction to remaining
  eligible accounts up to max_concurrent_accounts limit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-03-26 02:50:31 -05:00
co-authored by Claude Opus 4.6
parent 8d9a9a5ea9
commit df793bfd70
7 changed files with 342 additions and 39 deletions
+9 -3
View File
@@ -94,10 +94,11 @@ export function computeDailyTarget(
let path: 'first_day' | 'normal_day' | 'reduced_day';
if (daysTraded === 0) {
baseAmount = profitTarget * consistency;
// 0% or 100% consistency = no constraint; let min-day reservation drive the target
baseAmount = (consistency === 0 || consistency >= 1) ? 0 : profitTarget * consistency;
path = 'first_day';
} else if (consistency === 0) {
// 0% consistency means no consistency rule to satisfy — base amount is always $0.
} else if (consistency === 0 || consistency >= 1) {
// No consistency rule to satisfy — base amount is $0.
// The min-day reservation block below handles any mandatory-day targeting.
baseAmount = 0;
path = 'reduced_day';
@@ -140,5 +141,10 @@ export function computeDailyTarget(
return { amount: Math.round(amount * 100) / 100, path };
}
// When no consistency constraint and no min-day reservation applied, target the full remaining profit
if (baseAmount <= 0 && (consistency === 0 || consistency >= 1)) {
baseAmount = Math.max(0, profitTarget - totalProfit);
}
return { amount: Math.round(baseAmount * 100) / 100, path };
}