Vest: report on Vest's day, and close a leg whose open came back unknown

The reporter and the dashboard take each firm's own trade date
(tradeDateFor), as the engine does: between 5 PM CT and Vest's 8 PM ET
reset the Central date counted the open Vest day as a prior day and as
today's P&L both, and could report a pass the master keeps for good. The
completion check's settle window now follows the client's own roll.

An open whose outcome came back unknown is marked the bot's once a read
shows the position it made, so the market-close guard closes it before a
long closure; an unmarked leg is no longer logged as a hand trade.

A symbol the close gate holds back stays on the candidate board for the
dashboard and the report, and fireLeg holds each account's leg to the
close at its own size, not just the batch lead's. check-vest-client.mjs
drives the guard and the board with every gateway call answered locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-10-27 14:41:20 -05:00
co-authored by Claude Opus 5.5
parent ec3e6ea388
commit ef15200e5e
11 changed files with 345 additions and 42 deletions
+15
View File
@@ -15,6 +15,7 @@ import {
dllReserve, DLL_SLIPPAGE_FRACTION, maxLossRoom, lastStand, breachDistance, LAST_STAND_FRACTION, planLegSize, rankForTarget,
currentTradeDateCT, foldReason, withinFirmCaps, personSizeFactor, personHoldHours, PERSON_SIZE_SPREAD, machineSide,
resolveEffectiveConfig, stageInputsFor, floorRoom, resetClearStop, shortestNextLeg, computeDayPlan, clearsClose, RESET_CLEAR_HOLDS,
legCloseNote,
} from '../lib/trading-logic.ts';
// Deterministic PRNG so a failure reproduces.
@@ -546,6 +547,20 @@ test('clearsClose: no leg starts under four holds of its market\'s close', () =>
assert.equal(clearsClose({ closeInMs: 20 * h, holdHours: NaN }), false);
});
test('legCloseNote: each account\'s leg is held to its market\'s close at its own size', () => {
const h = 3_600_000;
const now = Date.parse('2026-10-30T12:30:00Z');
const close = now + 9 * h;
// The batch's lead leg, 2 h: clear. Another account's, sized to 3.5 h: not.
assert.equal(legCloseNote(close, 2, now), null);
assert.equal(legCloseNote(close, 3.5, now), 'closes in 9.0h, under 4 holds of 3.5h');
// A contract that names no close (futures, crypto) never holds a leg back.
assert.equal(legCloseNote(undefined, 3.5, now), null);
assert.equal(legCloseNote(null, 3.5, now), null);
// An unknown hold doesn't open into a known close.
assert.notEqual(legCloseNote(close, NaN, now), null);
});
test('planLegSize: a split day\'s next leg, with the day\'s gain on its stop, sizes up for the same hold', () => {
// Dingo's 2026-10-27 evals: up $2,604.24 on a $1,400 day, $2,395.76 to
// pass, NDX at ~$29.5k on Vest (1.31%/day), sized for 1.5 h.