Calculate spot dates from the actual evaluation date (#753)#2653
Open
Excal-rs wants to merge 1 commit into
Open
Calculate spot dates from the actual evaluation date (#753)#2653Excal-rs wants to merge 1 commit into
Excal-rs wants to merge 1 commit into
Conversation
Settlement and fixing days are counted from the actual evaluation date, without first rolling it to a business day: Calendar::advance already skips non-business days, so the pre-adjustment added an extra business day whenever the evaluation date was a holiday or weekend. The adjustment is removed from MakeVanillaSwap and MakeOIS (when explicit settlement days are given) and from DepositRateHelper, FraRateHelper and BMASwapRateHelper. MakeVanillaSwap and MakeOIS also gain an optional settlement calendar, defaulting to the float and overnight calendar respectively, since the calendar used for the settlement-day advance is not always the index calendar (e.g. USD SOFR swaps).
|
Thanks for opening this pull request! It might take a while before we look at it, so don't worry if there seems to be no feedback. We'll get to it. |
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.
This addresses #753, using the approach @eltoder confirmed there.
Calendar::advance() already skips non business days. Because of this, adjusting the evaluation date before advancing added an extra business day whenever the evaluation date was a holiday or weekend. For example T+2 on TARGET from Saturday 20 June 2026 gave 24 June instead of 23 June.
This PR does the following.
Two checks in testMakeOISDefaultSettlementDays expected the old behaviour on a weekend evaluation date, so they were updated. The rest of the test suite passes unchanged.
The spot date paths that go through Index::valueDate, and the same pattern in MakeCms, MakeSwaption, MakeMultipleResetsSwap and FxSwapRateHelper, are left for a follow up. Happy to take those too.
Claude Code was used while working on this, mainly for confirming the issue still exists, finding the places that needed the fix, and for testing and debugging.