One-and-done counts confirmed fills; holds need a persistent refusal; wipes keep their yardstick
Fourth review round (52ed9c7):
- The one-and-done guard counts only entries the broker confirmed filled,
so an entry that timed out or was rejected unfilled no longer benches the
account for the day.
- TopstepX: an account is promoted only by a sync that actually checked its
funds; one with no account type stays out (not traded) without costing a
sync per pass, and once typed waits for that check. Wipe routes don't
count untyped accounts as failures.
- Tradovate: an unchecked balance-hold release needs Cash History refused
for a full hour straight (a 4xx other than 401/403/408/429, or an answer
without data); any other outcome resets it, so one stray reply during a
5xx outage can't release a payout.
- A wipe keeps the pre-wipe baseline and fund rows as its yardstick: the
rebuild must explain today's balance against them, so a payout the
rebuilt report hasn't booked yet stays held.
- The roll base of an unrolled record is kept per trade date in
account_meta, so a restart later the same trade date counts from the same
point instead of from a value that already includes the day's fills.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
52ed9c75e4
commit
1eb0736fbe
@@ -1,5 +1,6 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { getClients } from '@/lib/clients';
|
||||
import { getAccountConfig } from '@/lib/account-type-resolver';
|
||||
import { wipeAccountData } from '@/lib/db';
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@ export async function POST(_req: Request, { params }: { params: Promise<{ id: st
|
||||
|
||||
await client.fetchDaysTraded([accountId]);
|
||||
|
||||
const loaded = client.historyReady(accountId);
|
||||
const loaded = client.historyReady(accountId) || !getAccountConfig(accountId).accountType;
|
||||
return NextResponse.json({
|
||||
ok: true,
|
||||
entries: (client.dailyPnL[accountId] ?? []).length,
|
||||
|
||||
Reference in New Issue
Block a user