← ClaudeAtlas

algo-risk-varlisted

"Calculate Value at Risk to estimate maximum portfolio loss at a given confidence level. Use this skill when the user needs to quantify downside risk, set risk limits, or report regulatory risk measures — even if they say 'worst case loss', 'portfolio risk', or 'how much could we lose'.".
charlieviettq/awesome-agent-skill · ★ 25 · AI & Automation · score 80
Install: claude install-skill charlieviettq/awesome-agent-skill
# Value at Risk (VaR) ## Overview VaR estimates the maximum loss a portfolio can suffer over a given time horizon at a specified confidence level. Example: "95% 1-day VaR of $1M" means there's a 5% chance of losing more than $1M in one day. Three methods: parametric (normal), historical simulation, Monte Carlo. ## When to Use **Trigger conditions:** - Quantifying portfolio downside risk for risk management - Setting trading limits and capital reserves - Regulatory reporting (Basel III requires VaR-based capital) **When NOT to use:** - When you need to know how bad losses CAN get beyond VaR (use CVaR/Expected Shortfall) - For illiquid assets with no price history (VaR needs return data) ## Algorithm ``` IRON LAW: VaR Does NOT Tell You How Bad It Gets BEYOND the Threshold VaR says "95% of the time, losses won't exceed $X." It says NOTHING about the 5% worst case. A portfolio can have low VaR but catastrophic tail losses. Always supplement with Expected Shortfall (CVaR) which measures the average loss in the tail. ``` ### Phase 1: Input Validation Collect: portfolio positions, historical returns (min 250 days for 1Y), confidence level (typically 95% or 99%), time horizon (1 day or 10 days). **Gate:** Sufficient return history, positions valued at current market. ### Phase 2: Core Algorithm **Parametric VaR:** VaR = -μ + zα × σ (assumes normal returns). For portfolio: use covariance matrix for portfolio σ. **Historical Simulation:** 1. Compute daily P&L from historical