You are on page 1of 6

2/4/22, 3:03 PM Asset Rotation Strategy With Python | by Lester Leong | Gradient Growth | Medium

Asset Rotation Strategy With Python


Applying Trend Following For Defensive Investing

Photo by AZ Quotes

I’ve learned many things from him [George Soros], but perhaps the most significant is
that it’s not whether you’re right or wrong that’s important, but how much money you
make when you’re right and how much you lose when you’re wrong. — Stanley
Druckenmiller [1]

Back when I started learning about investing, I was interested in global macro. From
studying strong traders in that style, Stanley Druckenmiller and George Soros came up.
Even though global macro is not as popular as it once was, I believe that certain gems
can still be applied to future trading strategies. The quotes above are one takeaway. If
you think you’re right about trade with high confidence, then maximize your reward. In
this article, the strategy covered will be global macro — just kidding; it is going to be
about asset rotation.

Asset Rotation Strategy

Asset rotation has an assumption that different assets move differently at any given time.
From a fundamental viewpoint, you would think this makes sense since different assets

https://medium.com/gradient-growth/asset-rotation-strategy-with-python-6e672a59776 1/6
2/4/22, 3:03 PM Asset Rotation Strategy With Python | by Lester Leong | Gradient Growth | Medium

deliver returns through varying means. Asset rotation’s main purpose is to lower the
downside of market recessions [2]. For example, if we take a portfolio composed of
stocks and bonds, then during a market downturn the portfolio would shift from stocks
to mostly bonds. The reason for the shift to bonds is that bonds are seen as a stable
source of income during bear markets [3]. When you think about it on a personal level, it
makes sense. Even if you did not get a promotion this year due to recessionary factors,
your debt payments still have to be made every month.

Strategy Setup
In this case, we’ll apply asset rotation with a twist — using the trend following to time the
rotation. In particular, 100 day period exponential moving average (EMA) was chosen
just for fun.

Exponential Weighted Function from Pandas to apply as EMA

I was indifferent between a regular moving average and exponential. But chose to pick
the exponential due to it being more responsive to the latest price history.

SPY with 100 EMA taken from GitHub Code

https://medium.com/gradient-growth/asset-rotation-strategy-with-python-6e672a59776 2/6
2/4/22, 3:03 PM Asset Rotation Strategy With Python | by Lester Leong | Gradient Growth | Medium

The indicator, in this case, would be the 100 EMA against the S&P 500 ETF (SPY). Of
course, most people would stop it here and continue, but I wanted to transform the data
a bit to make these crosses with the price and EMA easier to see.

SPY spread against its own 100 EMA taken from GitHub Code

So the strategy will be 100% in SPY, while the price is above the EMA. Once the price
falls below the EMA, the strategy will divest from SPY and go into various bonds. In this
case, the bond ETFs chosen were a mix of intermediate and long-term bonds — IEF and
TLT.

Concentrated Bets

Going into this strategy, I came off the assumption that following the trend based on
moving to different asset classes would produce an acceptable positive return. Therefore,
why not apply the idea of maximizing our edge when the strategy thinks going into
equities will be a winner? Hence I also backtested the results of levering SPY by 3x by
comparing the results without leverage.

https://medium.com/gradient-growth/asset-rotation-strategy-with-python-6e672a59776 3/6
2/4/22, 3:03 PM Asset Rotation Strategy With Python | by Lester Leong | Gradient Growth | Medium

Asset Rotation Strategy without leverage taken from GitHub Code

Asset Rotation Strategy with 3x leverage on equities taken from GitHub Code

The leveraged portfolio seemed to give out much higher returns (over 6x), but graphs do
not say everything. Let us look into a few metrics to make some more practical decisions.

Metrics and Analysis

Asset Rotation Strategy Without Leverage Metrics:

https://medium.com/gradient-growth/asset-rotation-strategy-with-python-6e672a59776 4/6
2/4/22, 3:03 PM Asset Rotation Strategy With Python | by Lester Leong | Gradient Growth | Medium

Unleveraged Metrics from GitHub Code

Asset Rotation Strategy With 3x Leverage on Equities Metrics:

Leveraged Metrics from GitHub Code

The annual rates of returns of both strategies are consistent with what was seen on the
plots. The interesting thing to note is the unleveraged asset rotation strategy has half of
the maximum drawdown of a regular buy and hold of the benchmark (SPY). Another
interesting point is the unleveraged and leveraged asset allocation strategies had spent
less than half of the days within drawdown compared to their benchmark as seen in the
Max DDD metric.

Conclusion

This article covered an example of a simple asset rotation strategy with trend following
as the signal for rotation. Interestingly the strategy proved to lessen the impact of
downside risk from the assets studied in their respective time period. The returns were
improvements over the benchmark. Granted the leveraged strategy had significantly
higher returns, but the maximum drawdown would test the investor’s risk tolerance. I
found the quote below from Forbes to be fitting in this case:

Key Takeaway: Understand and assess your risk tolerance. Concentrated


bets have the potential for outsized investment returns — up or down. —
Zack Friedman, Forbes Contributor [4]

Python code for this article can be found here.

https://medium.com/gradient-growth/asset-rotation-strategy-with-python-6e672a59776 5/6
2/4/22, 3:03 PM Asset Rotation Strategy With Python | by Lester Leong | Gradient Growth | Medium

Disclaimer: All things stated in this article are of my own opinion and not of any
employer. Investing carries serious risk and consult your investment advisor for all
investment decisions. I may actively trade assets stated in this article.

References

[1] AZ Quotes. (n.d.). TOP 7 QUOTES BY STANLEY DRUCKENMILLER: A-Z Quotes.


Retrieved from https://www.azquotes.com/author/32759-Stanley_Druckenmiller

[2] Model Investing. (n.d.). Asset Rotation Model. Retrieved


from https://modelinvesting.com/investment-models/asset-rotation-model/

[3] Simplysafedividends. (2018, January 01). How to Prepare Your Retirement Portfolio
for a Recession. Retrieved from https://www.simplysafedividends.com/intelligent-
income/posts/906-how-to-prepare-your-retirement-portfolio-for-a-recession

[4] Friedman, Z. (2016, December 30). 5 Investment Strategies To Win Like Soros and
Icahn. Retrieved from https://www.forbes.com/sites/zackfriedman/2016/12/20/hedge-
fund-investment-strategies/?sh=30d0e3fc720b

https://medium.com/gradient-growth/asset-rotation-strategy-with-python-6e672a59776 6/6

You might also like