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:
@@ -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'] });
|
||||
|
||||
Reference in New Issue
Block a user