DeskPrep
PYTHONintermediate~60 min

Portfolio VaR Calculator

Compute parametric and historical VaR for a multi-position book, decompose it into component VaR and quantify the diversification benefit.

Task brief

README.md
# Portfolio VaR Calculator

**Role relevance:** Market Risk take-home
**Estimated time:** 60 minutes
**Difficulty:** Intermediate
**Format:** Python (.py)

## What you are given
- portfolio_var_starter.py with the function signatures stubbed and a self-check harness
- positions.csv - 4 positions and their market values (11m book)
- returns.csv - 500 business days of daily returns per asset

## What you must deliver
1. Parametric VaR of the book from the covariance matrix
2. Historical VaR from the realised PnL distribution, and a comparison
3. The diversification benefit versus the standalone position VaRs
4. Component VaR per position, summing to the portfolio total

## Constraints & assumptions
99% confidence, 1-day horizon. Use the sample covariance (ddof=1) of the supplied returns. VaR is reported as a positive loss in GBP. pandas and numpy only.

## Submission note
Complete the starter file, then compare your work against the mark scheme.

What you'll learn

  • Compute parametric and historical VaR and reconcile them
  • Quantify diversification as the gap to the standalone sum
  • Decompose portfolio VaR into additive component contributions