MiniCTRMSearch

MiniCTRM - Build Tutorial 703: Monte Carlo VaR: ten thousand tomorrows on the same engine

→ to begin · N for the speaker notes

On a phone: Next or a swipe left to begin, Notes for the words.

What you'll learn

A scenario source behind the VaR engine with the historical figures unchanged to the digit and Expected Shortfall at each level, volatilities and a by-curve-by-month correlation matrix calibrated from the closes with a fingerprint and a calibration id, correlated seeded batched draws with antithetic pairs and a Student-t toggle, a Monte Carlo run in parallel on the worker pool with compressed per-deal vectors on the server database, VaR and ES with their standard error and a convergence table, the closes, the scenarios and the per-deal valuations exported and a scenario set imported from a file for a firm-wide VaR, historical and Monte Carlo side by side and backtested with VaR and ES limits that name their method, and a model-risk page with the rules in CLAUDE.md.

  • Why MiniCTRM stops at history – MiniCTRM's reason: a technology decision for a teaching system on one file, and a view about accuracy.
  • What you need first – The VaR engine reused unchanged, and the capabilities the run leans on; where this lesson sits in a from-scratch build.
  • The model, from zero – Returns, volatility, correlation and the covariance matrix; Cholesky, lognormal moves, seeds, the noise and model risk.
  • A scenario source, calibrated from the closes – One seam in the engine with a golden file to prove it, then volatilities and a by-curve-by-month correlation matrix from your own closes.
  • Ten thousand tomorrows, in parallel – Correlated, seeded, batched draws; the run as a job of batches across the worker pool, compressed, with a standard error on every figure.
  • Everything is correlated: a firm-wide VaR – Why the firm's VaR adds per-deal vectors across desks and never VaRs; closes out, scenarios out and in, valuations out, through lesson 623's pipeline.
  • Side by side, the model-risk page, then ship – Both methods on one book and date, backtested, limits per method; the page a committee reads and the rules in CLAUDE.md; /ship.
  • How MiniCTRM did it – Help → Monte Carlo VaR, the reason in MiniCTRM's words, and Profit at Risk, MiniCTRM's one Monte Carlo.

Before you start

The lessons this one builds on: 602 Market risk: sensitivities, historical-simulation VaR, stress tests and limits, 622 Running jobs in parallel: the end of day in ten minutes, not twenty, 623 Integrations: CSV in and out, feed adapters and the API, 631 Performance: compress market data, keep a save fast, 634 Reliability: backups, the restore drill, health checks, logs, upgrades, 641 Ten users or a thousand: what changes, 644 Many jobs at once: one limit for the whole system, steps that start together, one writer shared.

Copyright 2026-2027 Brian Shydlo. MiniCTRM is source-available under the PolyForm Strict License 1.0.0 (https://polyformproject.org/licenses/strict/1.0.0): free for learning and other noncommercial use; no changes and no redistribution; commercial use needs permission.

Welcome

Ten thousand tomorrows

1 / 17
Ten thousand tomorrows
Why MiniCTRM stops at history

A technology decision

2 / 17
A technology decision
What you need first

What you need first

3 / 17
What you need first
The model, from zero

Returns, volatility, correlation, covariance

4 / 17
Returns, volatility, correlation, covariance
The model, from zero

Cholesky, lognormal moves, seeds and the noise

5 / 17
Cholesky, lognormal moves, seeds and the noise
A scenario source, calibrated from the closes

A scenario source behind the engine

6 / 17
A scenario source behind the engine
A scenario source, calibrated from the closes

Calibration from the closes

7 / 17
Calibration from the closes
Ten thousand tomorrows, in parallel

Correlated draws, ten thousand tomorrows

8 / 17
Correlated draws, ten thousand tomorrows
Ten thousand tomorrows, in parallel

The run: parallel, batched, compressed

9 / 17
The run: parallel, batched, compressed
Everything is correlated: a firm-wide VaR

Everything is correlated: a firm-wide VaR is a sum of vectors, not a sum of VaRs

10 / 17
Everything is correlated: a firm-wide VaR is a sum of vectors, not a sum of VaRs
Everything is correlated: a firm-wide VaR

Files in, files out

11 / 17
Files in, files out
Side by side, the model-risk page, then ship

Side by side, backtested, limits per method

12 / 17
Side by side, backtested, limits per method
Side by side, the model-risk page, then ship

The model-risk page and the rules

13 / 17
The model-risk page and the rules
Side by side, the model-risk page, then ship

Ship it

14 / 17
Ship it
How MiniCTRM did it

Help → Monte Carlo VaR: the reason, in MiniCTRM's words

15 / 17
Help → Monte Carlo VaR: the reason, in MiniCTRM's words
How MiniCTRM did it

Profit at Risk: MiniCTRM's one Monte Carlo

16 / 17
Profit at Risk: MiniCTRM's one Monte Carlo
What you have now

What you have now

17 / 17
What you have now

You have finished lesson 703, Monte Carlo VaR: ten thousand tomorrows on the same engine.

Where next?

← → move · N notes · Home / End