VaR is the industry's headline risk metric: one number that turns a whole return distribution into a worst-case threshold.
VaR 95% → losses worse than this happen only 5% of the time.
VaR 90% → losses worse than this happen 10% of the time.
If you imagine the return distribution as a histogram, VaR is simply cutting off the left tail at a specific point. Everything to the left of that cutoff represents the worst-case scenarios that the VaR is measuring.
If a $1 million portfolio has a one-day 95% VaR of $20,000, this means there's a 95% probability that the portfolio won't lose more than $20,000 in a single day—or equivalently, there's a 5% chance of losing more than $20,000.
For a return random-variable and confidence level :
With daily simple returns (your data), is just the 5th percentile (a negative number).
The formula finds the threshold value where the probability of getting a return less than or equal to is exactly . The negative sign in front converts this to a loss amount (making VaR typically positive in finance literature, though we keep it negative in our implementation).
Inside srv.py → compute_custom_metrics():
var_95 = np.percentile(port_returns, 5) # 5-th percentile cvar_95 = port_returns[port_returns <= var_95].mean() var_90 = np.percentile(port_returns, 10) # 10-th percentile cvar_90 = port_returns[port_returns <= var_90].mean()
Step | What happens |
---|---|
Historical method | Uses the empirical distribution – no distributional assumptions. |
Daily horizon | Returns are daily ⇒ VaR is "1-day". (Annualise ≈ VaR × √252 if needed.) |
Sign | Output is negative (loss). In the results table you multiply by 100 to show "-2.35%". |
CVaR (Expected Shortfall) | Mean of the tail beyond VaR – gives the average loss in worst cases. |
Metric | Meaning | Usage |
---|---|---|
VaR 95% | Loss exceeded on 1 trading day in 20 (on average). | Standard regulatory benchmark. |
VaR 90% | Loss exceeded on 1 day in 10. | Less conservative – useful for daily P&L limits. |
In your results card both numbers appear, helping users see "moderate tails" (90%) vs "deep tails" (95%).
Suppose 500 days of daily returns sorted ascending:
Percentile | Return |
---|---|
5% (25th obs) | -1.8% |
10% (50th obs) | -1.1% |
→ "95% of the time I lose less than 1.8%."
might be -2.4% → average loss when the 1.8% barrier is breached.
This example illustrates how VaR gives you a threshold for losses, while CVaR (Conditional VaR) tells you what the average loss is when you exceed that threshold—providing a more complete picture of tail risk.
Method | Formula / Idea | When to prefer |
---|---|---|
Parametric (Variance–Covariance) | Large samples, near-normal returns. | |
Monte-Carlo | Simulate thousands of paths; pick percentile. | Non-linear pay-offs, derivatives. |
Filtered Historical | GARCH volatility-scaled resampling. | Volatility-clustering markets. |
Our platform currently uses Historical VaR – transparent, easy to explain, and assumption-free.
The historical approach makes no assumptions about the shape of the return distribution, unlike the parametric method which typically assumes normality. This is especially important for financial returns which often exhibit fat tails (higher kurtosis) and skewness that normal distributions don't capture.
Tip | Why |
---|---|
Report CVaR/ES alongside VaR | CVaR is coherent and captures tail magnitude (we already compute both). |
Use rolling windows | Tail risk drifts; a 1-year rolling VaR plot spots regime changes. |
Align VaR horizon with user need | Daily for trading desks, 10-day for regulators, monthly for asset allocators. |
Beware of leverage & derivatives | VaR on returns may understate notional draw-downs; scale appropriately. |
Simplicity and intuitiveness: Condenses complex risk distributions into a single, easy-to-understand number representing maximum expected loss.
Universal applicability: Can be applied to virtually any portfolio of assets regardless of asset class or complexity.
Confidence level flexibility: Can be adjusted (90%, 95%, 99%) based on risk tolerance and specific application needs.
Regulatory acceptance: Widely adopted by financial institutions and required by regulators as a standard risk measurement tool.
Comparative framework: Provides a consistent basis for comparing risk across different portfolios, strategies, or time periods.
Tail blindness: Provides no information about the severity of losses beyond the VaR threshold, potentially masking catastrophic tail risks.
Non-coherent measure: Lacks mathematical subadditivity, meaning the VaR of a combined portfolio can be greater than the sum of individual VaRs.
Method sensitivity: Results can vary significantly depending on calculation approach (historical, parametric, Monte Carlo) and parameters.
Backward-looking bias: Historical VaR assumes the past distribution of returns accurately reflects future risks, which may not hold during regime changes.
Liquidity blindness: Standard VaR calculations don't account for market liquidity constraints that may amplify losses during stress periods.
Jorion, P. (2006). "Value at Risk: The New Benchmark for Managing Financial Risk." 3rd Edition. McGraw-Hill.
Alexander, C. (2008). "Market Risk Analysis, Volume IV: Value-at-Risk Models." Wiley.
Dowd, K. (2002). "Measuring Market Risk." Wiley.
Danielsson, J. (2011). "Financial Risk Forecasting." Wiley.
Metric row in each optimisation card: "VaR 95%: –2.35%, CVaR 95%: –2.98%"
Histogram overlay shows red dashed line at VaR (our distribution plot does this).
Tooltip: "Worst daily loss at 95% confidence over back-test period." → links to this page.
Providing both VaR 95% and VaR 90% helps novice users grasp everyday vs. rare-event risk, while practitioners still see the exact empirical thresholds and CVaR tail averages our engine calculates.