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-backedCalendarimplementation.- jurisdictions ๐
- Jurisdiction calendars, identified by FpML business-center codes (bare)
and qualified
BASE.SUFFIXmarket codes. - lookup ๐
- Calendar lookup DSL.
- settlement_
lag ๐ SettlementLagโ the single โadvance a lag, then settleโ primitive.
Structsยง
- Calendar
Spec - A calendar stated as data, for ingestion: the code it binds, the holidays it closes, and the weekdays that are not business days.
- Data
Calendar - A
Calendarbacked by a precomputed business-day grid and a weekend mask. - Germany
- Germany (Frankfurt) settlement calendar (
DEFR). - Joint
Calendar - A calendar combining several underlying calendars by a
JointCalendarRule. - Null
Calendar - A calendar on which every day is a business day.
- Settlement
Lag - โAdvance
nSettlementLagUnits onbusiness, then settle.โ - Target
- TARGET (euro) settlement calendar (
EUTA). - United
Kingdom - United Kingdom settlement calendar (
GBLO). - United
States - United States calendars, parameterised by
UsMarket. - Unknown
Business Center - Error parsing a calendar code or alias.
- Weekends
Only - A calendar whose only closures are Saturdays and Sundays.
Enumsยง
- Business
Center - A jurisdiction settlement calendar, identified by its canonical FpML business-center code.
- Calendar
Amend Error - A derivation that cannot be carried out.
- Calendar
Ingest Error - Why a calendar could not be ingested.
- Calendar
Parse Error - Error resolving a calendar-lookup string.
- Joint
Calendar Rule - How a
JointCalendarcombines its members. - Market
Calendar - A qualified
BASE.SUFFIXmarket 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. - Settlement
LagUnit - The unit a
SettlementLagcounts 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
Periodto 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 inclosingand opening those inopening. - 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.codeto a calendar built fromspec, 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.