feat: enhanced paper trading reset with capital and reserve controls

- Add initial capital input (toggle between broker balance or custom amount)
- Add reserve/active pool split slider (0-50%, default 20%)
- Backend accepts reserve_pct in reset request body
- Note in UI that Alpaca balance reset requires Alpaca dashboard
- Confirmation dialog shows exact capital and split being applied
This commit is contained in:
Celes Renata
2026-04-30 05:49:38 +00:00
parent fa18b1a7c2
commit 5209cc522e
3 changed files with 98 additions and 9 deletions
+5 -2
View File
@@ -316,9 +316,12 @@ export function useBacktestLaunch() {
export function useResetPaperTrading() {
const qc = useQueryClient();
return useMutation({
mutationFn: (initial_capital: number = 0) =>
mutationFn: (params: { initial_capital?: number; reserve_pct?: number } = {}) =>
apiPost<{ reset: boolean; initial_capital: number; active_pool: number; reserve_pool: number; broker: Record<string, number> }>(
'trading', '/api/trading/reset', { initial_capital },
'trading', '/api/trading/reset', {
initial_capital: params.initial_capital ?? 0,
reserve_pct: params.reserve_pct ?? undefined,
},
),
onSuccess: () => {
qc.invalidateQueries({ queryKey: ['trading-status'] });