Check exchange holidays and early closes against your scheduled jobs and plans
Once a year, and again each month, a script reads the exchange's published holiday and early-close calendar and lists every scheduled agent job, planned review and stated deadline that falls on one, so nothing runs on a closed market.
How it works
- Copy the exchange's published holidays and early closes for the year into a small file (date, full close or early close, close time). Use the exchange's own page, not a model's memory.
- List every scheduled job in your routine with its schedule: scans, end-of-day checks, digests, exports. Add planned reviews and any deadlines from your plans.
- Each month, a script lists every job run, review or deadline in the next six weeks that lands on a full holiday, and every end-of-day job timed after an early close.
- For each hit you decide: skip the run, move it, or let it run and mark the output as a non-trading day.
- The script writes your decisions as calendar entries to a separate calendar you own, after showing you the list.
Copy-paste prompt
Write a Python script that checks my schedule against exchange holidays. It gives no trading advice.
Inputs: {{holidays_csv}} (date, type full_close or early_close, close_time_local_exchange), {{jobs_csv}} (job_name, schedule as a cron expression or a list of dates, time, time zone) and {{plan_dates_csv}} (item, date).
1. Expand each job's schedule for the next {{weeks}} weeks.
2. Report runs on full_close dates, and end-of-day runs whose time is after the early close time on early_close dates, converting zones with zoneinfo.
3. Report plan dates that fall on full_close dates.
4. Print a table and an .ics file of proposed calendar notes, and write nothing until I confirm.
Include a test with one known holiday and one early close.Guardrails
- Holiday dates come from the exchange's own published calendar, copied by you, never from the model.
- The script only proposes calendar notes; it writes them after you confirm and only to your own calendar.
- Time zone conversions are done in code with the zone database, not by hand.
What can go wrong
An end-of-day job ran on an early-close day, read the price file before it had updated, and reported a day-old close as today's. The check now flags early closes as well as full holidays. The other miss was a holiday on a Monday that the schedule expander skipped because the job was defined as 'every weekday', so the test includes one.
Why it helps
Scheduled jobs don't know the market is closed. On a holiday a scan returns yesterday's data as if it were new, and on an early-close day an end-of-day check can run before the close it's meant to read. A short check against the exchange's own calendar keeps your routine from producing confident output on a day with no session.
How it fits with other entries
The daylight-saving mismatch check (aft-0054) handles the weeks when session times shift in your zone; this handles the days with no session or a short one. The weekly agent audit (aft-0027) is where a stale-data run would otherwise be caught after the fact.
Where this comes from
The New York Stock Exchange's public holidays and trading hours page and Python's zoneinfo documentation. The check is ours.
Source and references
Original write-up by Agents for Traders. Background reading is linked below.
- Holidays and Trading Hours · New York Stock Exchange (checked 20 Oct 2026)
- zoneinfo: time zone support (Python standard library) · Python documentation (checked 20 Oct 2026)
Spotted an error, or want your post removed? Email hello@agentsfortraders.com.
Educational content only. Not investment advice or a personal recommendation. No tickers, signals or trade alerts. Trading involves risk of loss.
Conteúdo exclusivamente educativo. Não constitui aconselhamento nem recomendação de investimento. Sem tickers, sinais ou alertas de negociação. Negociar envolve risco de perda.
Related use cases
Have one agent audit your other agents every week
A separate, read-only checker confirms that each of your agents actually ran, used fresh data, stayed inside its permissions and still follows its written rules. It reports; you save the evidence snapshot and fix what it flags.
Agent ops: guardrails & costsWrite a no-AI fallback for your routine before your model provider goes down
For each step of your routine that an agent runs, write down the manual version and how you'll know the step failed, and keep a tested second provider for the steps you rely on most. An outage then costs minutes, not your process.
Agent ops: guardrails & costsCheck your scheduled jobs still line up with the open after the US clock change
Cloud schedulers, cron jobs and many data feeds run in UTC, which never changes, while the US session moves an hour in UTC twice a year. A script rechecks every scheduled job around the March and November switches.
The Daily 3
Three agent workflows for swing traders, free, on US trading days.