Repository navigation
Fix CDSCurve calibration to honor explicit cash settlement date - #499
Merged
domokane merged 1 commit intoDec 4, 2026
Merged
Conversation
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.
Fix CDSCurve calibration to honor explicit cash settlement date
Problem
The market-curves
CDSCurvestores an optionalsettle_dt, but its bootstrap previously resolved settlement from only the curve anchor. Both O’Kane–Turnbull and ISDA therefore calibrated the accrued coupon rebate at each instrument’s default settlement even when an override was provided. A calibration trade could have a material nonzero clean PV at the requested settlement. Confirmed onef59d2ad99a707c19fb5e7dc6d216bdf7fa959ed. The published 1.1.2 constructor predates the override.Reproduction
On the base both models return about −$28.22 at January 29. After the correction the clean values are about $0.0000136 and $0.0000132. On a fixed curve, only the clean accrued rebate changes with cash settlement. Its PV change equals
N × c × accrued_fraction × [D(Jan 29) − D(Jan 18)]. Independently discounting $18,750 accrued cash gives −$28.2205486496064. The day-14 calibration target is zero clean PV at the requested date. ISDA Standard CDS examplesChange and compatibility
Pass the curve’s stored override into the existing
CDS.get_settle_dtcall inCDSCurve.build_curve(). This uses the instrument’s existing date validation and calendar-specific default. Omitted settlement and explicitNonestill resolve through the instrument calendar. An explicit date before the anchor now raises the existingFinErrorduring nonempty calibration. Spread, rate and recovery sensitivities use the same corrected bootstrap when rebuilding. Pricing signatures, settlement rules and solvers retain their existing contracts.Validation
The new settlement tests cover both pricing models, default equivalence, same-day settlement, an increasing quote basket, a pre-anchor input, the fixed-curve identity, the zero-rate limit and all three sensitivity rebuilds. The 16-case file yields ten expected failures and six passing controls on the base. All 16 pass with the correction, together with the 755-test focused selection and all 7,164 scenarios in the standalone ISDA grid. The broader Windows/Python 3.12 unit run reported 2,142 passes and two inflation-swap constructor keyword failures that also occur on the unchanged base. The 14 legacy modules reported the same comparator differences before and after. Run the focused regression file with
python -m pytest -vv tests/unit/test_cds_curve_cash_settlement.py.AI assistance
. The Phase 1 evidence was independently reviewed. The Phase 2 patch and outputs are packaged for the submitter’s own review before submission.