Skip to content

fix(runtime): preserve schedule phase across worker restarts - #152

Merged
pjy008008 merged 1 commit into
developfrom
feature/schedule-phase-restart
Aug 8, 2026
Merged

fix(runtime): preserve schedule phase across worker restarts#152
pjy008008 merged 1 commit into
developfrom
feature/schedule-phase-restart

Conversation

@pjy008008

Copy link
Copy Markdown
Contributor

What changed

  • Anchor schedule.tradingDayIndex to the bot's EvaluationWindow.eligibleFrom date.
  • Count regular NYSE sessions from that fixed date, skipping weekends and standard exchange holidays.
  • Reconstruct the same index after a worker restart, then increment only across newly observed date ranges.
  • Add the launch-readiness regression test tradingDayIndexSurvivesARestart across Thanksgiving.

Why

The live Basic runtime previously incremented tradingDayIndex only in memory. Restarting a trading worker reset the next observed session to day 1, shifting EVERY_N_TRADING_DAYS execution compared with the backtest schedule.

This implements launch-readiness §3.1 using the selected rule: the first regular market session on or after executionEligibleFrom is day 1.

Impact

Worker restarts no longer change the phase of trading-day schedules. Existing intraday candle, session-close, week, and month signals keep their current behavior.

Validation

  • ./gradlew.bat :apps:trading-worker:test --tests com.idea2strategy.trading.worker.runtime.BasicMarketSignalStateTest --no-daemon --console=plain
  • ./gradlew.bat check --no-daemon --build-cache --parallel --console=plain
  • powershell -NoProfile -ExecutionPolicy Bypass -File ./scripts/test-github-action-pins.ps1

@pjy008008
pjy008008 merged commit bd43f5f into develop Aug 8, 2026
2 checks passed
@pjy008008
pjy008008 deleted the feature/schedule-phase-restart branch August 8, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant