# Rates338 — audit, implementation and validation

## Baseline
Source opened from the Alpha Hedge Services repository at bf9eb728862b90702cd95ba0be304b2917bdaf0d (public version337). Hosting manifest is static dist/. Existing Quant Lab contains multicurve, HJM/BGM, Hull–White, swaptions and cancellable swap demonstrators. Research Python and pricing C++ already exist, but the requested Market/Trade/Pricer registry and Excel-facing Hull–White workflow were not found there. Existing scientific engines were left intact.

## Intervention
Added a dedicated rates-workbench.html, linked from Quant Lab. Six local browser explorations with an explicitly independent JavaScript engine: curve interpolation, short-rate dynamics/distribution/conditional bonds, exact-integral zero-coupon Monte Carlo, tree and held-out continuation-regression Bermudan, synthetic TARN coupon scenarios, diagnostics. Worker keeps pricing away from the UI thread. SVG charts resize to mobile width; tables have their own overflow container. Inputs invalidate previous outputs and disable CSV until recalculation. Labels and main explanatory content provided in FR/EN/中文.

Added Python immutable snapshot registry with 14 operations; local HTTP adapter; Windows COM source adapter; optional compiled C++ OU moments kernel. Single curve, EUR, input-relative year fractions. Quotes can be stored, but sigma is user supplied. Distinct LSM continuation regression and appendix-D pickup methodology explained; pickup regression itself not implemented. No hosted Python endpoint. No production multi-user service claim.

Delivered .xlsx with eleven requested sheets, native source-bound curve/scenario charts and independently calculated swap-leg formulas. Python price/sensitivity/scenario snapshots are clearly marked as requiring explicit refresh. Separate VBA source imports into a user-saved .xlsm and calls a retained COM instance. Workbook was rendered and inspected sheet by sheet; formula error scan had zero matches. Changing fixed rate 2.5%→3% changed swap PV 1426.555406→−21208.520633 EUR, then input restored. Exported workbook XML confirms eleven sheets and two native range-bound charts with intended line colors.

## Executed evidence
- Python unittest: 12 methods, including full HTTP workflow and request/response validation against OpenAPI, error responses, OU native kernel, financial checks, export round trip. See python-tests.txt.
- JavaScript: 126 assertions; 27 cross-language tree price cases, absolute tolerance 1e-6 EUR. See js-tests.json.
- Historical Heston/SABR: 165 nodes each, repricing check <1e-5; existing chart renderer: 990 checks. See legacy-vol.txt and legacy-charts.txt.
- Quant HTML baseline exactly reproduced after removing the single additive entry block. No historical engine file modified.
- Chrome: actual calculation, eleven SVG charts, languages EN/FR/中文, changing sigma to zero and repricing, stale export disabled, interpolation visibility selector, exercise-time selector, downloaded CSV parsed (24 rows, tree price34736.209838 EUR on the non-flat web case).
- Mobile: 390px iframe with375px usable content, document scrollWidth375px, no unlabeled input/select/textarea. Responsive charts visibly fit. Not a physical Safari test.

Flat-curve independent case: curve2.5%, N1mEUR, fixed2.5%, a0.1/year, sigma0.01/sqrt(year), remaining co-terminal swap payments years2–6, exercise years1–5. Grid60:21820.837267EUR;120:21818.374400EUR;240:21792.343708EUR. Python held-out LSM8000 training/8000 evaluation, seed338:21940.337740EUR, SE243.734931EUR. These differences are reported, not a claim of exact option-price convergence. Tree fit maximum <1e-12 is a separate check.

## Not executed / not deployed
Windows COM registration, real Excel VBA execution, native DLL build and Excel bitness compatibility remain untested. Pure-Python dispatch of the COM class was tested; that is not a COM integration test. API binds to127.0.0.1 only and is not deployed by static hosting. Full native C++ pricing is not implemented: C++ covers OU moments only. No automatic calibration, multi-curve model, banking calendars, historical fixing, smile, collateral or XVA. TARN coupon scenario excludes funding leg, principal exchange and maturity top-up; not a full stochastic TARN valuation. Manual Chrome checks are not exhaustive accessibility certification or performance benchmarking.

## Sources and authorship
Fletcher & Gardner, Financial Modelling in Python, Wiley2009, chapters4–12, appendixC217–218 and appendixD219–220. Source book inspected in the conversation, not redistributed. Conceptual adaptation and new implementation; no claim of an original pricing theorem. Additional regression reference appears in the supplied bibliography: Longstaff & Schwartz (2001), Review of Financial Studies14:113–147 (book p221). No quotation reproduced.

## Reproduce
Run Python tests with NumPy and jsonschema available: `python -m unittest discover -s tests/rates338 -v`; run browser core tests: `node tests/rates338/test_browser_core.cjs`; legacy checks: `node tools/test-vol.cjs`, `node tools/test-chart243.cjs`. C++ test invokes g++ and builds ignored ou.so. Runtime API needs NumPy; jsonschema only needed by tests. See research/rates338/README.md and downloadable OpenAPI for operation contracts. Workbook authoring source: tools/build-rates338-workbook.mjs, using the provided artifact-tool runtime. Rendered verification images retained in outputs/rates338.

Production publication state must be checked separately against the hosting deployment result; this document alone is not proof of deployment.

## Files
See [modified-files.txt](modified-files.txt) for the source and artifact inventory recorded before publication. Main additions: research/rates338, tests/rates338, rates338 browser assets, rates-workbench.html, Excel/VBA downloads, OpenAPI and validation reports. Existing files changed: .gitignore and the single contextual entry in dist/quant-lab.html.
