NUMERICAL AUDIT · 5 DECEMBER 2026
Three more money errors in the Common Domain Model: collateral haircuts, equity swaps and Brazilian day counts
Xamit Kadirbekov and Daniyal Kadirbekov, GERO Numerical Assurance
REPRODUCED · FIXES PROPOSED. Fixes for the first two errors are open as CDM pull requests #5440 and #5441; the third needs a design decision by the working group. Reproduced with the official finos-cdm 7.12.0 Python package; model source at master commit dfdcbf3, still unchanged on 5 December 2026. Reproduction script: cdm-csa-equity-cal252-check.py.
The Common Domain Model (CDM) is a machine-readable and machine-executable model of how financial products are traded and managed. Earlier versions were released as the ISDA CDM; since 2023 it has been an open standard hosted by FINOS and sponsored by the trade associations ISDA, ISLA and ICMA. Besides data structures it contains executable calculations, written so that firms do not each have to code the rules of ISDA documents themselves.
Yesterday we described an error in its 30E/360 day count. Reading the neighbouring calculations, we found three more. Each function cites the ISDA document it implements, and each computes something different from what that document says.
1. Collateral: the FX haircut is taken twice
Collateral is not counted at face value. Under a credit support annex, a bond posted as margin is reduced by haircuts: one for the price risk of the bond, an extra one if it is in another currency (the FX haircut), and sometimes an additional haircut agreed by the parties. PostedCreditSupportItemAmount, which cites the 2018 ISDA Credit Support Annex for Initial Margin, adds the three and subtracts them from the value. But the line meant to read the additional haircut reads the FX haircut again:
alias fxHaircutPercentage: postedItem -> fxHaircutPercentage alias additionalHaircutPercentage: postedItem -> fxHaircutPercentage // should be -> additionalHaircutPercentage
| Haircut | FX haircut | Additional | CDM | Correct |
|---|---|---|---|---|
| 2% | 8% | 1% | 82,000,000 | 89,000,000 |
| 2% | 0% | 5% | 98,000,000 | 93,000,000 |
Collateral of 100 million. In the first row the FX haircut is taken twice and the collateral is worth 7 million less than it should be. In the second there is no currency mismatch, so the additional haircut is simply lost and the collateral is worth 5 million more.
What it can lead to. This value feeds the model’s Delivery Amount and Return Amount: how much margin one party must post or may take back. Undervalued collateral means a margin call that is too large; overvalued collateral means the secured party holds less protection than the agreement requires. We have not seen this used on a real trade; it is what the arithmetic of the function implies.
2. Equity swap: the gain is multiplied by the price move a second time
In an equity swap one party pays the other the performance of a stock. The function EquityPerformance cites the 2018 ISDA CDM Equity Confirmation, whose definitions are short: Equity Performance is the Rate of Return times the Equity Notional Amount, and the Equity Notional Amount is the Number of Securities times the Initial Price. The model passes the final price instead:
alias rateOfReturn: RateOfReturn(periodStartPrice, periodEndPrice) alias notionalAmount: EquityNotionalAmount(numberOfSecurities, periodEndPrice) // should be the initial price
| Price move | CDM | Correct |
|---|---|---|
| 100 → 110 | 11,000,000 | 10,000,000 |
| 100 → 90 | −9,000,000 | −10,000,000 |
| 50 → 75 | 75,000,000 | 50,000,000 |
Notional 100 million. The error is the correct amount times (final price / initial price − 1), so it grows with the size of the move: 10% on a 10% rise, half again on a 50% rise.
What it can lead to. When the stock rises, the party paying the performance would pay too much; when it falls, it would receive too little. The result feeds the model’s cash settlement amount for the swap.
3. Brazil: business days counted as calendar days
Brazilian interest is quoted on business days: a year is 252 business days, and the 2021 ISDA Definitions, which the function quotes, define CAL/252 as the number of business days in the period divided by 252. YearFraction for CAL_252 divides calendar days by 252:
alias daysInPeriod: DateDifference(startDate, endDate) // calendar days; the definition says business days set result: daysInPeriod / 252
From 2 January 2024 to 2 January 2025 there are 366 calendar days and 253 Brazilian business days. The model gives 1.4524 years; QuantLib 1.44 Business252(Brazil) gives 1.0040. A 10% coupon on 100 million comes out as 14,523,810 instead of 10,039,683, about 45% more. Trades in FpML marked BUS/252 are mapped to this same day count when they are read into the model.
What it can lead to. Interest on any Brazilian-convention leg computed by this function would be overstated by roughly 45%. The fix is not one line: the function does not receive a holiday calendar, so the working group has to decide how to pass one.
How we checked
All three results come from the official generated Python code (finos-cdm 7.12.0 from PyPI), not from a re-implementation. For the equity swap the script supplies lightweight stand-ins for the trade object, containing only the fields the function reads; for CAL/252 it supplies the calendar-day difference that CDM implements natively in Java. The correct values follow directly from the definitions the functions cite; for CAL/252 we cross-checked with QuantLib.
pip install finos-cdm==7.12.0 QuantLib python cdm-csa-equity-cal252-check.py
Download the script: cdm-csa-equity-cal252-check.py.
Fix and status
We opened pull requests with the fixes on 5 December 2026: #5440 for the collateral haircut (one line) and #5441 for the equity swap (the initial price is passed to the notional). In the same review we found a fourth, smaller slip: CheckMaturity, which tests whether a bond’s maturity fits a collateral eligibility rule, inverts the comparison for an exclusive lower bound; the fix is #5442. For CAL/252 we described the problem and left the design to the working group. The project’s contributor licence agreement is signed by both authors. Our bug reports, #5435–#5438, were closed automatically by a repository bot because they were filed through the API rather than the project’s Bug form; we are re-filing them through the form. We found no earlier report of any of these in the project’s issues and pull requests, and no tests for these functions.
Limits
These are defects in executable functions of a reference model. We do not know which firms run CDM’s calculation functions in production, or whether any margin call, swap payment or coupon has been computed with them; we make no claim that anyone has been over- or underpaid. The defects are in the model source, so other distributions generated from it, such as Java, are expected to carry the same logic; we ran only the Python package. The amounts above are examples on a notional of 100 million chosen by us, not observed trades.