Potential Loss Indicator: Value at Risk (Python)


Every rational investor has one question before making any investment and that is “What is the maximum loss I may incur on a particular investment?

Value at risk popularly known as “VAR” answers the above question. Value at Risk is a statistical measure that quantifies the level of financial risk in a given investment.  According to Philippe Jorion, “VAR measures the worst expected loss over a given horizon under normal market conditions at a given level of confidence”.

In the above definition, two parameters are of significance.

  1. Holding Period
  2. Confidence level

Let us understand Value at Risk (VAR) first: Value-at-risk is a statistical measure of the riskiness of financial entities or portfolios of assets. It is defined as the maximum dollar amount expected to be lost over a given time horizon, at a pre-defined confidence level. For example, if the 95% one-month VAR is $1 million, there is 95% confidence that over the next month the portfolio will not lose more than $1 million.

Value at risk can be calculated either with Variance-Covariance method (Parametric method) or Historical Returns method (Monte Carlo Simulation).

Variance-Covariance Method,: As per Variance-Covariance method, VAR is calculated as a function of mean and variance of the returns with assumption that over the period returns will be normally distributed.

Historical Returns Method: Historical Returns method is based on Monte Carlo simulation (probability simulation), where large number of returns are simulated given different scenarios. Monte Carlo simulations are used to model the probability of different outcomes in a process that cannot easily be predicted due to the intervention of random variables.

Limitations of VAR: VAR at risk quantifies the potential loss for a given level of confidence but standalone does not give any information regarding expected loss beyond the given confidence level or probability of loss lying in the tail of normality curve.

Second, Value at Risk calculated for different line of business for a financial organization or if calculated for different departments within organization cannot be added. Because VAR does not consider the impact of correlation within different line of businesses for a financial firm and if losses calculated for individual line of businesses to come up with single number for overall business then it might suffer from double counting.

Third, different method of calculation might give different values of VAR.

Let us now to calculate the VAR risk using Parametric method i.e. Variance-Covariance Method in Python.

Steps to be followed:

  1. Import Data from Yahoo Finance
  2. Calculate the returns using following formula: Returns = (Closing Price – Open Price)/Open Price
  3. Calculate the mean of the returns
  4. Calculate the Standard Deviation of the returns

Below Python Code can be used to calculate VAR for Variance-Co-variance Method. In the next article we would calculate VAR using Monte Carlo Simulation.




Please enter your comment!
Please enter your name here