Report daily session-open delay to the master dashboard

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-09-06 15:35:03 -05:00
co-authored by Claude Fable 5
parent 906275cc33
commit 346c356222
2 changed files with 13 additions and 4 deletions
+10 -4
View File
@@ -138,6 +138,14 @@ function openJitterMinutes(centralDay: string): number {
return jitter;
}
/** Today's session-open delay in minutes, for reporting to the master. */
export function todaysSessionOpenDelay(): number {
const centralDay = new Intl.DateTimeFormat('en-CA', {
timeZone: 'America/Chicago',
}).format(new Date());
return openJitterMinutes(centralDay);
}
/**
* Returns true when trading is not allowed based on the trading_hours setting.
*
@@ -162,10 +170,7 @@ function isInNoTradeWindow(): boolean {
timeZone: 'America/Chicago',
}).format(now); // "Sun", "Mon", ... "Sat"
const timeMinutes = hour * 60 + minute; // minutes since midnight
const centralDay = new Intl.DateTimeFormat('en-CA', {
timeZone: 'America/Chicago',
}).format(now); // "2026-09-06"
const jitter = openJitterMinutes(centralDay);
const jitter = todaysSessionOpenDelay();
const mode = getSetting('trading_hours') ?? 'full_cme';
@@ -727,5 +732,6 @@ export function getSchedulerStatus() {
lastRun: state.lastRun,
intervalSeconds: parseInt(getSetting('tick_interval_seconds') ?? '60', 10),
stopAfterAll: state.stopAfterAll,
sessionOpenDelayMin: todaysSessionOpenDelay(),
};
}
+3
View File
@@ -33,6 +33,9 @@ export interface SchedulerState {
lastRun: string | null;
intervalSeconds: number;
stopAfterAll?: boolean;
/** Today's random session-open delay in minutes (1–20), drawn once per
* Central-time day. Optional so an older master simply ignores it. */
sessionOpenDelayMin?: number;
}
export interface AutomationSummary {