Back

Ray Dalio's All Weather Strategy

With just a few lines of code, I have implemented  Ray Dalio's All Weather Strategy.

The strategy is based on a target portfolio of weighted etfs representing different markets:

  • 30% Vanguard Total Stock Market ETF (VTI)
  • 40% iShares 20+ Year Treasury ETF (TLT)
  • 15% iShares 7 – 10 Year Treasury ETF (IEF)
  • 7.5% SPDR Gold Shares ETF (GLD)
  • 7.5% PowerShares DB Commodity Index Tracking Fund (DBC)

The rules are ridiculously simple, since all there is to do is rebalancing the portfolio once a year, to the fixed target weights.

The attached backtest shows, that the strategy works quite well and with a relatively low drawdown and low interest rates, you can even use some leverage. 

Feel free to comment and improve. 

Update Backtest








0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Somewhere or other on my website you will find a python standalone interpretation of the all weather strategy. I chose, a la Dalio, to adopt some bond leverage although arguably an allocation to the long bond is leverage enough.

Google all-weather-portfolio-1928-2018. I used the T Bill rate, bond futures and total returns for the S&P 500 as extended.  You will also find some arguments on my website as to why (in my opinion) rising interest rates will not screw the strategy provided it does not happen too fast (as in the Volker period).

Nice strategy.

Personally I do not favour commodities. But that is only my view. At least stocks and bonds have an obvious upwards bias. No so commodities over time.

But who am I to say....

0

Thanks for sharing! That beta (-0.018 !!) is pretty amazing, given the low rebalancing frequency. I think I'm going to manually implement this for my 401k for this year.

2

Awesome strategy; this definitely inspired me to try something similar!

1

For anyone interested in this, it's also worth exploring other fixed portfolios. Some examples:

https://fourpillarfreedom.com/heres-how-18-different-portfolios-have-performed-since-1970/

 

1

I ran the backtest again - just to see how this strategy is holding up due to the on going global pandemic. 

The strategy (monthly rebalanced) is suffering from a max 8.6% drawdown due to this corona virus triggered downward trend, much better than the market (27.6% drawdown this year if holding 100% VTI).

1


Thank you for posting this!

Can you please explain the double indexing of [0][0] in the below line? I understand it runs every monthstart after market open (only triggering the re-weighting if monthCounter == 12) but why is it [0][0]? Is it because self.etfs contains multiple instruments?

self.Schedule.On(self.DateRules.MonthStart(self.etfs[0][0]),self.TimeRules.AfterMarketOpen(self.etfs[0][0]), self.Rebalance)

 

 

Additionally why do you have both these two lines inside Initialize?

self.monthCounter = 0

self.monthCounter = 1

 

 

Thanks again

 

 

0

Hey Louis,

When we use DateRules.MonthStart(symbol), the scheduled event will fire on the first day of the month that this particular symbol is trading. self.etfs[0] returns the tuple (self.AddEquity('VTI', Resolution.Daily).Symbol, 0.3), which is a symbol and a float. Then self.etfs[0][0] returns the 1st element of that tuple, which is the symbol of "VTI". This means our scheduled event will fire on first day of each month that "VTI" is trading.

Learn more in the scheduled event documentation.

Best
Rahul

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thank you Rahul for your great explanation

 

I have attempted to run live in quantconnect paper trading a version of this strategy with x2 leverage which is pasted below,  it appears that two entry orders did not execute properly.

 

def Initialize(self):

self.AddEquity('VTI', Resolution.Daily).Symbol #Vanguard Total Stock Market ETF
self.AddEquity('TLT', Resolution.Daily).Symbol # iShares 20+ Year Treasury ETF (TLT)
self.AddEquity('IEI', Resolution.Daily).Symbol #iShares 7 – 10 Year Treasury ETF (IEF)
self.AddEquity('GLD', Resolution.Daily).Symbol #SPDR Gold Shares ETF (GLD), #SPDR Gold Shares (GLD)
self.AddEquity('DBC', Resolution.Daily).Symbol # PowerShares DB Commodity Index Tracking Fund (DBC)


self.Securities["VTI"].SetLeverage(2)
self.Securities["TLT"].SetLeverage(2)
self.Securities["IEI"].SetLeverage(2)
self.Securities["GLD"].SetLeverage(2)
self.Securities["DBC"].SetLeverage(2)


self.SetStartDate(2005,1,1)
#self.SetEndDate(2016,4,1)
self.SetEndDate(datetime.today() - timedelta(1))
self.SetCash(250000)
self.lastYear = -1


def OnData(self, data):


if not self.Portfolio.Invested:
self.SetHoldings('VTI', 0.6)
self.SetHoldings('TLT', 0.7)
self.SetHoldings('IEI', 0.3)
self.SetHoldings('GLD', 0.15)
self.SetHoldings('DBC', 0.15)


#annual rebalancing
if self.Time.year == self.lastYear:
return
self.lastYear = self.Time.year
self.SetHoldings('VTI', 0.6)
self.SetHoldings('TLT', 0.7)
self.SetHoldings('IEI', 0.3)
self.SetHoldings('GLD', 0.15)
self.SetHoldings('DBC', 0.15)

from the log:

2020-03-24 04:00:00 :New Order Event: Time: 03/24/2020 04:00:00 OrderID: 1 Symbol: VTI Status: Submitted2020-03-24 04:00:00 :New Order Event: Time: 03/24/2020 04:00:00 OrderID: 2 Symbol: TLT Status: Submitted2020-03-24 04:00:00 :New Order Event: Time: 03/24/2020 04:00:00 OrderID: 3 Symbol: GLD Status: Submitted2020-03-24 04:00:00 :The order quantity for IEI cannot be calculated: the price of the security is zero.2020-03-24 04:00:00 :The order quantity for DBC cannot be calculated: the price of the security is zero.2020-03-24 04:00:00 :The order quantity for IEI cannot be calculated: the price of the security is zero.2020-03-24 04:00:00 :The order quantity for DBC cannot be calculated: the price of the security is zero.

 

 I checked the datafreeds and they shouldn't be reading as zero giving the trading days. Can anyone spot if I have made an error?
0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed