top of page
Portfolio Value-at-Risk (VaR)
The project calculates the value-at-risk for a single security or a portfolio using both the parametric method and Monte Carlo simulations, which returns the maximum potential loss for a given time period with a certain confidence level, assuming that returns are normally distributed.
Importing the required libraries:

Calculating VaR if the length of the given tickers is 1:

Calculating VaR if the length of the given tickers are greater than 1:

Final output where VaR is calculated using the parametric method.
In addition, the potential range of the portfolio value could be determined by observing the Monte Carlo simulation chart.
Tickers, timeframe, portfolio size, weights, confidence level, and the number of days could be changed as desired.

bottom of page