LEAN is the open source
algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a
global community of 80+ engineers and powers more than a dozen hedge funds today.
Alpha League Competition: $1,000 Weekly Prize Pool
Qualifying Alpha Streams Reentered Weekly Learn
more
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.
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.
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.
Anthony FJ Garner
5.8k Pro
,
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
Pangyuteng
8.3k Pro
,
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.
3
Josh M
2k Pro
,
Awesome strategy; this definitely inspired me to try something similar!
1
Mikko M
7.1k Pro
,
For anyone interested in this, it's also worth exploring other fixed portfolios. Some examples:
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).
2
Louis Dwyer
418 Pro
,
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?
Additionally why do you have both these two lines inside Initialize?
self.monthCounter = 0
self.monthCounter = 1
Thanks again
0
Rahul Chowdhury
39.9k Pro
,
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.
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)
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
Jared Broad
STAFF Pro
,
Hey Louis Dwyer for live support please submit a support ticket via the left side of the IDE. We have to pull down the live logs to efficiently assist with debugging live strategies.
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.
Michael Boguslaw
1.1k Pro
,
I backtested this without using leveraged (i.e. leverage = 1). The return was around 8% annually. While 11% annually sounds tempting (with leverage = 1.5), is this worth paying interest on margin? To my knowledge, margin has around a 8% interest rate.
0
Rahul Chowdhury
39.9k Pro
,
Hey Michael,
We can try to calculate when it is worth using leverage in this example. When using leverage, If the total return of your cash including interest payments is greater than the total return with no leverage, then it is worth taking on leverage. Let's calculate at what interest rates it is worth using leverage.
Let's assume we're using 1.5 Leverage, meaning Margin = 0.5 * Cash
For what interest rates on our margin is it worth using leverage?
leveraged Returns > un-leveraged Returns
11% * Cash - I * Margin > 8% * Cash
>> 0.5 * Cash = Margin
reduces to
11% * Cash - I * 0.5 * Cash > 8% * Cash
reduces to
- 0.5 * I > -3%
reduces to
I < 6%
Which means as long as you can get a better interest rate than 6%, it is worth using leverage in this instance,
You could expand on this by also including the interests paid from any short positions taken.
Best Rahul
5
Miriam F.
1.1k Pro
,
The strategy seems very impressive, but I think you have to be very careful when you think of the next few years, after such a long bull market, you have to think twice about what the future bond yield will be when interest rates start to rise ...
1
Arthur Asenheimer
16.7k Pro
,
Hey Michael,
where do you have to pay 8% interest on margin? With zero interest rates in the US, interest rate on margin loans should also be low. For example, at IB it's currently 1.59% (benchmark + 1.5%) as you can see here.
1
Arthur Asenheimer
16.7k Pro
,
edit: you are right, there are indeed other brokers charging margin fees of 8% and more --> Comparison.
So if you want to use leverage regularly, it's maybe a good idea to switch to a broker with lower fees on margin loans.
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...
To unlock posting to the community forums please complete at least 30% of Boot Camp. You can
continue your Boot Camp training progress from the terminal. We
hope to see you in the community soon!