Category: Investing Insight

Investing insight to make you a better investor.

Macro: Using Currencies to Predict NIFTY, Part I

This series of posts pulls together two things we observed in our previous posts:

  1. There is a non-linear relationship between USDINR and the NIFTY (NIFTY vs. INR/OIL Correlation)
  2. There is a stable spread between USDINR and currency indices published by the FRED (USDINR and Dollar Indices)

Here, we use a Support Vector Machine (SVM) to train a model on the returns between the DTWEXM index (Trade Weighted U.S. Dollar Index: Major Currencies) and the NIFTY 50.


  1. Use 1-, 2-, 5- and 10-week returns of DTWEXM to train an SVM on subsequent 1-week returns of the NIFTY 50
  2. Consider two datasets: one between the years 2000 and 2018 and the other between 2005 and 2018 to include/exclude the 2008 market dislocation
  3. Divide the dataset into training/validation/test sets in a 60/20/20 ratio
  4. Use the validation test to figure out which SVM kernel to use
  5. Plot the cumulative return of a long-only, long-short and buy&hold NIFTY 50 strategy based on SVM predictions on the test set
  6. Use the common kernel between the #2 datasets for future experiments


We find that an SVM using a 3rd degree (the default) polynomial kernel gives the “best” results. We use the SVM thus trained to predict next week NIFTY returns and construct long-only and long-short portfolios.

Here are the cumulative returns when the dataset considered is the one between 2000 and 2018. The test set runs from 2015 through 2018:
DTWEXM.NIFTY.polynomial svm

There are some points of concern. For one, the model is heavily long-biased. Even when the actual returns were negative, the predicted values was mostly positive:
DTWEXM.NIFTY.polynomial.actual.vs.predicted svm

Second, the model has tracked the buy&hold NIFTY since the beginning of 2018. The narrative has been that the rise in oil prices caused the CAD to blow out that caused investors to pull out investments that caused the rupee and NIFTY to fall (whew!) Either USDINR moved independently of DTWEXM or the relationship between DTWEXM and NIFTY 50 broke down. It looks like its the former:

Third, the cumulative returns seem to have been majorly influenced by small set of predictions that cut a drawdown that occurred in July-2015 by half. We notice a similar effect on the smaller dataset (2005 through 2018):
DTWEXM.NIFTY.polynomial svm
See how a small branch in Nov-2016 lead to the superior returns of the model predicted portfolios.

Next steps

In the next part, we will fiddle around with the degree of the polynomial used in the kernel to see if it leads to better returns. Subsequent posts will cover the use of the other dollar indices (DTWEXB and DTWEXO) and finally USDINR (DEXINUS) itself.

Code and charts for this post are on github

Fund Portfolios and Market Cap Deciles

When you sort the universe of stocks in descending order of their free-float market caps and divide them into 10 sets, you end up with StockViz Deciles. If you were to plot the dispersion of market-caps within deciles, here’s how it would look:

market cap deciles

Most of the activity in the markets are in the first 3-4 deciles. Liquidity, as measured by the bid/offer spread, trails off as the float drops:
bid/offer spread by market cap decile

The wide bid/offers presents a scale challenge to small-cap fund managers. The hair-cut to NAV that they will have to take while crossing the spread is just too large. So most small-cap funds pull up:

Notice how most of the portfolios is concentrated above the 4th decile. Now, contrast this to the NIFTY SMALLCAP 250 index:
SMALLCAP 250 overlap
If the funds were to stay true to their small-cap moniker, they really shouldn’t be holding decile 0 (mega-cap) stocks. However, holding them seems to be the only way to scale AUM.

If you care about whether a fund is sticking to its portfolio mandate, give our Overlap Tool a spin.

Book Review: The Discipline of Market Leaders

The Discipline of Market Leaders (Amazon,) is about the importance of focusing on either one of cost, innovation, or service.

A company cannot be everything for everybody. It can be a highly efficient low-cost provider of a utility, or it could be a high-cost provider of innovative products, or it could be so close to its customers that they stick with it for its superior service.

The general message of the book could be useful for investors in old-economy stocks. Figuring out how a company scores along these drivers of value could help in evaluating the robustness of the “moat.”

However, things change. Consider this chart from Understanding Abundance:

Along with cost/innovation/service, in the age of abundance, companies need to also choose between being a “utility” business or a “pointy” business. The drivers of value have shifted.

All said, the book was published in the late-90’s and hasn’t aged well. The examples are dated and some of the exemplar companies have gone bankrupt.

Recommendation: Skip it.

VIX and Equity Index Returns, Part II

Please read Part I for the introduction.

Holding-period back-test

In Part I, we ran a quick back-test that would go long the equity index if the VIX was in a certain quintile and saw how the 5th quintile produced the lowest draw-down returns. The index was held only for a day. However, our box-plot of VIX quintile vs. subsequent n-day returns begs us to look at alternate holding periods as well. What would the returns be if we held onto the index beyond a day?

Here is how long-only S&P 500 returns when VIX is in the 5th quintile, across different holding periods looks like:
S&P 500 returns

The problem with this strategy is that when there is a steep fall in the index, the VIX keeps going higher and will be in the 5th quintile for an extended period of time. Have a look at the 2008-2009 segment in this chart:
VIX quintiles over S&P 500

What happens if we used the change in VIX to time the equity index?

VIX returns deciles

If we bucket VIX returns (percentage change over previous close over n-days, 1000 trailing observations) into deciles and observe the next 5, 10, 15 and 20-day returns of the underlying index over them:
S&P 500 returns over changes in VIX

There is no determinable pattern here. Perhaps the VIX and the index are co-incident with none holding the power of prediction over the other.

Interested readers can browse the github repo for corresponding Nikkei 225 and NIFTY 50 charts.

VIX and Equity Index Returns, Part I

The VIX is a measure of implied volatility of the underlying index. For example, the CBOE Volatility Index is a measure of 30-day expected volatility derived from S&P 500 Index call and put option prices, India VIX similarly uses the NIFTY 50 call and put options prices to derive a measure of volatility. The question we will try to address in this series of posts is whether the VIX can be used to time entries and exits on the underlying index.

The VIX time-series

CBOE and India VIX
The VIX on S&P 500 has been around since the 90’s whereas India VIX started out around 2009. Moreover, the US enjoys a much wider and deeper market for volatility products than any other market in the world. VIX futures, VIX options, VIX of VIX, volatility ETFs and their inverse, all trade fairly well. Whereas in India, even though VIX futures have been listed for a while, it rarely trades. Trading activity of a derivative (VIX, in this case) invariably has an effect on the underlying (S&P 500, NIFTY 50…) So we expect the relationship between S&P 500 VIX and the S&P 500 index to be closer than that between India VIX and the NIFTY 50 index.

VIX quintiles

To begin, we will bucket the trailing 1000-day VIX closing prices into quintiles and observe the next 5, 10, 15 and 20-day returns of the underlying index over them.
S&P 500 VIX
SP500 returns over VIX quintiles
And, more recently:
SP500 returns over VIX quintiles

What is striking here, is that subsequent returns off the 5th quintile (when VIX is at its highest) is higher with smaller negative outliers than returns off the 1st quintile (when VIX is a its lowest.) This is counter-intuitive to the notion that “volatility begets volatility” so investors are better off staying away from the market when it is volatile.

India VIX and NIFTY 50 shows a similar pattern*:
NIFTY 50 returns over India VIX quintiles
*Smaller sample compared to the S&P 500 dataset.

A simple back-test

What happens to a long-only portfolio if it is long the index only when the VIX is within a particular quintile?
S&P 500/VIX
S&P 500 returns over different VIX quintiles
The strategy that is long when VIX is in the 5th quintile (L5) out-performs the other quintile strategies. Also, if you ignore the 2008 collapse, L5 has the shallowest of drawdowns.
Something similar happens with NIFTY 50 as well:
NIFTY 50 returns over different VIX quintiles


Cash-only investors can point to the superiority of buy&hold compared to these VIX-based strategies. However, the shallow drawdowns exhibited by the L5 strategy (long index when VIX is in the 5th quintile) is attractive to leveraged traders. For example, NIFTY 50 futures leverage is between 8x and 10x. So even if you play it safe and leverage only 5x, L5 returns would end up at ~100% compared to buy&hold’s 80% over the same period.

We will dig deeper in the next part of this series. Stay tuned!

Code and more charts are on github.