Class HolidayCalendars

java.lang.Object
com.quantfinlib.rates.HolidayCalendars

public final class HolidayCalendars extends Object
Rule-based holiday calendars for four settlement centres, generated as BusinessCalendar objects for a range of years.

The plain idea: a holiday is either a fixed date (25 December), a weekday rule (last Monday of May) or a date tied to Easter or to the equinox, plus a few one-off days a government declared. Writing the rules once means a calendar for 2040 is as correct as one for 2026, with the one-off days listed explicitly up to the date of this code.

Rules implemented (sources: the published holiday lists of each centre; evidence class published reference, checked by own tests against known dates):

  • HolidayCalendars.Market.NEW_YORK_FED: US federal holidays as observed by the Federal Reserve, which is the calendar for SOFR publication and USD settlement. New Year, Martin Luther King (3rd Mon Jan), Presidents (3rd Mon Feb), Memorial (last Mon May), Juneteenth (19 Jun, from 2022), Independence (4 Jul), Labor (1st Mon Sep), Columbus (2nd Mon Oct), Veterans (11 Nov), Thanksgiving (4th Thu Nov), Christmas. A holiday on Sunday is observed on Monday; a holiday on Saturday is not moved (the Fed is open the Friday before). This is not the SIFMA bond-market calendar, which also closes on Good Friday.
  • HolidayCalendars.Market.LONDON: England and Wales bank holidays. New Year, Good Friday, Easter Monday, Early May (1st Mon May), Spring (last Mon May), Summer (last Mon Aug), Christmas, Boxing Day, with weekend substitution to the next weekday, plus the moved and one-off days of 1999 to 2023 (millennium, royal weddings and jubilees, the 2020 VE Day move, the 2022 state funeral, the 2023 coronation).
  • HolidayCalendars.Market.TARGET: the TARGET2 closing days. New Year, Good Friday, Easter Monday, 1 May, 25 and 26 December. No substitution.
  • HolidayCalendars.Market.TOKYO: Japanese national holidays (supported from 2000 to 2099) plus the bank closing days 2 and 3 January and 31 December. Equinoxes by the standard approximation formula, Sunday substitute holidays (the next day that is not a holiday) and the "citizens' holiday" for a day sandwiched between two holidays; the 2019 accession days and the Olympic moves of 2020 and 2021.

Worked example: calendar(Market.NEW_YORK_FED, 2026, 2026) .addBusinessDays(2026-11-24, 3) skips Thanksgiving (Thu 26 Nov) and the weekend and returns Mon 30 Nov 2026; a weekends-only calendar returns Fri 27 Nov.

  • Method Details

    • calendar

      public static BusinessCalendar calendar(HolidayCalendars.Market market, int fromYear, int toYear)
      A business calendar for a market, holidays generated for every year in [fromYear, toYear]. Dates outside that range count only weekends as non-business days, so choose the range to cover the trade's whole life plus a margin.
      Parameters:
      market - the centre
      fromYear - first year, inclusive
      toYear - last year, inclusive
      Returns:
      the calendar
    • holidays

      public static Set<LocalDate> holidays(HolidayCalendars.Market market, int year)
      The weekday holidays of one year (holidays falling on a weekend and not moved are left out, since the weekend already closes the day).
      Parameters:
      market - the centre
      year - the year (Tokyo: 2000 to 2099)
      Returns:
      sorted holiday dates
    • easterSunday

      public static LocalDate easterSunday(int year)
      Gregorian Easter Sunday (the anonymous Gregorian algorithm, Meeus, Astronomical Algorithms, ch. 8).
      Parameters:
      year - the year, 1583 or later
      Returns:
      Easter Sunday