← Atlas

Project Record

Credit Pricing and Model Validation Engine

Open in an AI assistant with a suggested prompt
Preview prompt
Summarize the Ionitsa project record titled "Credit Pricing and Model Validation Engine" for a technical reader.
Cover the problem or research question, implementation or method, evidence or results, and limitations.
Separate facts stated on the page from your own assessment, note anything unclear or unverified, and avoid promotional language.

Primary source: https://ionitsa.com/projects/credit-pricing-validation-engine.md
Canonical page: https://ionitsa.com/projects/credit-pricing-validation-engine/

A tested CDS hazard-curve and fixed-rate bond valuation library that turns credit quotes into survival probabilities, full-revaluation P&L, and model-validation evidence.

Domains
Hedge FundCredit
Capability
Market & Risk Systems
Methods
Derivatives PricingCurve BootstrapNumerical MethodsStress Testing

Executive Summary

The existing credit strategies could size first-order hedges, lag signals and charge implementation costs, but their daily P&L still relied on supplied spread sensitivities. That left a basic research question unanswered: could the system price the underlying instruments and show when its approximation stopped being trustworthy?

I built an independent Python valuation library for that purpose. It calibrates a piecewise-constant hazard curve from CDS par spreads, calculates survival and default probabilities, values premium and protection legs with accrual-on-default, converts standard coupons to upfront points, and reports risky PV01. A separate fixed-rate bond engine calculates dirty and clean price, yield, Z-spread, credit-spread DV01 and rates DV01.

The implementation is paired with a deterministic stress study rather than an unsupported performance backtest. Across 15 spread scenarios, it compares full revaluation with the initial linear sensitivity and measures the resulting hedge-ratio drift. The result demonstrates credit instrument pricing, numerical calibration, model-risk controls and reproducible research. It also provides the valuation layer required by the broader bond–CDS and CDX projects.

What the engine prices

For a risk-neutral survival curve Q(t)Q(t), recovery RR, discount factor D(t)D(t) and CDS coupon cc, the protection buyer’s value is:

VCDS=N[(1R)0TD(t)(dQ(t))cA(T)],V_{CDS}=N\left[(1-R)\int_0^T D(t)(-dQ(t))-c\,A(T)\right],

where A(T)A(T) contains scheduled risky premium payments and premium accrued when default occurs between coupon dates. The par spread makes the two legs equal:

s(T)=(1R)0TD(t)(dQ(t))A(T).s(T)=\frac{(1-R)\int_0^T D(t)(-dQ(t))}{A(T)}.

The hazard curve is piecewise constant. Each interval intensity is solved in maturity order so that the one-, three-, five-, seven- and ten-year market quotes are reproduced. A bisection solver keeps the numerical method explicit and auditable.

For a fixed-rate bullet bond, the dirty price at Z-spread zz is:

P(z)=iCFiD(ti)ezti.P(z)=\sum_i CF_i D(t_i)e^{-zt_i}.

The package inverts the same equation to recover Z-spread from price. Clean price is dirty price less accrued interest. Central differences provide credit-spread DV01 and rates DV01 independently.

Validation before research

The engine has tests for the model identities that should fail before a strategy result is trusted:

  1. every input CDS quote reprices inside the declared tolerance;
  2. survival stays between zero and one and never increases with time;
  3. a par CDS has zero value;
  4. low-spread CDS pricing approaches sλ(1R)s\approx\lambda(1-R);
  5. risky PV01 agrees with a coupon finite difference;
  6. standard-coupon upfront has the correct sign;
  7. clean price plus accrued equals dirty price;
  8. yield and Z-spread solvers recover their inputs;
  9. rates DV01 and spread DV01 agree with central differences;
  10. deterministic experiments reproduce exactly.

These are unit and property-style checks. The next validation tier is a golden test set against the official ISDA CDS Standard Model and a separately configured QuantLib implementation with all contractual conventions locked.

Approximation-error experiment

The first experiment prices a five-year, 1millionCDSandafiveyear,1 million CDS and a five-year, 1 million face-value fixed-rate bond. Starting credit spreads range from 50 to 1,000 basis points. Each curve is widened in parallel by 25, 100 or 300 basis points. Recovery is fixed at 40% so the comparison isolates convexity and sensitivity decay.

The initial RPV01 and bond CS01 produce the linear estimate. The shocked hazard curve and shocked bond Z-spread produce exact repriced P&L. Under the largest shock, linear CDS P&L overstates the gain by as much as 12.43%, while linear bond P&L overstates the loss magnitude by 7.37%. The initially matched CS01/RPV01 ratio moves by as much as 4.01% across the grid.

Linear P&L versus full revaluation

This is not a discovery that first-order Greeks are useless. For the 25-basis- point shocks, CDS approximation error stays near 1% and bond error near 0.6%. The result identifies the operating boundary: the approximation is a useful daily attribution tool, not a substitute for revaluation through a credit jump.

Model boundary

The implementation is ISDA-informed but is not the ISDA CDS Standard Model and does not claim contractual cash-settlement parity. It uses year-fraction coupon schedules, a transparent integration grid and midpoint default discounting. Production valuation additionally requires exact step-in and settlement dates, business-day calendars, day-count rules, holiday treatment, RFR curve inputs, front-end protection and official test grids.

The bond engine prices fixed-rate bullets. Its Z-spread is not labelled OAS. Callable and putable bonds require an interest-rate model, exercise policy and option-adjusted valuation.

The reproducible package lives under research/credit-pricing-guide/. The companion article, How to Build and Test a Credit Pricing Engine Before You Backtest, is written as a step-by-step guide rather than a performance note.

Related Work