Hi All,
I read a paper today titled "A Quantitative Approach to Tactical Asset Allocation" by Mebane Faber, first published in May 2006. It's basis (implemented below) is a simple Global Asset Allocation Buy &Hold portfolio, against which we should measure the performance of the various iterations of his Global Tactical Asset Allocation Models (to follow).
As expected for a global diversified portfolio (B&H) it yields a sharpe ratio in the order of 0.4 (owning individual "Risky" assets usually returns a sharpe around 0.2). It appeasrs the previous decade has been quite extraordinary for the S&P, with a sharpe=0.7!
This is my first attempt (as a hobbyist programmer) at an algorithm on QuantConnect, using the structure provided in the AlgorithmFramework, so questions, comments & criticisms are all welcome!
Derek Melchin
Hi Mark,
Great first attempt! Here are a few small improvements to consider:
Best,
Derek Melchin
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.
Mark Reeve
Thanks Derek!
Is this what you mean by using list comprehension and insight duration (Refer attached backtest)?
What do you mean when you say to keep Initialize "dry"?
Also, I couldnt get the daterules/timerules function to work for me with PC.... eg,
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(self.DateRules.MonthStart(), self.TimeRules.AfterMarketOpen('SPY', 5)) )
Can you see my obvious error?
Many Thanks,
Mark
Derek Melchin
Hi Mark,
Great job! This is exactly what I mean by using list comprehension and changing the insight duration.
"DRY" is an acronym for "Don't Repeat Yourself". By using list comprehension in Initialize like this, we type `Symbol.Create(...)` once instead of 5 times.
The EqualWeightingPortfolioConstructionModel constructor can't take both a DateRules and TimeRules parameter. Instead, we can accomplish monthly rebalancing after the open by passing the construct a function.
self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(self.RebalanceFunction)) self.lastRebalanceMonth = -1
We then define the rebalancing function as
def RebalanceFunction(self, time): if self.Time.hour == 9 and self.Time.minute == 31 and self.Time.month != self.lastRebalanceMonth: self.lastRebalanceMonth = self.Time.month return time
See the attached algorithm for a working solution.
Best,
Derek Melchin
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.
Mark Reeve
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.
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!