Source: src/app.tsscheduleExchangeSessionJobs() All jobs use Asia/Kolkata timezone (from getTimezone()) and run Monday–Friday unless noted.

Job timetable

Market open/close times are read from getMarketHoursForGroup() in src/utils/marketHours.ts:

Zerodha 6:00 AM refresh

Kite access tokens expire daily. The morning job:
  1. Sets zerodhaRefreshInProgress flag
  2. Disconnects WebSocket
  3. Deletes all Zerodha documents
  4. Runs autoZerodhaLogin (headless TOTP)
  5. Clears refresh flag in finally block
During refresh, initializeMarketDataIfNeeded skips auto-login to avoid race conditions.

Weekly data cleanup

deleteOldData(7) removes IndexData documents where created_at is older than 7 days. Runs Saturday 1:00 AM IST.

Shutdown

On graceful shutdown, schedule.gracefulShutdown() cancels all pending jobs before the process exits.

Interval-based jobs (not cron)

These run via intervalManager rather than node-schedule: Started/stopped by market session manager based on exchange hours.