Report daily session-open delay to the master dashboard
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
906275cc33
commit
346c356222
+10
-4
@@ -138,6 +138,14 @@ function openJitterMinutes(centralDay: string): number {
|
|||||||
return jitter;
|
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.
|
* Returns true when trading is not allowed based on the trading_hours setting.
|
||||||
*
|
*
|
||||||
@@ -162,10 +170,7 @@ function isInNoTradeWindow(): boolean {
|
|||||||
timeZone: 'America/Chicago',
|
timeZone: 'America/Chicago',
|
||||||
}).format(now); // "Sun", "Mon", ... "Sat"
|
}).format(now); // "Sun", "Mon", ... "Sat"
|
||||||
const timeMinutes = hour * 60 + minute; // minutes since midnight
|
const timeMinutes = hour * 60 + minute; // minutes since midnight
|
||||||
const centralDay = new Intl.DateTimeFormat('en-CA', {
|
const jitter = todaysSessionOpenDelay();
|
||||||
timeZone: 'America/Chicago',
|
|
||||||
}).format(now); // "2026-09-06"
|
|
||||||
const jitter = openJitterMinutes(centralDay);
|
|
||||||
|
|
||||||
const mode = getSetting('trading_hours') ?? 'full_cme';
|
const mode = getSetting('trading_hours') ?? 'full_cme';
|
||||||
|
|
||||||
@@ -727,5 +732,6 @@ export function getSchedulerStatus() {
|
|||||||
lastRun: state.lastRun,
|
lastRun: state.lastRun,
|
||||||
intervalSeconds: parseInt(getSetting('tick_interval_seconds') ?? '60', 10),
|
intervalSeconds: parseInt(getSetting('tick_interval_seconds') ?? '60', 10),
|
||||||
stopAfterAll: state.stopAfterAll,
|
stopAfterAll: state.stopAfterAll,
|
||||||
|
sessionOpenDelayMin: todaysSessionOpenDelay(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export interface SchedulerState {
|
|||||||
lastRun: string | null;
|
lastRun: string | null;
|
||||||
intervalSeconds: number;
|
intervalSeconds: number;
|
||||||
stopAfterAll?: boolean;
|
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 {
|
export interface AutomationSummary {
|
||||||
|
|||||||
Reference in New Issue
Block a user