# The Ongoing Stock Market Crash

November 4, 2011 — Michael Kelly, Wolfram Technology Group

The ongoing gyrations of the stock market over the past few months have spread panic not just throughout the markets, but into the rest of the economy and the political sphere. There are some who assert that this is due to the recent downgrade of the American credit rating by Standard & Poor’s (S&P), but an analysis with Mathematica suggests that other factors may be at play. Using the FinancialBond function for a zero-coupon continuously compounding bond price, we discover the inverse relation between bond prices and yields (y) given below. As the bond price increases, the yield y decreases.

As bonds are bought, their prices go up and the corresponding yields drop. Looking at the U.S. yield curve using Wolfram|Alpha at the end of July and eight weeks later below, the yields on long-term 10-year treasury bonds have dropped from 2.82% to 1.84%, which is a historic 50-year low. This shows that investors are now more likely to buy long-term U.S. government debt, which is puzzling behavior if they are panicked by the S&P downgrade.

Instead, it may have been the news about the redetermination of the size of the 2008–2009 decline in GDP from 4.8% to 8.9% that caused the panic, or recent evidence that the economy has stalled and might possibly decline in the second half of the year. When coupled with the sovereign debt crisis in peripheral European countries like Portugal, Italy, Greece, and Spain, this has driven fears of a “double dip” back into another recession.

The return to plummeting asset prices leads one to ask how prevalent such events have been in the U.S. economy since 1980. We choose 1980 because there is a distinct difference in the extraneous conditions and rate of growth of the markets from World War II to 1980 and from 1980 to the present. The economy had 2.56 times the annualized rate of growth during the latter period compared to the former period. This is shown below:

Another reason for discerning different regimens, obvious from the GraphicsColumn below, is that volatilities are substantially higher since 1980 than previously. This can be shown by first defining the annualized volatility for a particular equity or index and the year we wish to study, and then comparing volatilities for years 1979 and 2008, where the latter is four times the former.

A final economic reason for examining the period after 1980 is that the late 1970s were complicated by the exogenous shock of the rapid rise in OPEC-controlled oil prices. Studying the post 1980 period, we can now discern a number of peaks and valleys that correspond to known financial events. These include the stock market crash of October 1987, seen here as a small blip on the graph below. The two other peaks are respectively the “Tech” crash of 2000–2001 and its ensuing recession, and from December 2007 until mid 2009.

If we had not known about the crash of 1987, it might have been hard to spot on the graph above, so what we really need is a Manipulate GUI that will allow us to move over the graph at will for a given equity and over a specified time range. In this way we can study the ups and downs of the market interactively. In the GUI below we identify starting and ending points in terms of years and the equity prices we wish to analyze. It is now easy to see how significant the 1987 crash was. A further point to note is that the recovery times from each successive crash are getting significantly longer: two years for the 1987 crash, seven years for the 2001 crash, and more than four years for the current crisis. We can see that the severity of the market crashes is increasing in terms of the following periods of downturn.

If we need further convincing, we can use Renko trading charts that show the up and down patterns behind the data. A Renko chart is drawn as a series of fixed-height bricks, where a brick is drawn in a new column whenever the price rises above the top of the previous brick, or drops below the bottom of the previous brick by a fixed amount. Studying one such chart for each of the days of the October 1987 period shows what a massive downturn it was, brought about by the savings and loan bank debacle.

However, what these charts do not reveal is the extent of the downturn. For that we need to create plots that not only show the price range, but also calculate the size of the price decline from the maximum price to the minimum price within the specified time period and for a fixed equity. The function FinancialDataRange defined below accomplishes this task.

When we apply FinancialDataRange to periods in 1987, 2007–2009, and the recent downturn, we get the following plots and percentage decline computations.

Again, it would be even better if we could wrap the above function inside a Manipulate that lets you choose the crash period and index to study the effects. This is given below, where we show the recent downturn for the Dow Jones Industrial Average.

What strategies do investors employ to protect their assets in such times? One option is to buy immunization in terms of financial options that act as insurance policies for their portfolio positions. Mathematica has a very powerful function FinancialDerivative that allows one to determine the price of such options, and we can use it to consider a hypothetical case where one wants to take advantage of the recent “crash”.

Pretend that it is Friday, July 29, and you have just heard that S&P has downgraded the USA’s credit reliability, and further, you have had a week full of doom and gloom both about European sovereign debt and the stalling of the U.S. economy. You heavily suspect that the market will take a hit next week. You cannot be sure of course, because anything can happen, but you want to put money on the hunch that the market is going down. To do so, you buy put options, which give you the right but not the obligation to sell equities for a fixed price (called the strike) at a future date, say at the end of eight weeks, on September 23.

For the sake of some example, let’s choose the S&P 500 futures, called the ES Mini, and the DJIA futures. The smallest change in price of the underlying index is called a tick and is one quarter of one unit. The futures cost $12.50 for the ES Mini and$2.50 for the DJIA. In other words, a one-unit change in the ES Mini and the DJIA costs $50 and$10 respectively. These are called the futures price multipliers and have to be taken into account to determine the final profit.

When evaluating options on forward values, we usually use futures options. But here the underlying asset is actually a multiple of the index, so we will calculate the appropriate multiples of vanilla American put options on stock indices.

Other parameters need to be used as inputs in the American exercise put option, such as dividend yield, volatility, and risk-free interest rate. The expiration is 40/253 because we will exercise 40 trading days into the future. The interest rate is taken from the three-month treasury bill, which was calculated from Wolfram|Alpha at the top of the blog at 0.1%. The dividend yield at the end of July was 0.68% for the S&P 500 and 3.00% for the DJIA.

And we can use FinancialData to determine the 50-day volatility from which we can then calculate the annual volatility by multiplying by √253/50.

Now we contact our broker late on Friday and tell him to buy over-the-counter (OTC) two-month (eight-week) puts on the ES Mini and DJIA futures when the market opens on Monday morning. Usually exchange traded futures have expiration dates in multiples of months, but for the purposes of this example, we will price eight-week OTC puts to investigate options that essentially replicate short selling. The opening prices are given by FinancialData.

The strike price for a put is always below the actual price so that an immediate profit cannot be made. We choose strikes as high as possible to increase the profit margin. Let us suppose that the highest valued puts we can acquire that morning are written at 1280 and 12100 for the S&P 500 and DJIA respectively. We can now calculate the values of the puts on the underlying indices:

So we can now see what the actual closing prices were at the end of eight weeks for the S&P 500 and the DJIA.

The value of the put on the futures is the difference Max[K-ST, 0] between the strike and the final price multiplied by the appropriate futures factor minus the cost of the purchase price of the put and the broker’s charge, which is a fixed price that we can ignore since it doesn’t alter the structure of the discussion.

As we can see, these are substantial, but our hunch could have been wrong and the market could have gone against us or recovered more quickly than expected. So a proper analysis requires that we consider the possible profits for various scenarios for the indices as well as choose different strikes, since only some limited number of strikes may have been available. These different payoffs are displayed below, including red dots to indicate the original profits calculated.

This exercise illustrates the reality that financial institutions whose job it is to evaluate risk and sovereign debt can often fail to correctly assess fundamental economic phenomena—after S&P incorrectly determined America’s debt risk, its CEO stepped down. Massive gyrations in the stock market are normal, but not in keeping with traditional economic theory which emphasizes equilibrium models which do not cope with exogenous shocks.

The examples offered here are only hypothetical, for the purposes of showing how Mathematica functionality can be used to analyze and invest in the market. Wolfram Research is not a financial institution and is not responsible for trading losses as a result of using its technology.

Posted in: Finance

 The down is now more than 2,000 points in just the last 14 trading days. Just like in 2008, bank stocks are being hit the hardest. That was true once again today. I think it is going to be a serious matter. Posted by New York Stock Exchange    November 5, 2011 at 6:36 am
 Great post! thank you for thecontribution Posted by samuel    November 6, 2011 at 10:52 am
 I believe I heard the remark that many people have more confidence in the U.S. government than Standard and Poors. Posted by Jim Jones    November 7, 2011 at 4:25 pm
 FinancialData currently gets its ^DJI data from Yahoo and Yahoo has had legal disagreements with S&P over the display of their data. This is the proximate cause of this problem but we are looking to resolve this by possibly switching to another data source for this important index. Also one can still get ^DJI values from WolframAlpha by going to http://www.wolframalpha.com and entering ^DJI. Posted by Michael Kelly    September 2, 2015 at 3:03 pm