How markets work

A long time back, there was this picture that was making the rounds on Twitter and (more prominently) LinkedIn. It featured three boys of varying heights trying to look over a fence to see a ball game.

Here is what it looked like:


These pictures were used to illustrate that equality of outcomes is not the equality of opportunity, or some such things, and to make a case for “justice”.

As it must be very clear, the allocation of blocks on the right is more efficient than the allocation of the blocks on the left – the tallest guy simply doesn’t need any blocks, while the shortest guy needs two.

And if you think about it, you don’t need any top-down “justice” to allocate the blocks in the right manner. All it takes is a bit of logical thinking and markets – and not even efficiently.

Think about how this scenario might play out at the ball park. The three boys go to see the ball game, and see three blocks at the fence. Each of them climbs a block, and we get the situation on the left.

Shortest boy realises he can’t see and starts crying. There are many ways in which this story can play out from here onward:

  1. Tallest boy realises that he doesn’t really need that extra block, and steps down and gives it to the shortest guy, giving the picture on the right.
  2. Tallest boy continues to stand on his block. Shortest boy realises that the tallest boy doesn’t need it, and requests him for the block. Assuming tallest boy likes him, he will give him the block.
  3. Tallest boy continues on the block. Shortest boy requests for it, but tallest boy refuses saying “this is my block why should I give it to you?”. Shortest boy negotiates. Tells tallest boy he’ll give him a chocolate or some such in return for the block. And gets the block.
  4. Tallest boy doesn’t want chocolate or anything else the shortest boy offers. In fact he might want to settle a score with the shortest boy and refuses to give the block. In this case, the shortest boy realises there is no point being there and not watching the ball game, and makes an exit. In some cases, the middle boy might negotiate with the tallest boy on his behalf, leading to the transfer of the block. In other situations, the shortest boy simply goes away.

Notice that in none of these situations (all of them reasonably “spontaneous”) does the picture on the left happen. In other words, it’s simply unrealistic. And you don’t need any top down notion of “justice” to enable the blocks to be distributed in a “fair” manner.

Understanding Stock Market Returns

Earlier today I had a short conversation on Twitter with financial markets guru Deepak Mohoni, one of whose claims to fame is that he coined the word “Sensex”. I was asking him of the rationale behind the markets going up 2% today and he said there was none.

While I’ve always “got it” that small movements in the stock market are basically noise, and even included in my lectures that it is futile to fine a “reason” behind every market behaviour (the worst being of the sort of “markets up 0.1% on global cues”), I had always considered a 2% intra-day move as a fairly significant move, and one that was unlikely to be “noise”.

In this context, Mohoni’s comment was fairly interesting. And then I realised that maybe I shouldn’t be looking at it as a 2% move (which is already one level superior to “Nifty up 162 points”), but put it in context of historical market returns. In other words, to understand whether this is indeed a spectacular move in the market, I should set it against earlier market moves of the same order of magnitude.

This is where it stops being a science and starts becoming an art. The first thing I did was to check the likelihood of a 2% upward move in the market this calendar year (a convenient look-back period). There has only been one such move this year – when the markets went up 2.6% on the 15th of January.

Then I looked back a longer period, all the way back to 2007. Suddenly, it seems like the likelihood of a 2% upward move in this time period is almost 8%! And from that perspective this move is no longer spectacular.

So maybe we should describe stock market moves as some kind of a probability, using a percentile? Something like “today’s stock market move was a top 1%ile  event” or “today’s market move was between 55th and 60th percentile, going by this year’s data”?

The problem there, however, is that market behaviour is different at different points in time. For example, check out how the volatility of the Nifty (as defined by a 100-day trailing standard deviation) has varied in the last few years:


As you can see, markets nowadays are very different from markets in 2009, or even in 2013-14. A 2% move today might be spectacular, but the same move in 2013-14 may not have been! So comparing absolute returns is also not a right metric – it needs to be set in context of how markets are behaving. A good way to do that is to normalise returns by 100-day trailing volatility (defined by standard deviation) (I know we are assuming normality here).

The 100-day trailing SD as of today is 0.96%, so today’s 2% move, which initially appears spectacular is actually a “2 sigma event”. In January 2009, on the other hand, where volatility was about 3.3% , today’s move would have been a 0.6 sigma event!

Based on this, I’m coming up with a hierarchy for sophistication in dealing with market movements.

  1. Absolute movement : “Sensex up 300 points today”.
  2. Returns: “Sensex up 2% today”
  3. Percentile score of absolute return: “Sensex up 3%. It’s a 99 %ile movement”
  4. Percentile score of relative return: “Sensex up 2-sigma. Never moved 2-sigma in last 100 days”

What do you think?

China, Reporting and Bias

The amount of attention that the rising Chinese stock market received over the last one year is nothing close to the attention that the falling market has received over the past month or so.

While the markets have fallen by at least a fourth, which is more than what the Dow Jones Industrial Average (DJIA) fell on Black Monday, the fact is that this followed nearly a year of insane rise in the markets, the fact is that markets are still up 80% over a year ago.

I hereby present two charts. Both are time series and hence drawn as lines, and both start from 1st of January 2014. The first shows the SSE Composite Index  (refer to Yahoo finance for a more interactive plot. I couldn’t embed the chart here).

chinaThe second shows the Google Trends for “China Stock Markets” over the same time period.



I don’t think I need to explain much further. On the way up, there was little commentary on China’s markets, apart from that there might be a bubble. On the way down, though, there is so much more!

The asymmetry in markets is rather intriguing!

The NRN premium is over

With the resignation of Infosys President BG Srinivas and the subsequent drop in the share price in the markets today, the NR Narayana Murthy premium on the Infosys stock is over. Ironically, this happens almost exactly a year since NRN made a comeback to the company in an executive capacity.

The figure below charts how the Infosys stock and the market index (Nifty ) have moved in the last one year. In order to compare the two, we have indexed their prices as of 30th May 2013, just before NRN’s return was announced (the announcement was made as of 2nd June, but the sharp spike in Infy on 31st May 2013, when the broad market fell, can be attributed to insider trading by people in the know), to 100. Notice how the Infosys stock soared in the six months after NRN’s return. In January and February, the stock traded at a 60% premium to its pre-NRN value, while the nifty was practically flat till then.


And then things started dropping. Even when the broad markets rose in March-April this year, Infosys continued to fall. The rally in early-mid May took it along, but now the stock has fallen again. This morning (latest data as of noon), the stock has fallen by about 6% thanks to Srinivas’s departure, and we can see that the gap between Infy and the market has really narrowed.

Next, we look at the ratio of the Infy price to the market index. Again we index it to 100 as of 30th May 2013. This graph shows the premium in the Infy share price over the last year. Notice that for the first time, the premium has fallen below 10% (it’s currently 7%). 



Finally, we will compare the Infy stock to the CNX IT index, which tracks the sector (that way, any sectoral premium in Infy can be extracted out). Again, we will plot the relative values of Infy to the CNX IT index, indexed to 100 as of 30th May 2013.


This graph looks like no other. What this tells us is that whatever premium Infosys enjoys over the broad market is a function of the sector, and that ever since the sharp drop in early March (on account of weak results), the NRN premium on the Infy stock relative to the sector has disappeared. As of now, compared to the sector, Infy is at an all time low.

Finally, a regression. If we regress infy stock returns against the returns in the IT index and Nifty, what we find is that Nifty returns hardly affect Infosys returns (R^2 of 7%), while the IT Index returns explain about 76% of Nifty returns. When regressed against both, Nifty returns come out as insignificant and the R^2 remains at 76%.

Putting all these statistics aside, however, the message is simple – the NRN premium on the Infy stock is over.



Why standard deviation is not a good measure of volatility

Most finance textbooks, at least the ones that are popular in Business Schools, use standard deviation as a measure of volatility of a stock price. In this post, we will examine why it is not a great idea. To put it in one line, the use of standard deviation loses information on the ordering of the price movement.

As earlier, let us look at two data sets and try to measure their volatility. Let us consider two time series (let’s simply call them “series1” and “series2”) and try and compare their volatilities. The table here shows the two series:

vol1 What can you say of the two series now? You think they are similar? You might notice that both contain the same set of numbers, but jumbled up.  Let us look at the volatility as expressed by standard deviation. Unsurprisingly, since both series contain the same set of numbers, the volatility of both series is identical – at 8.655.

However, does this mean that the two series are equally volatile? Not particularly, as you can see from this graph of the two series:


It is clear from the graph (if it was not clear from the table already) that Series 2 is much more volatile than series 1. So how can we measure it? Most textbooks on quantitative finance (as opposed to textbooks on finance) use “Quadratic Variation” as a measure of volatility. How do we measure quadratic variation?

If we have a series of numbers from a_1 to a_n , then the quadratic variation of this series is measured as

sum_{i=2 to n} (a_i - a_{i-1})^2

Notice that the primary difference feature of the quadratic variation is that it takes into account the sequence. So when you have something like series 2, with alternating positive and negative jumps, it gets captured in the quadratic variation. So what would be the quadratic variation values for the two time series we have here?

The QV of series 1 is 29 while that of series 2 is a whopping 6119, which is probably a fair indicator of their relative volatilities.

So why standard deviation?

Now you might ask why textbooks use standard deviation at all then, if it misses out so much of the variation. The answer, not surprisingly, lies in quantitative finance. When the price of a stock (X) is governed by a Wiener process, or

dX = sigma dW

then the quadratic variation of the stock price (between time 0 and time t) can be shown to be sigma^2 t , which for t = 1 is sigma^2 which is the variance of the process.

Because for a particular kind of process, which is commonly used to model stock price movement, the quadratic variation is equal to variance, variance is commonly used as a substitute for quadratic variation as a measure of volatility.

However, considering that in practice stock prices are seldom Brownian (either arithmetic or geometric), this equivalence doesn’t necessarily hold.

This is also a point that Benoit Mandelbrot makes in his excellent book The (mis)Behaviour of Markets. He calls this the Joseph effect (he uses the biblical story of Joseph, who dreamt of seven fat cows being eaten by seven lean foxes, and predicted that seven years of Nile floods would be followed by seven years of drought). Financial analysts, by using a simple variance (or standard deviation) to characterize volatility, miss out on such serial effects.

Stock market volatility spikes

The Indian stock markets have become especially volatile. Figure 1 shows the volatility of the Nifty in the last three years. As usual, we use a trailing 30-day quadratic variation as a measure of volatility. Don’t bother about the units of the y-axis, just look at the relative movement.

Source: Yahoo
Source: Yahoo

Notice that the volatility levels we have seen in the last month or so are unprecedented in the last three years. Let us take a closer look:

Source: Yahoo
Source: Yahoo

This gives us a better picture. Volatility was well under control till mid-August, when it started rising (since we use a 30-day trailing QV, this means that markets started getting choppy in mid-July). The volatility is now at an all-time high.

However, the official volatility index (India VIX) disagrees. According to this, volatility has actually dropped from its all-time high. The VIX also looks significantly choppy.

Source: NSE
Source: NSE


Perhaps this indicates some trading opportunity in options?