feat: add reset-aware XCCY pricing and joint calibration#230
Conversation
Define fixing, reset, in-progress valuation, and three-block calibration contracts. Include executable test, Jacobian, binding, and benchmark acceptance criteria.
Use the dal_public_tests executable from the CMake build tree so the implementation plan passes documentation integrity checks.
Add explicit valuation, collateral, and immutable fixing context to XCCY basis calibration. Route future and in-progress MTM instruments through the typed pricing kernel, provide analytic and bumped Jacobian options, and cover central-difference diagnostics.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 200 |
| Duplication | 56 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Coverage Report for CI Build 29366967662Coverage increased (+1.0%) to 88.399%Details
Uncovered Changes
Coverage Regressions7 previously-covered lines in 4 files lost coverage.
Coverage Stats
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR extends DAL’s cross-currency swap stack to support reset-aware notionals (fixed/resettable/MTM), deterministic in-progress valuation via immutable fixing snapshots, and a simultaneous domestic/foreign/basis joint calibration surface (including Jacobian/range diagnostics) across core C++, public C++, Python, and Excel.
Changes:
- Added reset-aware XCCY configuration + immutable
MarketFixingSnapshot_, and wired pricing to support in-progress trades. - Implemented staged basis calibration enhancements and introduced joint domestic/foreign/basis calibration results with Jacobian/layout metadata.
- Exposed new APIs through dal-public, dal-python, and dal-excel (including Machinist enums, docs, tests, benchmarks, and a runnable example).
Reviewed changes
Copilot reviewed 94 out of 94 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/superpowers/specs/2026-07-13-xccy-resettable-mtm-design.md | Design/spec narrative for resettable/MTM + joint calibration behavior. |
| docs/superpowers/specs/2026-07-13-xccy-resettable-mtm-benchmark-addendum.md | Benchmark workload and regression protocol addendum for xccy_perf. |
| docs/superpowers/specs/2026-07-13-xccy-in-progress-rate-fixing-addendum.md | Addendum expanding fixings to a generalized rate+FX snapshot contract. |
| docs/superpowers/plans/2026-07-13-xccy-resettable-mtm-plan-corrections.md | Corrections to the implementation plan and build/test constraints. |
| docs/README.md | Updates the documentation index to reflect new XCCY capabilities. |
| docs/public-api.md | Documents new public C++/Python/Excel calibration and XCCY reset surfaces. |
| docs/methodology/yield_curve_jacobian.md | Adds joint XCCY Jacobian layout/interpretation guidance. |
| dal-python/tests/test_xccy_resettable.py | Python coverage for resettable/MTM config, snapshot semantics, and in-progress behavior. |
| dal-python/tests/test_xccy_joint.py | Python coverage for joint XCCY calibration result layout + options toggles. |
| dal-python/tests/test_xccy_calibration.py | Python coverage for new staged-XCCY builder fields and legacy overload preservation. |
| dal-python/src/bindings/calendar.cpp | Exposes PRECEDING business-day convention to Python. |
| dal-python/README.md | Documents staged + joint XCCY calibration and resettable snapshot usage in Python. |
| dal-public/tests/test_curve_protocol.cpp | Public facade tests for FX reset convention + nested fixing snapshot builder. |
| dal-public/tests/test_curve_instrument.cpp | Public facade tests for config-builder XCCY construction and legacy overload behavior. |
| dal-public/src/curveprotocol.hpp | Adds FxResetConventionNew and MarketFixingSnapshotNew builders. |
| dal-public/src/curveinstrument.hpp | Adds CrossCurrencySwapConfigBuilder_ and config-based XCCY constructor overload. |
| dal-public/src/xccycalibration.hpp | Adds staged-XCCY new fields and joint-XCCY builder + result accessors. |
| dal-public/src/xccycalibration.cpp | Implements new builder Build() wiring and joint result accessors. |
| dal-excel/tests/test_excel_api.cpp | Adds portable Excel API smoke coverage for configured XCCY + joint calibration getters. |
| dal-excel/src/__xccy_test_api.hpp | Test-only Excel API surface for portable smoke tests. |
| dal-excel/src/__curveprotocol.cpp | Adds Excel functions for FX reset conventions + fixing snapshot construction. |
| dal-excel/src/__curveinstrument.cpp | Adds Excel functions for XCCY config handles + instrument construction from config. |
| dal-excel/src/__curve_storable.hpp | Adds storables for FX reset conventions, fixing snapshots, and joint XCCY results. |
| dal-excel/README.md | Documents new Excel resettable/joint XCCY worksheet function families. |
| dal-excel/CMakeLists.txt | Adds compile defs for test API import/export to support portable smoke tests. |
| dal-excel/auto/MG_XccyResetConvention_New_public.inc | Generated Excel registration stub for XCCYRESETCONVENTION.NEW. |
| dal-excel/auto/MG_XccyResetConvention_New_public.htm | Generated Excel help for XCCYRESETCONVENTION.NEW. |
| dal-excel/auto/MG_MarketFixingSnapshot_New_public.inc | Generated Excel registration stub for MARKETFIXINGSNAPSHOT.NEW. |
| dal-excel/auto/MG_MarketFixingSnapshot_New_public.htm | Generated Excel help for MARKETFIXINGSNAPSHOT.NEW. |
| dal-excel/auto/MG_CrossCurrencySwapConfig_New_public.inc | Generated Excel registration stub for CROSSCURRENCYSWAPCONFIG.NEW. |
| dal-excel/auto/MG_CrossCurrencySwapConfig_New_public.htm | Generated Excel help for CROSSCURRENCYSWAPCONFIG.NEW. |
| dal-excel/auto/MG_CrossCurrencySwap_Config_New_public.inc | Generated Excel registration stub for CROSSCURRENCYSWAP.CONFIG.NEW. |
| dal-excel/auto/MG_CrossCurrencySwap_Config_New_public.htm | Generated Excel help for CROSSCURRENCYSWAP.CONFIG.NEW. |
| dal-excel/auto/MG_Calibrate_JointXccy_public.inc | Generated Excel registration stub for CALIBRATE.JOINTXCCY. |
| dal-excel/auto/MG_Calibrate_JointXccy_public.htm | Generated Excel help for CALIBRATE.JOINTXCCY. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_public.inc | Generated Excel getter stub for matrix-valued joint result views. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_public.htm | Generated Excel help for joint result matrix-valued views. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_DomesticBlock_public.inc | Generated Excel getter stub for solved domestic block handle. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_DomesticBlock_public.htm | Generated Excel help for solved domestic block handle getter. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_ForeignBlock_public.inc | Generated Excel getter stub for solved foreign block handle. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_ForeignBlock_public.htm | Generated Excel help for solved foreign block handle getter. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_BasisCurve_public.inc | Generated Excel getter stub for solved basis curve handle. |
| dal-excel/auto/MG_JointXccyCalibrationResult_Get_BasisCurve_public.htm | Generated Excel help for solved basis curve handle getter. |
| dal-cpp/tests/time/test_schedules.cpp | Adds Preceding adjustment coverage + enum ordinal preservation test. |
| dal-cpp/tests/currency/test_currencydata.cpp | Updates XCS convention test to reflect removal of notional-mode booleans. |
| dal-cpp/tests/math/optimization/test_underdetermined.cpp | Adds regression tests for effective inverse and Jacobian-at-solution behavior. |
| dal-cpp/tests/indice/test_fixingsnapshot.cpp | Adds core tests for snapshot canonical FX names, reverse resolution, and immutability. |
| dal-cpp/tests/curve/test_joint_calibration.cpp | Adds joint calibration tests around display-name extraction behavior. |
| dal-cpp/tests/curve/test_joint_analytic_jacobian.cpp | Refactors + extends central-difference validation helpers for joint Jacobians. |
| dal-cpp/tests/curve/test_xccyjointcalibration.cpp | Core tests for joint XCCY calibration end-to-end behavior. |
| dal-cpp/tests/curve/test_xccyjointjacobian.cpp | Core tests for joint XCCY Jacobian correctness/shape. |
| dal-cpp/examples/xccy_mtm_calibration/xccy_mtm_calibration.cpp | Runnable example demonstrating recovery + Jacobian shape for joint XCCY MTM calibration. |
| dal-cpp/examples/xccy_mtm_calibration/CMakeLists.txt | Adds build/install target for the new joint XCCY example. |
| dal-cpp/examples/CMakeLists.txt | Registers the new xccy_mtm_calibration example target. |
| dal-cpp/benchmarks/xccy_perf/CMakeLists.txt | Adds the dedicated xccy_perf benchmark target. |
| dal-cpp/benchmarks/CMakeLists.txt | Registers xccy_perf in the benchmark target list. |
| dal-cpp/dal/time/schedules.hpp | Documents Preceding as a business-day convention alternative. |
| dal-cpp/dal/time/holidays.cpp | Implements Preceding adjustment in Holidays::Adjust. |
| dal-cpp/dal/storage/_repository.cpp | Ensures repository-backed fixings store is installed at load time. |
| dal-cpp/dal/protocol/rateconvention.hpp | Removes legacy XCCY notional-mode booleans from CrossCurrencyConvention_. |
| dal-cpp/dal/math/optimization/underdetermined.cpp | Refactors Find/backtrack plumbing and adds Jacobian-at-solution path for diagnostics. |
| dal-cpp/dal/indice/index/fx.hpp | Centralizes FX index naming to canonical FX[foreign/domestic]. |
| dal-cpp/dal/indice/index/fx.cpp | Implements canonical FX naming helpers and uses them in Index::Fx_. |
| dal-cpp/dal/indice/fixingsnapshot.hpp | Introduces immutable MarketFixingSnapshot_ and global snapshot helper. |
| dal-cpp/dal/indice/fixingsnapshot.cpp | Implements snapshot validation, reverse FX resolution, and global-store capture. |
| dal-cpp/dal/curve/xccypricing.hpp | Adds cashflow planning + fixing requests + typed market view for XCCY pricing kernels. |
| dal-cpp/dal/curve/xccynotionalmode.hpp | Adds Machinist markup for XccyNotionalMode_ (FIXED/RESETTABLE/MTM). |
| dal-cpp/dal/curve/xccyinstrument.hpp | Adds reset-aware config types and config-based swap constructor/accessor. |
| dal-cpp/dal/curve/xccyinstrument.cpp | Switches pricing to the new plan/kernel path and snapshot-based fixing resolution. |
| dal-cpp/dal/curve/xccycalibration.hpp | Extends XCCY market/spec for valuation time, collateral currency, fixings, and options. |
| dal-cpp/dal/curve/xccycalibration.cpp | Refactors market construction and delegates staged calibration to new implementation. |
| dal-cpp/dal/curve/xccyjointcalibration.hpp | Adds core joint XCCY spec/options/result surface. |
| dal-cpp/dal/curve/xccyjointcalibration.cpp | Implements joint domestic/foreign/basis calibration and diagnostics assembly. |
| dal-cpp/dal/curve/jointcalibration_internal.hpp | Internal factoring to share stacked-curve helpers across joint solvers. |
| dal-cpp/dal/curve/curvejacobian.hpp | Includes banded.hpp explicitly (header dependency hygiene). |
| dal-cpp/dal/auto/MG_XccyNotionalMode_enum.hpp | Generated enum header for XccyNotionalMode_. |
| dal-cpp/dal/auto/MG_XccyNotionalMode_enum.inc | Generated enum implementation for XccyNotionalMode_. |
| dal-cpp/dal/auto/MG_BizDayConvention_enum.hpp | Generated enum header updated with Preceding. |
| dal-cpp/dal/auto/MG_BizDayConvention_enum.inc | Generated enum implementation updated with Preceding. |
| dal-cpp/dal/auto/java/XccyNotionalMode.java | Generated Java enum mirror for XccyNotionalMode. |
| dal-cpp/dal/auto/java/BizDayConvention.java | Generated Java enum mirror updated with PRECEDING. |
| CHANGELOG.md | Records the breaking change + new reset/joint XCCY capabilities. |
Comments suppressed due to low confidence (1)
dal-cpp/tests/time/test_schedules.cpp:11
- Unit-test include order guideline is
gtestfirst, then other headers. This file currently includes<dal/platform/platform.hpp>before<gtest/gtest.h>, which violates.claude/rules/unit-test-style.mdand can also affect compile-time configuration macros.
| #include <dal/platform/platform.hpp> | ||
|
|
||
| #include <dal/currency/currencydata.hpp> | ||
| #include <dal/protocol/collateraltype.hpp> | ||
| #include <dal/protocol/rateconvention.hpp> | ||
| #include <dal/time/daybasis.hpp> | ||
| #include <dal/time/holidays.hpp> | ||
| #include <dal/time/periodlength.hpp> | ||
| #include <dal/time/schedules.hpp> | ||
| #include <gtest/gtest.h> | ||
|
|
| class NonlinearSquareAnalyticFunc_ : public Underdetermined::Function_ { | ||
| mutable Vector_<Vector_<>> gradientXs_; | ||
| mutable Vector_<Vector_<>> gradientFs_; |
| | `<dal-public/src/xccycalibration.hpp>` | Cross-currency spec builder and `CalibrateXccyMarket` | | ||
| | `<dal-public/src/xccycalibration.hpp>` | Staged and joint XCCY spec builders, calibration, and joint-result accessors | | ||
| | `<dal-public/src/interp.hpp>` | Linear one-dimensional interpolation builder | | ||
| | `<dal-public/src/repository.hpp>` | Repository find, erase, and size helpers for a configured host environment | |
| ## Source | ||
|
|
||
| - User request and design decisions confirmed on 2026-07-13. | ||
| - Related methodology: `docs/methodology/xccy_calibration.md` and `docs/methodology/yield_curve_jacobian.md`. | ||
|
|
| # XCCY Resettable/MTM — Benchmark Design Addendum | ||
|
|
||
| This addendum is part of | ||
| `docs/superpowers/specs/2026-07-13-xccy-resettable-mtm-design.md` and is normative | ||
| for the implementation plan. | ||
|
|
| # XCCY In-Progress Trades — Rate Fixing Addendum | ||
|
|
||
| This addendum is part of | ||
| `docs/superpowers/specs/2026-07-13-xccy-resettable-mtm-design.md` and is normative | ||
| for the implementation plan. | ||
|
|
| # XCCY Resettable/MTM Implementation Plan — Normative Corrections | ||
|
|
||
| This file is part of | ||
| `docs/superpowers/plans/2026-07-13-xccy-resettable-mtm.md`. Apply these corrections | ||
| when executing the plan. They resolve issues found by the writing-plans type and benchmark | ||
| self-review; the Windows sandbox prevented in-place updates to the newly created plan. | ||
|
|
| #include <gtest/gtest.h> | ||
|
|
||
| #include <dal/platform/platform.hpp> | ||
|
|
||
| #include <limits> | ||
| #include <string> | ||
| #include <dal/curve/curveblock.hpp> | ||
| #include <dal/curve/piecewiseconstant.hpp> | ||
| #include <dal/curve/xccyjointcalibration.hpp> | ||
| #include <dal/curve/ycconst.hpp> | ||
| #include <dal/curve/ycimp.hpp> | ||
| #include <dal/curve/ycinstrument.hpp> | ||
| #include <dal/protocol/collateraltype.hpp> | ||
| #include <dal/storage/_repository.hpp> | ||
| #include <dal/storage/globals.hpp> | ||
| #include <dal/time/daybasis.hpp> | ||
| #include <dal/time/holidays.hpp> | ||
| #include <dal/time/periodlength.hpp> |
| #include <gtest/gtest.h> | ||
|
|
||
| #include <dal/platform/platform.hpp> | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <dal/curve/curveblock.hpp> | ||
| #include <dal/curve/jointcalibration_internal.hpp> | ||
| #include <dal/curve/piecewiseconstant.hpp> | ||
| #include <dal/curve/xccyjointcalibration.hpp> | ||
| #include <dal/curve/xccypricing.hpp> | ||
| #include <dal/curve/ycconst.hpp> | ||
| #include <dal/curve/ycinstrument.hpp> | ||
| #include <dal/protocol/collateraltype.hpp> | ||
| #include <dal/time/daybasis.hpp> | ||
| #include <dal/time/holidays.hpp> | ||
| #include <dal/time/periodlength.hpp> |
Move <dal/platform/platform.hpp> out from between gtest and the system headers and into the DAL/project block, matching the include order in test_xccypricing.cpp and the unit-test style guide. - dal-cpp/tests/curve/test_xccyjointcalibration.cpp - dal-cpp/tests/curve/test_xccyjointjacobian.cpp - dal-cpp/tests/curve/test_xccybasisjacobian.cpp - dal-cpp/tests/indice/test_fixingsnapshot.cpp
Reflow four markdown tables so every row shares one consistent per-column width (longest cell content + 2), and document the MarketFixingSnapshot_ constructor's current positive-only acceptance in the snapshot section. Doc-only review fixes; no code, test, or behavior change. - docs/methodology/yield_curve.md - docs/methodology/yield_curve_jacobian.md - docs/methodology/xccy_calibration.md
Reflow the four pipe tables in docs/public-api.md so each column is padded to its longest cell (content + 2) with compact separator rows, matching the markdown table style rule and the already-aligned methodology docs. Cell content is unchanged; only padding and separator widths differ. Addresses the Copilot review comment flagging the unaligned public-api.md table.
Summary
FIXED,RESETTABLE, andMARK_TO_MARKETXCCY notional modes with immutable rate/FX fixing snapshots and deterministic in-progress valuationxccy_perfto 24 stable rows with a 10-instrument started-MTM basket and a reset-aware staged analytic case, and run it as an informational Linux/Windows CI smoke benchmarkPlan status
Verification
python -O: residual1.057e-13, Jacobian3x30/0, resettable7/0, MTM7/7, plus started-trade rate and FX fixingsxccy_perf: exactly 24 unique rows in the required orderPerformance
The paired, interleaved 10-process gate passed every legacy row. The worst XCCY fixed-pricing regression was
+3.70%(5% budget), while fixed price and basket paths improved by about 32-33%. The standard benchmark matrix also passed, with worst regression+2.45%.The expanded 24-row
xccy_perfcompleted in a representative AADET/4-thread local run in 7.29 seconds, below the same-host 15-second advisory investigation threshold. Its started-basket and reset-aware staged cases are informational smoke coverage, not regression thresholds.