Skip to content

Commit

Permalink
Merge 1e019ea into d5bfae6
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulXiCao committed Jan 29, 2024
2 parents d5bfae6 + 1e019ea commit 5efe936
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
11 changes: 9 additions & 2 deletions ql/time/calendars/unitedstates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,16 @@ namespace QuantLib {


bool UnitedStates::SofrImpl::isBusinessDay(const Date& date) const {
// Good Friday 2023 was only a half close for SIFMA but SOFR didn't fix
if (date == Date(7, April, 2023))
// so far (that is, up to 2023 at the time of this change) SOFR never fixed
// on Good Friday. We're extrapolating that pattern. This might change if
// a fixing on Good Friday occurs in future years.
const Day dY = date.dayOfYear();
const Year y = date.year();

// Good Friday
if (dY == (easterMonday(y) - 3))
return false;

return GovernmentBondImpl::isBusinessDay(date);
}

Expand Down
21 changes: 10 additions & 11 deletions test-suite/calendars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,16 @@ BOOST_AUTO_TEST_CASE(testUSNewYorkStockExchange) {
}

BOOST_AUTO_TEST_CASE(testSOFR) {
BOOST_TEST_MESSAGE("Testing extra non-fixing day for SOFR...");

auto fedCalendar = UnitedStates(UnitedStates::GovernmentBond);
auto testDate = Date(7, April, 2023); // Good Friday 2023 was only a half close but SOFR didn't fix

if (fedCalendar.isHoliday(testDate))
BOOST_ERROR(testDate << " should not be a holiday for " << fedCalendar.name());

auto sofr = Sofr();
if (sofr.isValidFixingDate(testDate))
BOOST_ERROR(testDate << " should not be a fixing date for " << sofr.name());
BOOST_TEST_MESSAGE("Testing holidays for SOFR...");

// Good Friday
for (const Date goodFriday :
{Date(14, April, 2017), Date(30, March, 2018), Date(19, April, 2019),
Date(10, April, 2020), Date(2, April, 2021), Date(15, April, 2022), Date(7, April, 2023),
Date(29, March, 2024), Date(18, April, 2025), Date(3, April, 2026), Date(26, March, 2027),
Date(14, April, 2028), Date(30, March, 2029), Date(19, April, 2030),
Date(11, April, 2031)})
BOOST_TEST(UnitedStates(UnitedStates::SOFR).isHoliday(goodFriday));
}

BOOST_AUTO_TEST_CASE(testUSFederalReserveJuneteenth) {
Expand Down

0 comments on commit 5efe936

Please sign in to comment.