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, T+1 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. -
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, then rolled.subtractBusinessDays(LocalDate date, int n) Walks backn >= 0business days — e.g. a fixing lag before settlement.unadjustedSchedule(LocalDate effectiveDate, LocalDate maturity, int paymentsPerYear) The unadjusted (theoretical) coupon dates strictly aftereffectiveDate.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, then rolled. Returns the adjusted payment dates strictly aftereffectiveDate, ascending (last = adjusted maturity). -
unadjustedSchedule
-