portfolio risk — VaR / CVaR & marginal-VaR

Value-at-Risk for a basket, and the name driving it

Value-at-Risk (VaR) — the loss threshold exceeded only at the stated confidence level — computed from historical returns and by Monte-Carlo simulation, alongside Expected Shortfall (CVaR), the mean loss on the days that breach VaR. Both use the weights shown on each name: equal by default, or supplied weights normalized to 100%. Marginal VaR attributes that risk to individual holdings.

AAPL33%MSFT33%NVDA33%
Equal weights (default). One weight per name; VaR, ES and marginal VaR recompute on apply.
Largest VaR contributorNVDA contributes 48% of portfolio Value-at-Risk. A weight reduction in this name lowers portfolio VaR more than the same reduction in any other holding.

Value-at-Risk & Expected Shortfall

501 daily returns · 20,000 Monte-Carlo paths
HorizonVaR 95%ES 95%VaR 99%ES 99%
Monte-Carlo · 1d2.58%3.24%3.69%4.15%
Monte-Carlo · 10d8.14%10.23%11.67%13.11%
Historical · 1d2.38%3.63%4.31%5.44%
Historical · 10d7.52%11.49%13.61%17.21%
Parametric · 1d2.64%—3.74%—

Method agreement (1-day): VaR 95% spans 2.38%–2.64% across 3 methods; VaR 99% spans 3.69%–4.31% across 3 — the methods agree at both tails.

MC VaR95 1d 2.58%501 daily returns20,000 Gaussian draws from the sample covariance (Cholesky)Hist VaR95 1d 2.38%501 daily returnsempirical replay — no distribution assumedParam VaR95 1d 2.64%501 daily returnsz·σ, Gaussian closed form

VaR 95% = the loss threshold exceeded on 1 day in 20; ES/CVaR = the mean loss on those days. Monte-Carlo = 20,000correlated Gaussian scenarios drawn from the sample covariance; Historical = the observed return days (501) replayed at current weights; Parametric = z × portfolio sigma (VaR only). Gaussian simulation understates rare extremes relative to the historical replay. All figures use the weights shown on the basket chips above (equal by default)

Marginal VaR — which holding drives the risk

AAPL24.45%
MSFT27.36%
NVDA · top driver48.19%

Each holding's share of portfolio Value-at-Risk; shares sum to 100%. (Use "portfolio" for the risk object throughout; "basket" may remain for the ticker input list.)

19 days out of 20 this book should not lose more than 2.58% in a day; but on the bad 1-in-20 day the average loss is about 3.24%. Computed on 501 real daily returns — your decisions, your risk.
Below, the engine walks the tail one concept at a time — VaR, Expected Shortfall, historical vs Monte-Carlo, who owns the tail, and how it scales — so you can read your own risk.

Risk glossary

VaR
Value-at-Risk — a loss threshold you expect to breach only (1 − confidence) of the time.
Expected Shortfall (CVaR)
The average loss GIVEN that you have already breached VaR — the mean of the worst tail.
Monte-Carlo VaR
Simulating 20,000 correlated scenarios from the estimated covariance (via Cholesky) and reading the tail.
Cholesky
A way to factor the covariance matrix (L·Lᵀ = Σ) so independent random draws come out correlated like your real assets.
Marginal / Component VaR
Each asset's share of total VaR (Euler allocation); the shares sum to 100% of VaR.
√h rule
Multiply a 1-day risk figure by the square root of the horizon in days to scale it.
sealed · audit root cd2e64a634938cae…
What is VaR, in one sentence?
Historical 1-day 95% VaR is 2.38% of the book; the Monte-Carlo estimate is 2.58%.
Value-at-Risk (VaR) at 95% over 1 day means: "on 19 out of 20 normal days you should not lose more than this." It is a loss threshold, not a worst case — 1 day in 20 you can lose MORE.
Why Expected Shortfall (ES / CVaR) matters more
On a 95% breach day you would lose about 3.63% on average (historical ES) — that is 1.53× the VaR threshold.
VaR tells you the threshold; it says nothing about HOW bad the bad days are. Expected Shortfall is the AVERAGE loss on the days you do breach VaR — the true "if it goes wrong, how wrong" number. ES is always at least as large as VaR, and regulators (FRTB) now prefer it.
Historical vs Monte-Carlo — two honest lenses
Here the two methods land within 0.20% of each other at 95% — close agreement, on 501 observations and 20,000 simulated paths.
Historical simulation replays exactly what happened to your book, so it captures real fat tails but can only show losses it has already seen. Monte-Carlo estimates the covariance between your assets, Cholesky-factorises it, and generates 20,000 NEW correlated scenarios — smoother, and able to imagine combinations that have not occurred yet. Agreement between the two is a confidence signal.
Who owns the tail? (marginal VaR)
The largest single contributor to tail risk is NVDA (48.19% of total VaR).
Total risk is not the sum of each position's standalone risk — correlations matter. Marginal (component) VaR splits the TOTAL VaR into the slice each asset is actually responsible for, and the slices sum exactly to the total. Trim the biggest slice to cut risk most efficiently.
Scaling to longer horizons
Your 10-day 95% VaR (8.14%) is the 1-day figure × √10.
A 1-day risk number is scaled to h days with the "square-root-of-time" rule (multiply by √h). It assumes returns are independent day-to-day; real markets trend or mean-revert, so treat multi-day figures as an approximation, not gospel.