Report each tick's outcome and the updater's state to the master

The master saw a scheduler's last run time and nothing of what it did. Each
tick now records, per lane, its outcome, a line on what happened (what
fired, or the spread, contract or hold cap that stopped it) and why the
lane's accounts sat it out, counted by reason with a few names each. It
rides the scheduler status as lastTicks.

Each report also carries the auto-updater's state from the files it keeps
and from git: its last check, a failed update waiting to retry, how far the
checkout is behind origin, and tracked files edited by hand, which stop the
fast-forward pull.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-09-27 18:31:21 -05:00
co-authored by Claude Opus 5.5
parent db0ad99a76
commit ab3132182a
7 changed files with 253 additions and 21 deletions
+10 -1
View File
@@ -13,7 +13,7 @@ import {
botStopsActive, sizeNotional, isNoTradeTime, isPastSessionClose, nextTradingDate, effectiveCombine, DEFAULT_TARGET_HOLD_HOURS,
projectPerfectPath, cycleCompletion, DLL_RESERVE_FRACTION, DLL_MIN_STOP, notionalCap, expectedSwapToWin, MARGIN_HEADROOM,
dllReserve, DLL_SLIPPAGE_FRACTION, maxLossRoom, lastStand, breachDistance, LAST_STAND_FRACTION, planLegSize, rankForTarget,
currentTradeDateCT,
currentTradeDateCT, foldReason,
} from '../lib/trading-logic.ts';
// Deterministic PRNG so a failure reproduces.
@@ -729,3 +729,12 @@ test('l2Book best bid/ask', () => {
assert.equal(empty.bid, undefined);
assert.equal(empty.ask, undefined);
});
test('tick reasons fold their amounts, so like reasons count together', () => {
assert.equal(foldReason('day done ($12.5 left of $300)'), 'day done ($… left of $…)');
assert.equal(foldReason('day done ($40 left of $1,500)'), 'day done ($… left of $…)');
assert.equal(foldReason('already traded today (realizedPnL=-123.45)'), 'already traded today (realizedPnL=…)');
assert.equal(foldReason('daily loss limit: $294.7 of $3000 left — day booked'), 'daily loss limit: $… of $… left — day booked');
assert.equal(foldReason("waiting for the broker to roll the account's day"), "waiting for the broker to roll the account's day");
assert.equal(foldReason('leg cap reached (5 today)'), 'leg cap reached (5 today)');
});