Class BusinessCalendar
Why this is a finance class and not a util: cash cannot move on a day
the payment system is closed, so every real-world date in a trade (the
settlement date, spot = trade + 2 business days in most FX pairs and T+1
for US equities; each coupon date; an option expiry) must land on a
business day, and which way a weekend date rolls changes the accrual
period and therefore the payment (DayCount then converts the
rolled dates to a year fraction). MODIFIED_FOLLOWING (roll
forward unless that crosses month-end, then backward) is the
near-universal swap convention precisely because plain following would
occasionally push a month's payment into the next month and break
month-bucketed accounting.
A holiday missing from the set silently shifts settlement by a day: the
classic source of small unexplained cash breaks between two systems that
disagree about, say, Whit Monday.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDate roll conventions for payment dates landing on non-business days.static enumWhere an irregular (stub) period goes when the dates do not divide into whole periods (ISDA 2006 definitions, section 4.14 and market practice). -
Method Summary
Modifier and TypeMethodDescriptionaddBusinessDays(LocalDate date, int n) Addsn >= 0business days — e.g.booleanisBusinessDay(LocalDate date) roll(LocalDate date, BusinessCalendar.Roll convention) Applies the roll convention to a date.schedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear, BusinessCalendar.Roll convention) Coupon payment schedule: unadjusted dates generated backward from maturity every12/paymentsPerYearmonths (short front stub, no end-of-month rule), then rolled.schedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear, BusinessCalendar.Roll convention, BusinessCalendar.StubType stub, boolean endOfMonth) Asschedule(LocalDate, LocalDate, int, Roll)with a stub type and EOM rule.static LocalDateshiftMonths(LocalDate anchor, long months, boolean endOfMonth) anchorshifted bymonths; withendOfMonthand an anchor on its month's last day, the result is the last day of its month.subtractBusinessDays(LocalDate date, int n) Walks backn >= 0business days — e.g. a fixing lag before settlement.unadjustedSchedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear) Unadjusted coupon dates strictly aftereffectiveDate: short front stub, no EOM rule.unadjustedSchedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear, BusinessCalendar.StubType stub, boolean endOfMonth) Unadjusted (theoretical) period end dates strictly aftereffectiveDate, ascending, the last one beingmaturity(or, for back stubs, alsomaturity).union(BusinessCalendar other) The joint calendar of two trading centers: a day is a business day only when it is one in both (holiday sets union).static BusinessCalendarstatic BusinessCalendarwithHolidays(LocalDate... holidays) static BusinessCalendarwithHolidays(Set<LocalDate> holidays)
-
Method Details
-
weekendsOnly
-
withHolidays
-
withHolidays
-
union
The joint calendar of two trading centers: a day is a business day only when it is one in both (holiday sets union). This is the FX settlement rule — one calendar object, so every roll convention and schedule helper works unchanged on the pair, instead of each caller re-implementing dual-calendar walks. -
isBusinessDay
-
roll
Applies the roll convention to a date. -
addBusinessDays
-
subtractBusinessDays
-
schedule
public List<LocalDate> schedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear, BusinessCalendar.Roll convention) Coupon payment schedule: unadjusted dates generated backward from maturity every12/paymentsPerYearmonths (short front stub, no end-of-month rule), then rolled. Returns the adjusted payment dates strictly aftereffectiveDate, ascending (last = adjusted maturity). -
schedule
public List<LocalDate> schedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear, BusinessCalendar.Roll convention, BusinessCalendar.StubType stub, boolean endOfMonth) Asschedule(LocalDate, LocalDate, int, Roll)with a stub type and EOM rule. -
unadjustedSchedule
-
unadjustedSchedule
public static List<LocalDate> unadjustedSchedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear, BusinessCalendar.StubType stub, boolean endOfMonth) Unadjusted (theoretical) period end dates strictly aftereffectiveDate, ascending, the last one beingmaturity(or, for back stubs, alsomaturity).Every date is computed from the fixed anchor (maturity for front stubs, the effective date for back stubs) as anchor ± k·months, never by stepping from the previous date:
LocalDate.minusMonths(long)clamps the day of month, and stepping would carry a clamp forward (31 Aug, 28 Feb, then 28 Aug instead of 31 Aug).With
endOfMonthand an anchor on the last day of its month, every generated date is moved to the last day of its month (the EOM rule used for bonds and swaps; a 28 Feb 2027 maturity then pays on 31 Aug, not 28 Aug). -
shiftMonths
-