Skip to main content
Trading

Portfolio Risk Math Explained: VaR, CVaR, and Why Covariance Estimation Matters

March 22, 202615 min read
PythonRisk ManagementTradingMathematicsPortfolioscipy
Share:

When I built RiskRadar, I needed to implement institutional-grade risk calculations. Most risk management tutorials either oversimplify ("just calculate standard deviation") or assume PhD-level math.

Here's the middle ground — the math you actually need to implement portfolio risk, explained for engineers.

Value at Risk (VaR): What's the Worst That Could Happen?

VaR answers: "What's the maximum I could lose in a day, with 95% confidence?"

If your portfolio's 1-day 95% VaR is $10,000, that means: on 95% of days, your losses won't exceed $10,000. On the other 5% of days... they might.

Three ways to calculate VaR:

Historical VaR (simplest)

Sort your historical daily returns. The 5th percentile is your 95% VaR.

\

Related reading

All posts →
Jason Teixeira
Written by
Jason Teixeira
Founder, Sage Ideas Studio
More about Jason →

Want to see this in action?

Check out the projects and case studies behind these articles.

livebuild 29be8ec2026-06-11 06:38Z
// solo studio// no analytics resold// every commit human-reviewed