DEV Community

A Holiday Flag Isn't Enough: Modeling Early Closes in a Business-Day Cutoff (NYSE vs. SIFMA, Dec 2026)

Most business-day code asks one question about a date: is it a holiday? That works for "add 3 business days." It breaks the moment your rule has a cutoff time, because some days are neither fully open nor fully closed.

Christmas Eve 2026 is the clean example. It's a Thursday, not a holiday, and still the U.S. stock market closes early. Whether an order or request submitted at 1:30 p.m. Eastern counts for that day or for the next one depends on a close time that a boolean holiday flag can't hold.

This post covers what the official calendars say, how two of them disagree on the same day, and a small Python model that gets the cutoff right. Every output below came from a real run of the script (Python 3.13, zoneinfo).

What the official calendars say

The NYSE publishes its holiday and early-close calendar on its Holidays & Trading Hours page. For the 2026-2028 table, its footnotes say each market closes early at 1:00 p.m. ET (1:15 p.m. for eligible options) on:

  • Friday, November 27, 2026 (day after Thanksgiving)
  • Thursday, December 24, 2026
  • Friday, November 26, 2027
  • Monday, July 3, 2028
  • Friday, November 24, 2028

The same page lists the regular core session as 9:30 a.m. to 4:00 p.m. ET. It also notes that some NYSE venues' late trading sessions close at 5:00 p.m. on early-close days, so "the market closed at 1:00" is only true of the core session.

The bond market keeps a different list. SIFMA's U.S. holiday schedule recommends 2:00 p.m. ET early closes on May 22, July 2, November 27, December 24 and December 31, 2026, and a 12:00 p.m. ET early close on Good Friday, April 3, 2026. SIFMA describes these as recommendations that apply to U.S. dollar fixed-income trading, and says early closes don't change the closing time for settlements.

Putting the two side by side for 2026:

  • Fri 2026-04-03 NYSE: closed SIFMA: early 12:00
  • Fri 2026-05-22 NYSE: open 16:00 SIFMA: early 14:00
  • Thu 2026-07-02 NYSE: open 16:00 SIFMA: early 14:00
  • Fri 2026-11-27 NYSE: early 13:00 SIFMA: early 14:00
  • Thu 2026-12-24 NYSE: early 13:00 SIFMA: early 14:00
  • Thu 2026-12-31 NYSE: open 16:00 SIFMA: early 14:00

Three things stand out. On Good Friday the NYSE is closed while SIFMA recommends a short bond session. On May 22, July 2 and December 31 the NYSE table shows no early close at all, but SIFMA does. And on the two days both have a half day, the times differ by an hour. "Is the market open?" has no single answer; the question needs a venue.

The bug: a flat 4:00 p.m. rule

Here's the common shape of the bug:

def counts_for(ts):
    d = ts.date()
    if is_closed(d) or ts.time() >= time(16, 0):
        d = next_open_day(d)
    return d

It treats every open day as having the same close. For a timestamp of 1:30 p.m. ET on December 24, 2026, it says "still open."

A model with a close time per date

Store a session per date instead of a flag: open (with a close time), early (with a different close time), or closed. Keep a calendar per venue.

@dataclass(frozen=True)
class Session:
    day: date
    status: str  # "open", "early", "closed"
    close: time | None  # local close time, None if closed

def nyse_session(d: date) -> Session:
    if d.weekday() >= 5 or d in NYSE_CLOSED:
        return Session(d, "closed", None)
    if d in NYSE_EARLY:
        return Session(d, "early", NYSE_EARLY[d])
    return Session(d, "open", NYSE_REGULAR_CLOSE)

def counts_for(ts: datetime, session_fn=nyse_session) -> date:
    """First day whose session is still open at ts (ts carries a time zone)."""
    local = ts.astimezone(ET)  # ET = ZoneInfo("America/New_York")
    d = local.date()
    while True:
        s = session_fn(d)
        if s.status != "closed":
            if d != local.date() or local.time() < s.close:
                return d
        d += timedelta(days=1)

Two details matter. The comparison is against the close time of that date, not a constant. And the timestamp is converted to the venue's zone first, so a caller in Seoul or London gets the same answer as one in New York.

Running it for a 1:30 p.m. ET order on Thursday, December 24, 2026:

  • naive 4:00 p.m. rule -> Thu 2026-12-24
  • with the early close -> Mon 2026-12-28
  • 12:59 p.m. ET -> Thu 2026-12-24

The next open day is Monday, December 28, because Friday the 25th is the Christmas holiday on the NYSE table and the 26th and 27th are a weekend. The naive rule is wrong by a full business day, and the error only shows up on the handful of days each year when it matters.

Half days across the year-end boundary

The 2027 table has a quirk worth testing. Christmas Day falls on a Saturday, so the NYSE closes on Friday, December 24, 2027, and the NYSE table lists no early close for the Thursday before it. Then in 2028, because January 1 is a Saturday, the NYSE page says no New Year's Day holiday is observed, so December 31, 2027 is an ordinary trading day.

  • Thu 2027-12-23 17:00 ET -> counts for Mon 2027-12-27
  • Fri 2027-12-31 10:00 ET -> counts for Fri 2027-12-31
  • Fri 2027-12-31 17:00 ET -> counts for Mon 2028-01-03
  • NYSE Fri 2027-12-24: closed | Fri 2027-12-31: open

The after-Thanksgiving half day behaves the same way. One minute either side of the 1:00 p.m. close flips the answer:

  • Fri 2026-11-27 13:01 ET -> counts for Mon 2026-11-30
  • Fri 2027-11-26 12:59 ET -> counts for Fri 2027-11-26
  • Fri 2027-11-26 13:01 ET -> counts for Mon 2027-11-29

Store the venue's local time, not a UTC instant

It's tempting to store each early close as a UTC time. Don't. The rule is "1:00 p.m. in New York," and the UTC equivalent moves with daylight saving time. The script converts two early-close moments:

  • Thu 2026-12-24 13:00 ET (EST) UTC Thu 2026-12-24 18:00 UTC Europe/London Thu 2026-12-24 18:00 GMT Asia/Seoul Fri 2026-12-25 03:00 KST Asia/Tokyo Fri 2026-12-25 03:00 JST
  • Mon 2028-07-03 13:00 ET (EDT) UTC Mon 2028-07-03 17:00 UTC Europe/London Mon 2028-07-03 18:00 BST Asia/Seoul Tue 2028-07-04 02:00 KST Asia/Tokyo Tue 2028-07-04 02:00 JST

The same local close is 18:00 UTC in winter and 17:00 UTC in summer. For anyone east of Greenwich, it also lands on the next calendar date. If a dashboard or SLA shows "closes 03:00 KST on the 25th," the business date that belongs to that session is still the 24th in New York. Keep the business date (venue-local) and the instant as two separate fields.

Checklist

  • Model a session per date (open / early / closed with a close time), not a holiday boolean.
  • Keep one calendar per venue or rule set. NYSE, SIFMA's bond recommendations, banks and your own business each have different lists.
  • Treat recommendations as recommendations. SIFMA says its early closes are not mandates, so make the close time configurable.
  • Compare in the venue's zone, and store the close as a local time plus a zone name.
  • Re-copy the dates from the publisher each year, and assert that every date is the weekday you expect. My script does that for every table entry.
  • Note what you left out. This model covers the NYSE core session only, not late sessions or options.

Counting days after the cutoff

Once the cutoff logic has told you which business day a request counts for, you usually still have to count forward, for example "three business days after that." For that part I use a plain date-level calculator where you enter your own closures, WorkdayMap. It doesn't model times of day, which is why the session model above is a separate step.

If you have a cutoff rule that doesn't fit a per-date close time, I'd like to hear about it in the comments.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.