fix: remove broken capital controls, reset now queries broker for real balance
- Removed PUT /api/trading/capital (set capital) — only touched in-memory state - Removed POST /api/trading/capital/adjust (add/withdraw) — same problem - Reset endpoint now: liquidates Alpaca positions, cancels orders, clears DB, then queries Alpaca for real portfolio_value to set engine capital - Frontend: replaced CapitalCard with simple ResetCard (one button) - Removed useSetTradingCapital and useAdjustCapital hooks
This commit is contained in:
@@ -426,15 +426,6 @@ export function useSetTradingMode() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useSetTradingCapital() {
|
||||
const qc = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (initial_capital: number) =>
|
||||
apiPut<{ initial_capital: number; active_pool: number; reserve_pool: number }>('trading', '/api/trading/capital', { initial_capital }),
|
||||
onSuccess: () => qc.invalidateQueries({ queryKey: ['trading-config'] }),
|
||||
});
|
||||
}
|
||||
|
||||
export function usePendingApprovals() {
|
||||
return useGet<Approval[]>(['pending-approvals'], 'query', '/api/admin/trading/approvals');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user