Repository navigation
Observe New Year's, Christmas and Boxing Day substitute holidays in the AUSTRALIA calendar - #462
Merged
domokane merged 1 commit intoNov 20, 2026
Conversation
…he AUSTRALIA calendar holiday_australia only accepted 1 January for New Year's Day and only a Monday for the observed Christmas (27 December) and Boxing Day (28 December). New Year's Day on a weekend is observed on Monday 2 or 3 January, Christmas on a Sunday on Tuesday 27 December, and Boxing Day on a Sunday on Tuesday 28 December, as holiday_sydney already does.
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.
holiday_australiamisses some of the extra weekday holidays that Australia adds when New Year's Day, Christmas Day or Boxing Day falls on a weekend:The New Year's Day check only accepts 1 January (calendar.py L836-L837), and the observed Christmas and Boxing Day lines only accept a Monday (L875-L891).
holiday_sydneyin the same file already handles all of these cases (L915-L923, L1023-L1050), and so doesholiday_australia_rits, which closes only on holidays observed in both NSW and Victoria (L1075-L1082, L1144-L1166).AUSTRALIA is the default AUD calendar (currency.py L65), so these days are treated as working days wherever AUD's calendar is used. For example,
fx_spot_date("AUDUSD", Date(22, 12, 2022))gives Tuesday 27 December, a public holiday, instead of Wednesday 28 December, andCalendar(CalendarTypes.AUSTRALIA).add_business_days(Date(23, 12, 2022), 1)also gives 27 December.Change
Nothing else in
holiday_australiachanges.References:
The sources above describe the current rule. Queensland dates its provision "From Christmas Day 2011", and I haven't checked each state's rules for earlier years. Like QuantLib's
Australiacalendar, this change applies the current rule to all years.Tests
test_australia_new_year_observedandtest_australia_christmas_and_boxing_day_observedtotests/unit/test_calendar.py. They check the extra holidays above in several years, that the next weekday after each one is a business day, that the Saturday-Boxing-Day years still give only Monday 28 December, and thatadd_business_dayssteps over the new holidays.test_australiaintests/regression/regression_test_calendar.py(28 December 2026, 28 December 2027 and 3 January 2028; the first already held before this change).regression_test_calendar_GOLDEN.testLogby hand: TUE DEC 28 2021, MON JAN 03 2022, TUE DEC 27 2022, MON JAN 02 2023, TUE DEC 28 2027, MON JAN 03 2028.Testing
pytest tests/unit/test_calendar.pywithout thecalendar.pychange: the 2 new tests fail.pytestwith the change: 1882 passed.python regression_test_calendar.py(intests/regression/): 0 errors and 0 warnings against the updated golden file (4294 lines compared).Calendar(CalendarTypes.AUSTRALIA)with QuantLib 1.44Australia(Settlement)for every weekday in January and December (the months this change touches) from 1990 to 2060: no differences after the change.Run on macOS with Python 3.12.9 and the pinned
requirements.txt(numpy 2.3.5, numba 0.67.0).