diff --git a/README.md b/README.md index 448699a..31891eb 100644 --- a/README.md +++ b/README.md @@ -257,7 +257,11 @@ own traffic since Vest publishes no API): unmarked since marking began was someone else's. The **Trades** button on the Vest firm's dashboard row lists them, and the account page shows its own. - Claims: the bot claims a funded account's profit by itself at each stage's - target (`auto_claim`, on unless set to `off`). The account page's **Claim + target — whether or not the scheduler is running (a claim opens nothing). + The dashboard's **Auto-claim payouts** box turns it off (`auto_claim`). A + claim holds every further claim on the account until Vest's transactions + show its WITHDRAW; one whose request failed in transit holds them too, until + the transactions show it went in, or an hour of them shows it didn't. The account page's **Claim now** button claims the whole profit above the account size at once — any amount from $1 — when the account is flat; it asks first, since it moves money to the login's main account. diff --git a/app/api/settings/route.ts b/app/api/settings/route.ts index ca8d50b..6bdebd5 100644 --- a/app/api/settings/route.ts +++ b/app/api/settings/route.ts @@ -3,7 +3,7 @@ import { getSetting, setSetting } from '@/lib/db'; import { scheduleBackupPush } from '@/lib/backup-sync'; import { getRequestUserAgent } from '@/lib/request-user-agent'; -const VALID_KEYS = ['max_concurrent_accounts', 'tick_interval_seconds', 'master_dashboard_url', 'instance_name', 'trading_hours', 'twocaptcha_api_key', 'twocaptcha_proxy', 'master_backup_token', 'proxy_url'] as const; +const VALID_KEYS = ['max_concurrent_accounts', 'tick_interval_seconds', 'master_dashboard_url', 'instance_name', 'trading_hours', 'twocaptcha_api_key', 'twocaptcha_proxy', 'master_backup_token', 'proxy_url', 'auto_claim'] as const; type SettingKey = typeof VALID_KEYS[number]; export async function GET() { @@ -25,6 +25,12 @@ export async function PATCH(req: NextRequest) { try { const body = await req.json() as Partial>; + // Claims run unless it reads exactly 'off' — say so exactly, and + // before anything is written. + if (body.auto_claim !== undefined && body.auto_claim !== null && body.auto_claim !== 'on' && body.auto_claim !== 'off') { + return NextResponse.json({ error: "auto_claim is 'on' or 'off'" }, { status: 400 }); + } + for (const key of VALID_KEYS) { if (key in body) { const raw = body[key]; diff --git a/app/page.tsx b/app/page.tsx index 6ecee09..9b81c1a 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -743,6 +743,7 @@ export default function Home() { const [tickInterval, setTickInterval] = useState('60'); const [tradeLoading, setTradeLoading] = useState(false); const [stopAfterAll, setStopAfterAll] = useState(false); + const [autoClaim, setAutoClaim] = useState(true); const handleSort = (col: SortKey) => { if (sortKey === col) { @@ -812,8 +813,9 @@ export default function Home() { fetch('/api/settings') .then((r) => r.json()) - .then((s: { tick_interval_seconds?: string | null }) => { + .then((s: { tick_interval_seconds?: string | null; auto_claim?: string | null }) => { if (s.tick_interval_seconds != null) setTickInterval(s.tick_interval_seconds); + setAutoClaim(s.auto_claim !== 'off'); }) .catch(() => {}); @@ -1000,6 +1002,28 @@ export default function Home() { /> Stop after all eligible + {config.some((f) => f.platform === 'vest') && ( + + )}
{hasAnyPosition && (