This repository provides a comprehensive exploration of Value at Risk (VaR), a widely-used metric in financial risk management. The project demonstrates various methodologies for estimating VaR using Python and historical stock return data, fetched via Yahoo Finance.
VaR quantifies the maximum potential loss of an asset, portfolio, or investment over a specific time period, given a confidence level. It helps investors and institutions assess risk exposure and implement effective risk management strategies.
The repository covers the following VaR computation methods:
- Historical Method: Non-parametric, based on past returns.
- Variance-Covariance Method: Parametric, assumes returns follow a normal distribution.
- Monte Carlo Simulation: Generates synthetic return paths to simulate potential future scenarios.
- Fetches historical stock data from Yahoo Finance using
yfinance
. - Implements VaR calculations with multiple methods.
- Visualizes stock return distributions with interactive plots.
- Compares the results across methods, discussing assumptions and differences.
Historical stock prices are retrieved using Yahoo Finance. The script calculates daily returns based on the closing prices.
- Historical Method:
- Orders past returns.
- Identifies the percentile corresponding to the confidence level.
- Variance-Covariance Method:
- Assumes returns follow a normal distribution.
- Utilizes the mean and standard deviation to calculate VaR.
- Monte Carlo Simulation:
- Generates synthetic returns based on historical mean and standard deviation.
- Sorts simulated returns to determine the VaR.
The distribution of daily returns is visualized with:
- A histogram of actual returns.
- An overlay of the normal distribution curve.
- Highlights of the VaR threshold.
- Historical Method VaR:
2.66%
- Variance-Covariance VaR:
2.66%
- Monte Carlo VaR:
2.76%
These results illustrate the strengths and limitations of each method, especially in capturing tail risk.
- The Historical Method reflects past behavior but may miss extreme events.
- The Variance-Covariance Method simplifies computation but assumes normality, potentially underestimating risk.
- The Monte Carlo Method incorporates randomness and extreme scenarios, yielding a higher VaR in some cases.