Measures of downside historical volatility — Visualising portfolio drawdown in Python

Ben Diagi
3 min readJun 4, 2021

Volatility

Volatility is a statistical measure of the dispersion of returns for a given security or market index.

Implied Volatility vs. Historical Volatility

Implied volatility (IV), also known as projected volatility, is a metric that captures the market’s view of the likelihood of changes in a given security’s price. As the name suggests, it helps us make a determination of just how volatile the market will be going forward.

Historical volatility (HV) is a statistical measure of the dispersion of returns for a given security or market index over a given period of time. It gauges the fluctuations of underlying securities by measuring price changes over predetermined periods of time. It is the less prevalent metric compared to implied volatility because it isn’t forward-looking.

Drawdown is one method of calculating historical volatility.

Drawdown refers to a peak-to-trough decline during a specific period for an investment, trading account, or fund. A drawdown is usually quoted as the percentage between the peak and the subsequent trough.

Here, I want to compute and visualize drawdown on the DJIA.

  1. Import DJIA historical data from yfinance.

2. Create a Drawdown function

Since drawdown is the peak-to-trough decline, I have to calculate the running peaks and compare that to the index price.

Visualise DJIA all time price and peaks

DJIA all time price and peaks

Visualise DJIA drawdown

Compute DJIA max drawdown as the minimum negative value of all time. Max drawdown = 89.18%

Interpreting Max Drawdown (MDD):

89.18% is the maximum loss that could be incurred by investor who invested in the DJIA. However, it’s important to note that it only measures the size of the largest loss, without taking into consideration the frequency of large losses. Because it measures only the largest drawdown, MDD does not indicate how long it took an investor to recover from the loss, or if the investment even recovered at all.

Max drawdown date is July 1932, right after the stock market crash of 1929.

Visualise DJIA drawdown during the 1929 stock market crash

Visualise DJIA drawdown during the 2008 stock market crash

Visualise DJIA drawdown during the 2020 stock market crash

--

--

Ben Diagi

I’m a Product Manager & Designer. I write about Product, Design and Finance. In my spare time, I build trading algorithms and create UX prototypes.