Skip to content

feat: add reset-aware XCCY pricing and joint calibration#230

Merged
wegamekinglc merged 38 commits into
masterfrom
codex/xccy-resettable-mtm
Jul 15, 2026
Merged

feat: add reset-aware XCCY pricing and joint calibration#230
wegamekinglc merged 38 commits into
masterfrom
codex/xccy-resettable-mtm

Conversation

@wegamekinglc

@wegamekinglc wegamekinglc commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • add FIXED, RESETTABLE, and MARK_TO_MARKET XCCY notional modes with immutable rate/FX fixing snapshots and deterministic in-progress valuation
  • add staged basis calibration and simultaneous domestic/foreign/basis calibration with analytic or bumped Jacobians, diagnostics, and solved-state effective inverse risk
  • expose the reset-aware and joint APIs through public C++, Python, and Excel, including generated enums, result accessors, tests, docs, and a runnable 25x25 recovery example
  • add a focused domestic-leg-spread test, an approachable C++ reset-pricing example, and a runnable Python joint-calibration example
  • extend xccy_perf to 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 benchmark

Plan status

  • Tasks 0-5: protocol, fixings, cashflow plans, pricing, and staged basis calibration
  • Task 6: three-block joint calibration and analytic Jacobian
  • Task 7: public C++ builders and result accessors
  • Task 8: Python bindings and coverage
  • Task 9: Excel functions, generated surfaces, and portable API smoke coverage
  • Task 10: expanded benchmark matrix and paired regression gate
  • Task 11: methodology/API docs, changelog, runnable example, review, and cleanup
  • Follow-up: reset-pricing examples, domestic-spread coverage, 24-row benchmark matrix, and CI smoke execution

Verification

  • full Release build and CTest: 1,042/1,042 entries
  • focused core XCCY pricing tests: 29/29
  • Python joint example under normal Python and python -O: residual 1.057e-13, Jacobian 3x3
  • C++ reset-pricing example: fixed 0/0, resettable 7/0, MTM 7/7, plus started-trade rate and FX fixings
  • xccy_perf: exactly 24 unique rows in the required order
  • documentation integrity: 33 current-state Markdown files
  • formatting, diff, generated-source drift, and whole-branch reviewer gates: clean

Performance

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_perf completed 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.

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.
@codacy-production

codacy-production Bot commented Jul 13, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 200 complexity · 56 duplication

Metric Results
Complexity 200
Duplication 56

View in Codacy

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.

@wegamekinglc wegamekinglc changed the title feat: add reset-aware XCCY pricing and basis calibration feat: add reset-aware XCCY pricing and joint calibration Jul 13, 2026
@coveralls

coveralls commented Jul 13, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29366967662

Coverage increased (+1.0%) to 88.399%

Details

  • Coverage increased (+1.0%) from the base build.
  • Patch coverage: 38 uncovered changes across 10 files (1168 of 1206 lines covered, 96.85%).
  • 7 coverage regressions across 4 files.

Uncovered Changes

File Changed Covered %
dal-cpp/dal/curve/jointcalibration_internal.hpp 243 229 94.24%
dal-cpp/dal/curve/xccybasiscalibration.cpp 159 152 95.6%
dal-cpp/dal/curve/xccyjointcalibration.cpp 283 278 98.23%
dal-cpp/dal/indice/fixingsnapshot.cpp 63 59 93.65%
dal-cpp/dal/curve/xccypricing.cpp 224 221 98.66%
dal-cpp/dal/curve/jointcalibration.cpp 34 33 97.06%
dal-cpp/dal/curve/xccycalibration.cpp 12 11 91.67%
dal-cpp/dal/curve/xccyinstrument.cpp 54 53 98.15%
dal-cpp/dal/math/optimization/underdetermined.cpp 52 51 98.08%
dal-public/src/curveinstrument.hpp 10 9 90.0%
Total (21 files) 1206 1168 96.85%

Coverage Regressions

7 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
dal-cpp/dal/curve/jointcalibration.cpp 3 90.91%
dal-public/src/xccycalibration.cpp 2 95.65%
dal-cpp/dal/curve/discount.hpp 1 50.0%
dal-cpp/dal/math/optimization/underdetermined.cpp 1 91.21%

Coverage Stats

Coverage Status
Relevant Lines: 9249
Covered Lines: 8176
Line Coverage: 88.4%
Coverage Strength: 2859241.92 hits per line

💛 - Coveralls

@wegamekinglc wegamekinglc marked this pull request as ready for review July 13, 2026 22:58
Copilot AI review requested due to automatic review settings July 13, 2026 22:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 gtest first, then other headers. This file currently includes <dal/platform/platform.hpp> before <gtest/gtest.h>, which violates .claude/rules/unit-test-style.md and can also affect compile-time configuration macros.

Comment on lines 5 to 15
#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>

Comment on lines +88 to +90
class NonlinearSquareAnalyticFunc_ : public Underdetermined::Function_ {
mutable Vector_<Vector_<>> gradientXs_;
mutable Vector_<Vector_<>> gradientFs_;
Comment thread docs/public-api.md Outdated
Comment on lines 40 to 53
| `<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 |
Comment on lines +3 to +7
## 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`.

Comment on lines +1 to +6
# 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.

Comment on lines +1 to +6
# 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.

Comment on lines +1 to +7
# 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.

Comment on lines +5 to +22
#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>
Comment on lines +5 to +21
#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.
@wegamekinglc wegamekinglc merged commit 1589089 into master Jul 15, 2026
55 checks 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.

3 participants