Quantitative Analysis · Data Science · Machine Learning

Calculating Value-at-Risk using Historical Simulation

The Historical Simulation Method is a straightforward approach to calculate Value at Risk (VaR) by using historical market data to simulate the potential future outcomes of a portfolio. Here’s a step-by-step guide on how the Historical Simulation Method is typically calculated:

1. Select a Historical Data Window

Choose a historical time window for which you have relevant market data. The length of the window depends on the desired time horizon for VaR (e.g., daily VaR, weekly VaR). A common choice is to use at least a year of historical data.

2. Collect Historical Returns

Calculate the historical returns for each asset in the portfolio over the selected time window. The return for each period is usually calculated as the percentage change in the asset’s price from one day to the next.

The formula for daily return (percentage change) is:


# calculate return using daily bars
daily_return = (current_close - previous_close / previous_close) * 100

3. Build Portfolio Returns

Combine the individual asset returns to create the historical returns for the entire portfolio. The portfolio return for each period is the weighted sum of the individual asset returns based on the portfolio’s asset allocation.

4. Order the Historical Returns

Order the historical portfolio returns from worst to best, representing the returns in ascending order.

5. Identify VaR Percentile

Determine the VaR percentile corresponding to the desired confidence level. For example, if you want to calculate VaR at the 95% confidence level, you would be interested in the historical return at the 5th percentile of the ordered returns.

6. Calculate VaR

The VaR is the historical return at the chosen percentile. It represents the potential loss at the specified confidence level over the selected time horizon.

VaR = Historical Return at the Xth Percentile


Example:

Let’s illustrate the process with a simplified example. Consider a portfolio with two assets, A and B, and a historical data window of 250 days.

  1. Calculate daily returns for each asset using the formula mentioned earlier.
  2. Combine the returns to obtain portfolio returns for each day.
  3. Order the historical portfolio returns from worst to best.
  4. If you want to calculate VaR at the 95% confidence level, identify the return at the 5th percentile.
  5. The return at the 5th percentile is your VaR.

It’s important to note that the Historical Simulation Method provides a non-parametric estimate of VaR, relying on observed historical data rather than assuming a specific distribution for returns. While it captures historical market behavior, it may not fully account for future market dynamics, and the accuracy of VaR estimates depends on the stability of market conditions over the historical period.