Skip to main content

Module calendars

Module calendars 

Expand description

Business-day calendars and the Calendar abstraction.

The module root holds the Calendar trait and its rule-based substrate (NullCalendar, WeekendsOnly, JointCalendar). Jurisdiction calendars are data-backed DataCalendar instances built from generated holiday tables and reached through FpML business-center codes (BusinessCenter) or the lookup DSL ([lookup]). A calendar answers for one axis; a value date that must also be good on a second calendar is a SettlementLag.

Modulesยง

data
Generated jurisdiction holiday tables.
data_calendar ๐Ÿ”’
DataCalendar โ€” the single data-backed Calendar implementation.
jurisdictions ๐Ÿ”’
Jurisdiction calendars, identified by FpML business-center codes (bare) and qualified BASE.SUFFIX market codes.
lookup ๐Ÿ”’
Calendar lookup DSL.
settlement_lag ๐Ÿ”’
SettlementLag โ€” the single โ€œadvance a lag, then settleโ€ primitive.

Structsยง

CalendarSpec
A calendar stated as data, for ingestion: the code it binds, the holidays it closes, and the weekdays that are not business days.
DataCalendar
A Calendar backed by a precomputed business-day grid and a weekend mask.
Germany
Germany (Frankfurt) settlement calendar (DEFR).
JointCalendar
A calendar combining several underlying calendars by a JointCalendarRule.
NullCalendar
A calendar on which every day is a business day.
SettlementLag
โ€œAdvance n SettlementLagUnits on business, then settle.โ€
Target
TARGET (euro) settlement calendar (EUTA).
UnitedKingdom
United Kingdom settlement calendar (GBLO).
UnitedStates
United States calendars, parameterised by UsMarket.
UnknownBusinessCenter
Error parsing a calendar code or alias.
WeekendsOnly
A calendar whose only closures are Saturdays and Sundays.

Enumsยง

BusinessCenter
A jurisdiction settlement calendar, identified by its canonical FpML business-center code.
CalendarAmendError
A derivation that cannot be carried out.
CalendarIngestError
Why a calendar could not be ingested.
CalendarParseError
Error resolving a calendar-lookup string.
JointCalendarRule
How a JointCalendar combines its members.
MarketCalendar
A qualified BASE.SUFFIX market calendar (e.g. USNY.NYSE). The base is an FpML business-center code; the suffix is a helixio-defined market qualifier the FpML scheme cannot express.
SettlementLagUnit
The unit a SettlementLag counts its offset in.
UsMarket
A United States market with its own calendar.

Traitsยง

Calendar
A business-day calendar: which dates are good business days, plus the date-rolling helpers built on that predicate.

Functionsยง

add_days ๐Ÿ”’
add_months ๐Ÿ”’
add_period
Adds a Period to a date using calendar arithmetic (months/years preserve end-of-month clamping via chrono). Negative multipliers subtract.
amended
Derives a new calendar from base, closing the dates in closing and opening those in opening.
center
Resolves a center code to a calendar, panicking on a wiring error.
days_between_impl ๐Ÿ”’
Counts business days for the forward case (from < to) with endpoint inclusion flags. The last endpoint is counted up front when included; the loop covers [from-or-from+1, to).
ingest_calendar
Binds spec.code to a calendar built from spec, process-wide.
ingest_calendars
Ingests every spec in order; a later spec for the same code wins.
ingested_calendars
The codes ingested this process, sorted โ€” what a run records to say which calendars it overrode or added.
joint_is_business_day ๐Ÿ”’
The joint per-day classification straight off the members.
last_day_of_month
The last calendar day of dateโ€™s month โ€” calendar-blind: it ignores weekends and holidays, so it can land on a day no market is open.
lookup
Resolves a lookup string to a calendar.