Add joint calendar support: Calendar accepts a list of calendar types#247
Open
DMZ22 wants to merge 1 commit into
Open
Add joint calendar support: Calendar accepts a list of calendar types#247DMZ22 wants to merge 1 commit into
DMZ22 wants to merge 1 commit into
Conversation
This was referenced Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #228 — joint (multi-market) calendars for business-day adjustment, e.g. a swap with a USD SOFR floating leg and a EUR fixed leg that must avoid both US and TARGET holidays.
Design
Calendarnow also accepts a list (or tuple) ofCalendarTypes:JointCalendar).list(CalendarTypes)and constructCalendar(t)for each member, so adding aJOINTmember would break them. Instead, for a joint calendarcal_typeholds the constituent types as a tuple, which never compares equal to anyCalendarTypesmember — so every existing code path (the NONE/WEEKEND fast paths,adjust,fast_adjust,add_business_days,get_holiday_list) works unchanged because they all funnel throughis_business_day/is_holiday.CalendarTypesentry raisesFinError, matching the existing validation style.str()/repr()render asJOINT(UNITED_STATES,TARGET).Scope
The change is deliberately confined to
Calendarplus tests.Scheduleand the product classes still annotatecal_type: CalendarTypes; if this API looks right to you, I'm happy to follow up with a small PR relaxing those annotations/checks so a list can be passed straight throughScheduleand the swap constructors.Testing
unit_tests/test_FinCalendar.py, including: a day-by-day sweep over 2020–2023 asserting the joint calendar's business days are exactly the intersection of the single calendars'; adjustment chaining across consecutive UK-only holidays (Good Friday → Easter Monday 2021, where a US-only calendar stays put but US+UK must jump to the Tuesday);fast_adjust≡adjustfor joint calendars across all conventions;add_business_daysround-trips;get_holiday_listunion; collapse/dedup semantics;str/repr; and error cases.unit_tests/test_FinCalendar.py: 285 passed.pyproject.tomldeclares>=3.10).pylinton the changed file: 10.00/10.