Skip to content

Observe Boxing Day on Monday 28 and Tuesday 27 December in the CANADA calendar - #461

Merged
domokane merged 1 commit into
FinancePy-Org:masterfrom
QuantIntellect:fix/canada-boxing-day-observed
Nov 19, 2026
Merged

domokane merged 1 commit into
FinancePy-Org:masterfrom
QuantIntellect:fix/canada-boxing-day-observed

Conversation

@QuantIntellect

@QuantIntellect QuantIntellect commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #458

holiday_canada misses two of the three cases where Boxing Day moves off 26 December:

25 December Christmas observed Boxing Day observed Before this PR
Friday (2015, 2020, 2026) Fri 25 Mon 28 missing
Saturday (2021, 2027) Mon 27 Tue 28 correct
Sunday (2016, 2022) Mon 26 Tue 27 missing

The observed Boxing Day lines (calendar.py L2706-L2710) only accept 27 December on a Monday and 28 December on a Tuesday. The Christmas line just above them already covers 27 December on a Monday. That leaves out Monday 28 December (26 December on a Saturday) and Tuesday 27 December (Christmas observed on Monday 26 December). holiday_toronto in the same file already handles both (L2871-L2877).

CANADA is the default CAD calendar (currency.py L64), so business-day adjustment and counting for CAD treat these days as working days. For example, add_business_days(Date(24, 12, 2026), 1) gives Monday 28 December instead of Tuesday 29 December.

Change

The two observed Boxing Day lines now accept 27 December on a Tuesday and 28 December on a Monday or Tuesday, with a comment saying when each case applies. Nothing else in holiday_canada changes. Together with the existing Christmas lines this gives the same Christmas and Boxing Day dates as the holiday_toronto rule.

References:

  • canada-holidays.ca, federal holidays 2022 (Christmas observed Monday 26 December, Boxing Day Tuesday 27 December) and 2026 (Boxing Day observed Monday 28 December)
  • TSX market holidays, calendar: "In Lieu of Boxing Day - Monday, December 28, 2026"
  • Bank of Canada holiday schedule: Boxing Day on 28 December 2026

Tests

  • Added test_canada_boxing_day_observed to tests/unit/test_calendar.py. It checks Monday 28 December in 2015, 2020 and 2026 and Tuesday 27 December in 2016 and 2022. It also checks that the Saturday-Christmas years 2021 and 2027 still give Monday 27 and Tuesday 28 December, that the next weekday after each holiday is a business day, and that add_business_days steps over the new holidays in 2022 and 2026.
  • Added Monday 28 December 2026 to test_canada in tests/regression/regression_test_calendar.py.
  • Added TUE DEC 27 2022 and MON DEC 28 2026 to the CANADA block of regression_test_calendar_GOLDEN.testLog. These are the only CANADA dates in 2021-2030 that change. I added the two lines by hand rather than regenerating the whole file, as Do not close US government securities market on 31 Dec when 1 Jan is a Saturday #457 and Do not treat Monday 3 January as a US holiday when 1 January is a Saturday #459 did, and the regression run below compares the new output against them.

Testing

  • pytest tests/unit/test_calendar.py -k canada_boxing without the calendar.py change: 1 failed (test_canada_boxing_day_observed), as expected.
  • pytest with the change: 1880 passed.
  • python regression_test_calendar.py (in tests/regression/): 0 errors and 0 warnings against the updated golden file (4288 lines compared). I didn't run the other regression modules, since the change only touches holiday_canada.

Run on macOS with Python 3.11.14, numpy 2.3, numba 0.67. CI's Python 3.12 wasn't available locally.

Thanks @suchishah2807 for the clear report and the suggested rule. If you already had a fix in progress, I'm happy to close this one.

… calendar

holiday_canada only accepted an observed Boxing Day on Monday 27 or
Tuesday 28 December. Boxing Day is also observed on Monday 28 December
when 26 December is a Saturday (2015, 2020, 2026) and on Tuesday 27
December when Christmas falls on a Sunday (2016, 2022), as
holiday_toronto already does.

Fixes FinancePy-Org#458
@QuantIntellect
QuantIntellect force-pushed the fix/canada-boxing-day-observed branch from 61f107b to 4bd28d3 Compare November 19, 2026 17:24
@suchishah2807

Copy link
Copy Markdown
Contributor

Thanks for picking this up. I don't have a fix in progress, so please go ahead.

@domokane
domokane merged commit 3e90210 into FinancePy-Org:master Nov 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CANADA calendar misses Boxing Day observed on Monday 28 Dec and Tuesday 27 Dec

3 participants