The Average Investor's Blog

A software developer view on the markets

Were markets exceptionally volatile in 2011?

Posted by The Average Investor on Jan 3, 2012

2011 was a volatile year, no doubt about that, but was it exceptionally so from a historic point of view? To quantify the volatility, I used the Dow Jones Industrial average, which goes back to 1928 on Yahoo Finance:


getSymbols("^DJI", from="1900-01-01")

dji = Cl(DJI["/2011"])

djiVol = aggregate(
               as.numeric(format(index(dji), "%Y")),
               function(ss) coredata(tail(TTR:::volatility(
                                                   calc="close"), 1)))
# The result is 0.8214286, the 82nd quantile

A volatile year no doubt, but once again confirming the fact that, in markets behaviour at least, history does repeat itself. The following plot clearly shows that the volatility experienced during the great depression dwarves the recent levels:

Dow Jones Annual Volatility

Next, out of pure curiosity, I also computed how much money were to be made with these levels of volatility:


getSymbols("^DJI", from="1900-01-01")

# Compute the absolute returns
absRets = abs(ROC(Cl(DJI["/2011"])))
absRets = reclass(ifelse(,0,absRets),absRets)

# Summarize annually
yy = as.numeric(format(index(absRets), "%Y"))
zz = aggregate(absRets, yy, function(ss) tail(cumprod(1+ss),1))

# The result is 10.64

That’s right, an owner of a crystal ball would have been able to multiply his money 10-fold in 2011 alone! For further comparison, in 1932, the owner of the same ball would have been able to multiply his money … 590 times!


2 Responses to “Were markets exceptionally volatile in 2011?”

  1. Gianpiero Ascenso said

    I get this error message:

    > djiVol <- aggregate(
    + Cl(DJI),
    + as.numeric(format(index(DJI), "%Y")),
    + function(ss) coredata(tail(TTR:::volatility(
    + ss,
    + n = NROW(ss),
    + calc = "close"), 1)))
    Error in runCov(x, x, n, use = "all.obs", sample = sample, cumulative) :
    Invalid 'n'

    Since I'm a newbie, I don't know where to lojj for. Would you be so kind to point me in the right direction? Thanks

  2. The code should work now. Apparently the new data from 2012 was breaking it. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: