Author: shyam

USDINR and Dollar Indices, Part II

Please read Part I for the introduction.

In Part I, we saw that if we force the intercept to be zero during linear regression between two series A and B, we end up with A = βB. In this post, we go one step further and define spread = A – βB

Pair trading

Readers of our posts on pair trading will immediately recognize the above relationships. The idea here is that if we assume USDINR to be dependent on DTWEXB, DTWEXM and DTWEXO indices, then we:

  1. calculate the spread between USDINR and each of the indices in turn,
  2. check if the spread is ‘stable’ by conducting an adf test on the residuals of the linear fit and checking if the p-value is less than a threshold,
  3. if the p-values confirm stability, then we can go long/short the spread whenever it deviates from the mean.

Spreads

When we plot the spreads and p-values, we see that a 50-day period is probably the most suitable time-frame over which to calculate the spread. And, we also observe considerable mean-reversion suggesting that a trading model can be built over it.
spread between USDINR.DTWEXO
spread between USDINR.DTWEXM
spread between USDINR.DTWEXB

In Part III, we will back-test a couple of trading models based on these spreads.

Code and charts are on github.

USDINR and Dollar Indices, Part I

The St. Louis Fed publishes a number of economic and financial series on its Federal Reserve Economic Data (FRED) database. It is a treasure trove of information for quants. There are a number of currency related time-series in the database. In this post, we will plot the USDINR exchange rate with the trade-weighted indices available on FRED to explore any relationships that there might be between them.

Trade-weighted indices

A trade-weighted dollar index is simply the weighted average of the foreign exchange value of the U.S. dollar against the currencies of a group of U.S. trading partners. The FRED publishes the following such indices:

  1. DTWEXB: Includes the Euro Area, Canada, Japan, Mexico, China, United Kingdom, Taiwan, Korea, Singapore, Hong Kong, Malaysia, Brazil, Switzerland, Thailand, Philippines, Australia, Indonesia, India, Israel, Saudi Arabia, Russia, Sweden, Argentina, Venezuela, Chile and Colombia.
  2. DTWEXM: Includes the Euro Area, Canada, Japan, United Kingdom, Switzerland, Australia, and Sweden.
  3. DTWEXO: Includes Mexico, China, Taiwan, Korea, Singapore, Hong Kong, Malaysia, Brazil, Thailand, Philippines, Indonesia, India, Israel, Saudi Arabia, Russia, Argentina, Venezuela, Chile and Colombia.

Additionally, they also publish the DEXINUS series that is the USDINR exchange rate.

These series go back to the mid-70’s and mid-90’s. However, India was a closed economy with a managed currency for the most parts. So for the rest of this post, we will consider data only from 2005 onward.

Here is how the time-series looks:
FRED DEXINUS-DTWEXB-DTWEXM-DTWEXO indices

Beta between USDINR and the rest

What we are interested in is the relationship between USDINR and the rest of the trade-weighted averages. DTWEXB and DTWEXO have India exposure with the latter made up predominantly of emerging markets. So we should expect a high beta between USDINR and those.

To calculate the beta, we will fit a linear model through USDINR and each of the trade-weighted indices in turn. Also, we will force the intercept to be zero to force the fit.

Here are the betas with a 20-day look-back:
20-day beta between USDINR and trade-weighted indices

Here are the betas with a 50-day look-back:
50-day beta between USDINR and trade-weighted indices

The 20-day chart shows that the beta oscillates within a tight band for the most part. This insight can be used to build a mean-reversion model for USDINR.

In Part II, we will explore the spread between USDINR and all three of the indices. Stay tuned!

Code and charts are on github.

Minimizing the role of luck in systematic trading

The following post is a replication of the Newfound Research article When Simplicity Met Fragility (pdf)

Thesis

Returns are function of both luck and skill. Even while applying systematic strategies like trend-following, momentum or value, there is always negative beta that sometimes overwhelms positive alpha. The article shows that “simple” strategies are often “fragile” because of the role of randomness (luck.) So it makes sense to combine different strategies within the same umbrella to make the investment process more robust. For example, there are more than a few dozen ways to implement a momentum strategy. Combining a few of them will result in a portfolio that is less exposed to luck.

Replication results

We used R to replicate the process described in the article on the S&P 500 index. We downloaded index values from Yahoo Finance and put through the same steps. Here is the single-strategy spread chart that uses 12-1 month momentum:

And this is the multi-strategy spread chart that combines three trend-following strategies including the one above:

As you can see, the multi-strategy chart is a lot less choppy that the single-strategy one. We will chalk this up as a successful replication of the original article.

The NIFTY 50 experience

Would the thesis hold when applied to the NIFTY 50 index?
Here is the single-strategy spread:

And here is the multi-strategy spread:

As you can see, the multi-strategy chart is a lot less choppy that the single-strategy one on the NIFTY 50 index as well.

Take-away

By combining different approaches under the same systematic strategy umbrella, investors can reduce the fragility of their overall portfolio and the influence of luck over the investment outcome.

This is something that we have been doing with our Themes right from the beginning. It just felt like common-sense back then. It is nice to see it in numbers.

Code and charts are on github.

Book Review: Bad Blood

In Bad Blood: Secrets and Lies in a Silicon Valley Startup (Amazon,) author John Carreyrou chronicles the fraud that was Theranos.

For those who don’t know about Theranos, it was a Silicon Valley unicorn that claimed to have invented a device that would run over 200 diagnostic tests on single drop of your blood. A pin-prick was all that took. Turned out that they had invented no such device. But that didn’t stop them from selling it to drug chains and supermarket stores and conducting over a million blood tests. The author was instrumental in blowing its cover at the Wall Street Journal. Theranos subsequently recalled the results of all of its tests and has recently decided to dissolve itself after top executives were indicted for defrauding investors.

Hardware is hard. Healthcare is harder still. It takes over 10 years and $2 billion to get a drug to market. There is a reason for that. The first goal is healthcare is to “do no harm.” Trying to mesh this with the Silicon Valley ethos of “build fast and break things” is a recipe for disaster. You cannot code away bottlenecks created by physics, biology and chemistry that easily. To make matters worse, the Theranos CEO seemed to have embraced two other adages – “fake it till you make it” and “better to ask for forgiveness than to wait for permission.” Works fine when you are trying to sell an app.

The Valley is full of stories about how many big software companies that we know today would never have existed if they had played it straight. There is this story about Oracle labeling the buggy first version of its database as “version 2” (because nobody would buy version 1.0) and sending a team of engineers to get it working on the client site (they sold it as a “product” because it would allow them to charge more, but in effect, it was really a service that required an on-site team.) Then there is Uber that brazenly broke taxi regulations everywhere and then hired lobbyists to change them in its favor. However, the stories that are celebrated are that of survivors. Those who couldn’t “make it” or couldn’t successfully get “forgiveness” ended up being shuttered and forgotten.

Key take-ways form the Theranos saga:

  • The board of directors have a duty to keep the CEO on the straight and the narrow.
  • Investors should at least talk to a few of a company’s customers before committing capital to it.
  • High staff turnover is a red flag.
  • Not having a full-time CFO in a large company is another red flag.
  • Deals not turning into revenue and revenue not turning into cash in the bank is the reddest flag.

Recommendation: Read it now!

Macro: NIFTY vs. INR/OIL Correlation, Part III

This is the last part of the study. Part I, Part II

The reason why a linear model between NIFTY and USDINR built in Part II failed could have been because:

  1. Weekly returns were not appropriate for the relationship. Perhaps INR affects NIFTY at a higher frequency.
  2. There is no linear relationship because a rising/falling INR. Changes are not uniformly good/bad.

One way to visualize it is to plot the NIFTY returns density at different USDINR return thresholds. If there is no obvious difference in the densities between NIFTY returns when USDINR is positive vs. when it is negative, one could conclude that there is no straight forward relationship between the two.

Here is the NIFTY weekly returns density when USDINR is going up (the rupee is depreciating):
density plot NIFTY vs. USDINR
Note the curve when USDINR weekly returns are greater than 0.5% vs. when are greater than 2%. There is a bearish bias.

And, NIFTY weekly returns density when USDINR is going down (the rupee is appreciating):
density plot NIFTY vs. USDINR

If you juxtapose the above densities, it is apparent that when the rupee is appreciating, the densities skew right, And when the rupee is depreciating, there is a left skew. These charts show that there is “a” relationship – just not what can be captured by a linear model.

Code and density plots for NIFTY vs. OIL can be found on github.