Risk management using VaR & CVaR

Quantitative Risk Management in Python

Jamsheed Shorish

Computational Economist

Risk management via modern portfolio theory

  • Efficient Portfolio
    • Portfolio weights maximize return given risk level
  • Efficient Frontier: locus of (risk, return) points generated by different efficient portfolios
    • Each point = portfolio weight optimization
  • Creation of efficient portfolio/frontier: Modern Portfolio Theory

Plot of the efficient frontier

Quantitative Risk Management in Python

Incorporating Value at Risk into MPT

  • Modern Portfolio Theory (MPT): "mean-variance" optimization
    • Highest expected return
    • Risk level (volatility) is given
    • Objective function: expected return
  • VaR/CVaR: measure risk over distribution of loss
  • Adapt MPT to optimize over loss distribution vs. expected return
Quantitative Risk Management in Python

A new objective: minimize CVaR

  • Change objective of portfolio optimization
    • mean-variance objective: maximize expected mean return
    • CVaR objective: minimize expected conditional loss at a given confidence level
  • Example: Loss distribution
    • VaR: maximum loss with 95% confidence
    • Optimization: portfolio weights minimizing CVaR
    • CVaR: expected loss given at least VaR loss (worst 5% of cases)
  • Find lowest expected loss in worst 100% - 95% = 5% of possible outcomes
Quantitative Risk Management in Python

The risk management problem

  • Select optimal portfolio weights $w^\star$ as solution to

cvar_minimization

  • Recall: $f(x)$ = probability density function of portfolio loss

  • PyPortfolioOpt: select minimization of CVaR as new objective

Quantitative Risk Management in Python

CVaR minimization using PyPortfolioOpt

  • Create an EfficientCVaR object with asset returns returns
  • Compute optimal portfolio weights using .min_cvar() method

 

ec = pypfopt.efficient_frontier.EfficientCVaR(None, returns)

optimal_weights = ec.min_cvar()
Quantitative Risk Management in Python

Mean-variance vs. CVaR risk management

  • Mean-variance minimum volatility portfolio, 2005-2010 investment bank assets
ef = EfficientFrontier(None, e_cov)

min_vol_weights = ef.min_volatility()
print(min_vol_weights)
{'Citibank': 0.0,
 'Morgan Stanley': 5.0784330940519306e-18,
 'Goldman Sachs': 0.6280157234640608,
 'J.P. Morgan': 0.3719842765359393}
Quantitative Risk Management in Python

Mean-variance vs. CVaR risk management

  • CVaR-minimizing portfolio, 2005-2010 investment bank assets
ec = pypfopt.efficient_frontier.EfficientCVaR(None, returns)
min_cvar_weights = ec.min_cvar()

print(min_cvar_weights)

 

{'Citibank': 0.0,
 'Morgan Stanley': 0.0,
 'Goldman Sachs': 0.669324359403484,
 'J.P. Morgan': 0.3306756405965026}
Quantitative Risk Management in Python

Let's practice!

Quantitative Risk Management in Python

Preparing Video For Download...