Expand description
Holiday calendars, business-day conventions and schedule generation.
Holidays are computed from rules (Easter algorithm, nth-weekday-of-month,
observance shifts), not stored as date lists, so any year works. The
named calendars cover the markets an equity derivatives book usually
needs — weekends-only, TARGET (EUR), NYSE (US equities), UK bank
holidays — and Calendar::Custom takes an explicit holiday list for
anything else. One-off closures (mourning days, exchange incidents) are
not modelled; add them through Custom.
use chrono::NaiveDate;
use rustyqlib::core::calendar::{BusinessDayConvention, Calendar};
let nyse = Calendar::UsNyse;
let good_friday = NaiveDate::from_ymd_opt(2026, 4, 3).unwrap();
assert!(!nyse.is_business_day(good_friday));
// settle T+2 over a holiday weekend
let trade = NaiveDate::from_ymd_opt(2026, 4, 1).unwrap();
assert_eq!(
nyse.add_business_days(trade, 2),
NaiveDate::from_ymd_opt(2026, 4, 6).unwrap()
);
let _ = BusinessDayConvention::ModifiedFollowing;Structs§
- Schedule
- A periodic date schedule: unadjusted anchor dates rolled from a period, then business-day adjusted. Used for autocallable observation dates, coupon schedules and averaging fixings.
Enums§
- Business
DayConvention - How a date falling on a non-business day is adjusted.
- Calendar
- A holiday calendar: weekends plus market-specific holidays.
- Date
Generation - Direction of periodic date generation. Backward (from termination) is the market default: the stub, if any, lands at the front.
- Period
- A calendar period for
Calendar::advance.Dayscounts business days; the others move in calendar time and then adjust.
Functions§
- easter_
sunday - Easter Sunday by the Meeus/Jones/Butcher Gregorian algorithm.