Session rest: a rest across the 5 PM roll reports unsynced; health excuses a wake
A firm resting across the trade-date roll kept reporting its last snapshot, so yesterday's realized P&L and DLL lockouts counted as accounts already traded today (Nik's Topstep read 5/5 traded at 5:31 PM from 3:29 PM data). Its report is now the unsynced one until it logs back in; a rest within one trade date reports as before. /api/health also counts a firm logging back in after a rest as nothing wrong, within its 15-minute grace, rather than reading not ok for the seconds before its first sync. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5eb0ea7760
commit
062ec07f0a
@@ -1889,6 +1889,17 @@ export function planRest(
|
||||
return { wakeAt, checkInAt: planCheckIn(now, wakeAt, rand), leadMs };
|
||||
}
|
||||
|
||||
/**
|
||||
* A resting session's snapshot, last synced at `lastSyncAt`, is from an
|
||||
* earlier trade date than `now`: its realized P&L, DLL lockouts and legs are
|
||||
* the old day's, and counted as today's they would read as accounts already
|
||||
* traded. It reports as unsynced until the session logs back in.
|
||||
*/
|
||||
export function restSnapshotStale(lastSyncAt: number, now: number = Date.now()): boolean {
|
||||
if (!(lastSyncAt > 0)) return true;
|
||||
return currentTradeDateCT(new Date(lastSyncAt)) !== currentTradeDateCT(new Date(now));
|
||||
}
|
||||
|
||||
/**
|
||||
* A firm's cap on how many of its accounts trade at once, on top of the
|
||||
* machine's own max concurrent accounts: keeps `items` in order, at most
|
||||
|
||||
Reference in New Issue
Block a user