Back to all posts

Risk On: Measuring Algorithm Sensitivity To Volatility Regime Switching

After a protracted period of low volatility in the US equity market, in the first half of February 2018 we saw the largest single day (and week) decline in equity prices since August 2015. At the same time, we saw a substantial spike in the CBOE Volatility Index (VIX), an instrument constructed from implied volatilities of a wide range of options on the S&P 500 Index. The VIX, commonly referred to as the “fear gauge”, attempts to predict the market’s expectation of annualized 30-day volatility.

Figure 1. S&P500 index and VIX index.


Of course, there’s nothing like a good VIX spike to remind investors to look at their investment strategy and think about how their strategies perform should volatility remain elevated for the foreseeable future.

For systematic investors who use algorithms to make trading decisions, the good news is that they can look to historical data and predict their algorithm’s response to volatility regime switches based on performance over previous periods of high and low volatility.

Ideally, a robust strategy should perform equally well in both high and low volatility regimes. In practice, it is quite common for algorithmic strategies to be sensitive to the changes to micro and macro structure of the market that can accompany volatility regime switches. During times of high volatility, new arbitrage opportunities may open up as investors become nervous and act emotionally. In contrast, a low volatility regime offers more stability for trading algorithms to compound smaller arbitrage opportunities. It is thus common for some trading algorithms to show better performance in either a high or low volatility regime based on what types of inefficiencies they target.

In this study we will take a look at assessing whether an example algorithm has a volatility preference. For this purpose, we will use the Sharpe ratio, a risk-adjusted measure of performance computed by dividing the mean daily returns by the standard deviation of daily returns, as our sole measure of performance.

As a first step, we can use the historical prices for the VIX. We can simply choose a threshold to divide our data set into two “high vol” and “low vol” regimes. For this study we will use 15 as our threshold, mean of S&P historical volatility observed over the long-term period.

Figure 2. Volatility index value over time. The time periods highlighted in green are classified as “high vol” regime, with the VIX above the historical mean level, while the unhighlighted regions are classified as “low vol”.


The visualization above makes it easy to see that the period from mid-2016 through early 2018 was characterized by lower than average levels of volatility. Next, we’ll need our historical performance of the example algo over this same time period.


Figure 3. Sample algo cumulative returns over time.


As is often the challenge with financial time-series data, we now run into the problem of small data (the opposite of big data). It is easy enough to divide our historical returns into two time-series, one of returns in “high vol” and one in “low vol” periods. From there we can compute the Sharpe ratio separately during “high vol” and “low vol” periods.

However, we are almost guaranteed to find a difference between these two time periods. We should instead be trying to determine whether there is a significant difference between them. In order to get a sense of what magnitude of differences we would expect if there were nothing special about these two time-periods, we will be using a bootstrap test. The bootstrap is a statistical technique that relies on taking many random samples from a data set and computing a summary statistic (like the difference between two means) to get a sense of the random variation of that statistic in our data. We can then contrast our actual result to the results we got by randomly sampling and see how likely it would have been to get that result by chance.

In this last step, we divide the entire data range into two parts: high volatility regime and low volatility regime. We then compute the Sharpe ratios for each regime separately. If the algo’s Sharpe ratio in high volatility regime is higher than that in low volatility regime, we say it is “high vol preferred”, and vice versa.

In this example case, let’s assume the sample algo is “high vol preferred.” We want to use a bootstrap test to verify our assumption, so we generate 1000 random samples from the returns data (1258 daily returns). For each random sample, we require the same numbers of segments (a segment is a period of consecutive high volatility days) and same length of each segment as we defined before for the high volatility ranges. We then compute the Sharpe ratio for each randomly sampled time-range. We can visualize the distribution of sample algo’s Sharpe ratios (Figure 3) and find where the “high vol preferred” Sharpe ratio resides in this distribution. If it is very far from the center of the distribution we get by random sampling, we get a clue that we have a significant result.

Figure 4. Sample algo’s sharpe ratio distribution.


Luckily, we don't have to locate where the "high vol preferred" Sharpe ratio is by eye alone. We can use the previously generated distribution to directly compute a percentile for this "high vol preferred" Sharpe ratio, and use this percentile as our confidence level of our estimate.

For the example strategy we show here, you can see that it is “high vol preferred” as it has a higher Sharpe ratio of 1.47 in periods of high volatility as compared with a Sharpe ratio of -1.18 in periods of low volatility. Furthermore, the percentile score for the “high vol preferred” Sharpe ratio is 99.5, which means with 99.5% confidence level we believe the algo has a preference for high volatility regime.

Table 1. Comparison of high/low vol sharpe ratios and confidence bound.


Below you can find a link to a Quantopian forum post with the notebook used to analyze sample strategy and generate similar plots above. In the notebook we use backtest data. You can copy this notebook into your own Research account and run this analysis over your favorite trading algorithms to see if it is sensitive to volatility regime switches.

Suggested links and reading:


Authors: Jess Stauth, Shuheng Yan, Thomas Wiecki, Rene Zhang

Thanks to Scott Sanderson for optimizing the associated notebook code and for his brilliant contribution to making the bootstrap test rigorous and efficient.


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian.

In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.