Managing Portfolio Risk with Monte Carlo Simulation

Patrick Anastasio
6 min readDec 24, 2021

Pop quiz hot shot! How do you manage the price risk of a portfolio of securities? In other words, how can you predict the future price movements of assets so that you can anticipate a negative move before it happens?

Don’t be this guy

Well, you can do what most non-technical minor leaguers do and take a historical approach, eyeballing charts and technical indicators until you go blind, and plugging numbers into calculations endlessly (the voice of experience here)!

Or, you can step up to the big leagues and start using tools of probabilistic prediction that will save you time, and potentially a lot of money. Specific tools of simulation and machine learning will allow you to see a range of outcomes, even worst case scenario, over a specified time period and allow you to make the best possible decisions to manage risk and minimize losses.

Enter Monte Carlo Simulation

A brief history

Although random sampling and simulation had been around for a long time, Modern Monte Carlo theory was developed in the 1940’s by nuclear physicist Stanislaw Ulam, along with his colleagues John von Neumann, and Nicholas Metropolis, among others, while working on the Manhattan Project. Ulam, while recovering from brain surgery and playing solitaire, devised a method of playing hundreds of games to estimate statistically the probability of a successful outcome. [1] With the advancement of computing power in those times, he and his colleagues quickly realized the significance of this and began deploying it on their scientific work, specifically on neutron diffusion in fissionable material. [2]

Ulam frequently talked about his uncle who, for all intents and purposes, had a gambling problem and “just had to go to Monte Carlo.” The name comes from the area of Monaco where Europeans go to gamble… and, indeed, Monte Carlo simulation can be run on many casino games of chance. [3]

What is Monte Carlo Simulation?

In simple terms, Monte Carlo is a mathematical technique that allows you to conduct a quantitative analysis on the impact of risks on a wide range of applications (e.g. project timeframes and budgets, securities portfolios, casino games, or any other application subject to measurable risk ). [4] Monte Carlo gives you a range of possible outcomes and probabilities to allow you to consider the likelihood of different scenarios. In other words, if some risk occurs, how will it affect my specific application, e.g. how will it affect the price of a stock or other asset, or an entire portfolio?

Monte Carlo simulation uses random sampling and statistical modeling to estimate mathematical functions and mimic the operations of complex systems. [5] One of the useful things about it is that samples can be drawn from random, non-normal distributions. Specifically it computes the probabilities for integrals and solves partial differential equations, thereby introducing a statistical approach to risk in a probabilistic decision. [6] Monte Carlo is a go to method for ascertaining potential risk in areas of finance, science, technology, and logistics.

Managing Portfolio Risk

Monte Carlo simulation allows us to obtain a distribution of results for any statistical problem with numerous inputs sampled over and over again, which can simulate an interval of potential returns (or losses) over a specified time horizon. [7]

Another example

Factors such as density and skew can give you a look at most probable outcomes. Furthermore, simulations can be plotted differently to give you a more intuitive snapshot of probable outcomes:

Specifically for risk management applications, Monte Carlo simulation allows you to measure the portfolio’s value-at-risk (VaR). In this case you would be interested the potential worst-case-scenarios over a specified time horizon, given a specified confidence interval.

The Method

As mentioned above, to initiate a simulation you need to specify two conditions: an alpha, or confidence level from which the confidence interval is calculated, and a specific time horizon to simulate over. Monte Carlo simulations (there are many types) all follow a similar process: [8]

  • model a system as a (series of) probability density functions (PDFs);
  • repeatedly sample from the PDFs;
  • tally/compute the statistics of interest.

Specify a Model

Again, for simplicities sake, we will say that a “model” in this instance is a function of specified parameters and variables that we run on the random samples over and over again incrementally, over the time horizon.

[9] A simple example of this uses geometric Brownian motion (GBM) as it follows the Random Walk theory which does not take into account any fundamental or technical analysis. The Random Walk theory states that price movements are conditionally independent of prior movements. This is not, per se, realistic though. In reality, volatility changes over time, however in GBM, it is assumed constant. Also, stock prices often move after unpredictable events or news, however in GBM, the path is continuous (no discontinuity).

ΔS = S × (μΔt + σϵΔt​)

where: ΔS=the change in stock price ; S=the stock price ; μ=the expected return; σ=the standard deviation of returns ; ϵ=the random variable ; Δt=the elapsed time period​

What really matters here is the terms within the parenthesis. The first term “μΔt” shows how we expect the price to move in a vacuum, given our expected return over time. This is what is called a “drift” and continues as a constant over time. The second term is where the randomness enters our model and what really causes the change in price ΔS. This is called a “shock” and is a function of standard deviation scaled by some random variable ϵ. This random variable is derived from the Weiner Process and it follows a normal distribution centered on zero.

The simulation moves like this over every time increment; current price multiplied by the expected return(drift) plus the shock (+/—).

Generate the Trials

This simulation is run a specified number of times and probabilities are drawn from the results, as seen in the graphics above.

This is actually quite simple using Python and code for creating the simulation on a stock price, or a portfolio of stocks, is generously showcased in this article by Zhijing E.

Process the Results

Visualize, Stats, etc…

If we are looking at minimizing risk and looking at our worst case scenarios, we would take our alpha, or our confidence level (which is commonly set at 95% and is what we will run with here), we will isolate the lowest 5% of our simulations and do our analysis on these results.

An example of a histogram showing some results from a Monte Carlo Simulation on VaR

It is interesting to note that results will not be normally distributed, in contrast to the Central Limit Theorem. In fact, as we run more and more simulations our sample means will tend to diverge from normality and more toward a log normal distribution as seen below.

Its harder than it looks

GBM is a simple model to do this on. As mentioned above, in reality stock prices move based on several market factors. If you are looking to do this on derivatives, options, etc. the Black-Scholes model is much more appropriate, but this is beyond the scope of this article.

--

--