Tag: macro

Macro: Is there a relationship between US Treasury and NIFTY 50 returns?

We often hear pundits talk about moves in US treasuries when discussing the NIFTY. Is there a connection? And more importantly, is there a connection that can be exploited?

Two-year US Treasury weekly returns vs. subsequent NIFTY 50 returns

Two-year US Treasury weekly returns vs. subsequent NIFTY 50 returns

Ten-year US Treasury weekly returns vs. subsequent NIFTY 50 returns

Ten-year US Treasury weekly returns vs. subsequent NIFTY 50 returns

It doesn’t look like there is a link between the two on a weekly basis. Maybe it works in subtler ways (“sentiment”) but it doesn’t look like moves in US Treasuries can be used to trade the NIFTY 50.

Macro: Computing DTWEXM before the FRED

In our posts on using currency indices published by the FRED to predict the NIFTY (collection), we assumed that the currency indices will be available to us on Friday before NIFTY closes. This is problematic on two counts:

  1. The FRED publishes the currency indices only on Monday afternoons, or the next business day if they were closed.
  2. The dataset uses Friday index values which is Friday New York time. NIFTY would have closed for the weekend a good 24 hours before that.

In this post, we will get around the #1 problem by computing the currency index we are interested in (DTWEXM) by using the underlying the currencies themselves and the weights used by the FRED. Here are the results:

computing DTWEXM

Apart from a few outliers, the approach looks to be good enough.

For those who are curious about how this was done, the code is on github.


Can global “macro” data be used to model local markets?

Correlation and linear models

A series of posts exploring the (lack of) linear relationship between USDINR, OIL and the NIFTY 50. Part I, Part II and Part III.

Machine learning

Using an SVM over dollar indices to trade the NIFTY

An SVM can be tuned with different parameters. Principal among those is the kernel to be used. Part I looks at the difference in predictive power when different kernels are used to train an SVM over the same dataset.

Part II tries to further tune the most promising kernel from Part I – the polynomial kernel. However, we find out that there is no silver bullet.

So, we take all the dollar indices (including USDINR) and observe the predictive power of an SVM using a polynomial kernel with varying degree parameters. We find that only two out of four indices are actually useful and that going too far back in history while training the SVM is counterproductive (Part III.)

Part IV trains an SVM using the two promising indices and their respective best-performing degree parameters from Part III. An ensemble model that chains the predictions looks promising.

While performing the experiments above, we noticed that none of these models side-step the 2018 drawdown. Their principal limitation is that they are “macro.” They will not handle local events well. So we combine the model from Part III with a Simple Moving Average and find that it leads to lower drawdowns in long-short portfolios. Part V also leads us to conclude that using just one of the indices is sufficient to meet our twin goals of shallower drawdowns and higher long-short returns.

Macro: Using Currencies to Predict NIFTY, Part V

Please read Part I and Part II for an introduction. Part III extends the treatment to other dollar indices. Part IV looked at an ensemble model from our learnings from Part III.

In this final part of our series on training a simple Support Vector Machine on currency indices to predict the NIFTY, we will incorporate a Simple Moving Average into our decision matrix. While our model in Part IV would go long/long-short based purely on the predictions of the SVM, the model we use here will go long only if both the prediction is positive and the NIFTY is above a 50-day SMA and go short only if both the prediction is negative and the NIFTY is below its 50-day SMA. Think of the SMA as a regime signifier.


Cumulative returns:

DTWEXB%2BDTWEXM.NIFTY cumulative returns

BH: buy & hold
L0: Long-only using SMA 50 alone
LS0: Long-short using SMA 50 alone

L1: Long-only using DTWEXB SVM and SMA 50
LS1: Long-short using DTWEXB SVM SMA 50

L2: Long-only using DTWEXM SVM and SMA 50
LS2: Long-short using DTWEXM SVM SMA 50

L: Long-only using ensemble SVM and SMA 50
LS: Long-short using ensemble SVM SMA 50

The SVM that is only based on DTWEXM (LS2) give better returns than the one based on the ensemble model (LS.) However, the ensemble model had a slightly lower drawdown of the two. Also, when compared to the earlier version that did not use the SMA, LS2 under-performs by about 10%. However, the key difference is in the drawdowns. Using the SMA filter reduced drawdowns significantly, especially the one occurring in 2018.

Without SMA filter:
no SMA drawdowns
With SMA filter:
SMA drawdowns


An SVM with a 4th degree polynomial over the DTWEXM currency index in conjunction with a 50-day SMA seems to be the winning combination.

Code and charts are on github.

Macro: Using Currencies to Predict NIFTY, Part IV

Please read Part I and Part II for an introduction. Part III extends the treatment to other dollar indices.

In this part of our ongoing series on using SVMs on dollar indices to predict the NIFTY 50, we create an ensemble of two models. We combine one on DTWEXB, using an 8th degree polynomial kernel and another on DTWEXM, using a 4th degree polynomial kernel, to create long-only and long-short portfolios.


Here are the cumulative returns of the standalone models and the ensemble:

The standalone model over DTWEXM (LS2) seems to outperform all other models, including buy and hold. However, the ensemble model (LS) has lower drawdowns and comes in at second place. Here are the list of drawdowns deeper than 5% over the test dataset:

Buy and hold drawdowns

buy and hold NIFTY drawdowns over 5%

Ensemble drawdowns


In the next (and final) post, we will explore if we can add a simple technical signal into to mix to boost returns and reduce drawdowns.

Code and charts are on github.