Documentation
MBB Risk Engine is a high-performance analytics platform for callable mortgage bonds: build portfolios, design prepayment models, and calibrate Z-SHIFT in milliseconds to reconcile model and market dirty prices. Compute a full AAD risk stack (BPV, smooth/stable convexity, and vega buckets) instantly—whether for pricing or large-scale scenario sweeps—so you can move from inputs to decisions in near real time, even on long-dated bonds.
Theoretical documentation
High-level model overview, assumptions, and how prices/greeks are produced.
For exact definitions of the output measures (units and sign conventions), see the
Risk Numbers tab.
Interest rate model (Hull–White / GSR short-rate)
The engine uses a one-factor Gaussian short-rate model (Hull–White in time-dependent form, also known as GSR):
dr(t) = (θ(t) − κ·r(t)) dt + σ(t) dW(t)
κis the mean-reversion speed (constant).σ(t)is a term-structure of volatility implemented as piecewise-constant buckets over time.θ(t)is chosen so the model fits the initial discount curve exactly.
Pricing is performed under the risk-neutral measure. Callable behavior is represented through a prepayment model
evaluated on the cashflow schedule (backward induction over event dates), rather than assuming optimal exercise.
Path dependency is introduced through the pool factor state carried between event dates.
Prepayment model
Prepayments are modeled explicitly (CPR logic + gating variables), applied on the cashflow schedule.
The model consumes the relevant state (rates, incentive measures, time-dependent factors, etc.) and produces
projected principal prepayments and updated pool factor.
- Schedule-driven: applied at event dates alongside coupon/settlement logic.
- Path dependent: the pool factor evolves over time and affects future cashflows.
- Calibration link: Z-shift reconciliation: calibrate a constant parallel shift to the input yield curve; this shift affects both discounting and prepayment behavior (via incentive measures), and is solved so the schedule-driven model matches the market dirty price.
The active CPR logic can be inspected and edited in the Prepayment Model Builder.
Risk numbers
- BPV / DV01: price sensitivity to small curve shocks (units: per 1bp, with your sign convention).
- Convexity: second-order rate sensitivity (stable/consistent with the engine’s definition).
- Vega: sensitivity to σ-bucket shocks (bucketed term-structure exposures).
- Kappa sensitivity: shows the change in value with respect to the kappa parameter.
For exact definitions, units, and sign conventions, see the
Risk Numbers tab.
Automatic differentiation (AAD)
Risk numbers are produced from the same pricing engine using algorithmic differentiation, so prices and sensitivities
remain consistent across “live” pricing and scenario sweeps.
- First-order: curve and σ-bucket sensitivities (and model parameter sensitivities where enabled).
- Second-order: convexity-style measures via stable second-derivative workflows.
- One engine: no separate “risk pricer” — sensitivities are tied to the exact schedule/PDE logic used for price.
More details are available in the
References tab.
Performance
The pricing engine is optimized for speed. On a local laptop, a single pricing run (given a fixed Z-shift)
including all risk numbers completes in ~60 ms for a 30-year bond with 120 payments
and 3 additional time steps between payment dates.
Z-shift calibration, portfolio risk, and scenario sweeps are parallelized across multiple threads to reduce end-to-end runtime.
This is achieved using a single, consistent PDE/AAD implementation so pricing and risk are produced together
(no separate “risk pricer” pass).
Risk numbers
Definitions, units, and sign conventions used by the engine outputs.
Want more depth? The paper is linked in the
References tab.
Manuals & sample files
Download templates for common inputs (CSV + JSON): Portfolio, Market Data, PDE Settings, Scenarios, and Prepayment Models.
Customize them (edit values, add/remove rows), upload, and run pricing/risk/scenarios.
CSV templates
Use these as starting points (in display units, matching what you see in the UI).
- portfolio_sample_display_units.csv — Portfolio
- market_data_sample.csv — Market data
- curve_points_sample.csv — Curve points
- pde_settings_sample.csv — PDE settings
Tip: you can add/remove rows (holdings, curve points) before uploading.
Prepayment Model Builder
- Start from a known example
- Edit logic or parameters, then rerun pricing/risk/scenarios
Guide (PDF)
Sample models (JSON)
- prep_model_example_1.json
- prep_model_example_2.json
- prep_model_example_3.json
- prep_model_example_4.json
- prep_model_example_5.json
Tip: keep a known portfolio row as a regression case when iterating on CPR logic.
Units & interpretation
- BPV/convexity/vega definitions: see Risk Numbers
- If results look off by 100×, it’s almost always a unit/scale mismatch
Notes on units
- Some inputs are displayed in scaled units (e.g. bps, %), but stored internally in canonical decimals.
- When importing CSV, the sample files match the UI’s display units.
Contact
Questions, bug reports, and feedback.
Email
Include
Page, screenshot, and the input row that reproduces the issue.
Disclaimer
Important notice
MBB Risk Engine is a quantitative analytics tool. It produces outputs based on user-provided inputs and predefined models.
The results are provided for informational purposes only and do not constitute financial, investment, legal, accounting,
or regulatory advice, nor any recommendation to buy or sell securities.
No warranty
While the tool applies established quantitative techniques, results depend on assumptions, model simplifications,
and input data quality. No representation or warranty is made regarding accuracy, completeness, timeliness, or fitness
for any particular purpose. Actual market outcomes may differ materially.
Use at your own risk
Use of this application is entirely at the user’s own risk. To the fullest extent permitted by law,
the developer disclaims all liability for any direct or indirect loss or damage (including consequential loss)
arising from the use of, or reliance on, the application or its outputs.
Independent judgment required
Users should apply independent judgment and, where appropriate, consult qualified professionals before making investment,
business, or regulatory decisions. The tool is intended as decision support and must not be used as the sole basis for decisions.
Acceptance
By using this application, you acknowledge and accept these terms.
References
External references and local downloads.
Book
Paper
AAD risk numbers for MBS
PDE/AAD risk numbers paper. Local file:
static/papers/pde-aad-risk-numbers.pdf.