Back

Adaptive Asset Allocation: ReSolve Asset Management

I have attempted to build the Adaptive Asset Allocation (AAA) algorithm outlined in ReSolve Asset Management's white paper. You can add any additional asset classes in the self.additional list that are't included in the original.

Please provide any feed back on code improvement. 

I hope it's useful!

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.


Nice work! Thanks for sharing it. The code is very neat and easy to read. One suggestion I might have is about the history request. self.History() affects the running speed of the algorithm. 

hist1 = self.History(self.stocks, 200, Resolution.Daily).unstack(level=0).close
hist2 = self.History(symbols, 200, Resolution.Daily).unstack(level=0).close.pct_change()[1:]

These two history methods get the same set of historical data. This repeat request slows down the algorithm. You can only select the required columns in the first history to construct a new dataframe.

For example, the above code is equivalent to the following 

hist1 = self.History(self.stocks, 200, Resolution.Daily).unstack(level=0).close
hist2 = hist[symbols].pct_change()[1:]

2


Thanks for the feedback

0

This code has stopped working. I think symbol reference logic has changed? Can someone have a look please?

System.Collections.Generic.KeyNotFoundException: Trying to retrieve an element from a collection using a key that does not exist in that collection throws a KeyError exception. To prevent the exception, ensure that the 'VNQ', 'EEM', 'EZU', 'SPY', 'RWX', 'QQQ', 'IWM', 'IJR' key exist in the collection and/or that collection is not empty. ---> Python.Runtime.PythonException: KeyError : "None of [Index(['VNQ', 'EEM', 'EZU', 'SPY', 'RWX', 'QQQ', 'IWM', 'IJR'], dtype='object', name='symbol')] are in the [columns]"

0

Hi Lexx7,

There seems to be a bug with selecting multiple columns in the history DataFrame with a list of Symbols. See the attached research notebook for reference.

I've created a GitHub Issue to have this resolved. Our progress can be tracked here. For the time being, we can work around this bug by converting the list of tickers in Initialize to a list of Symbols.

self.stocks = [self.AddEquity(x, Resolution.Minute).Symbol for x in self.stocks]

Then when we are selecting the best performers, we just need to convert each Symbol to a Security Identifier.

symbols = []
for sym in range(int(len(sort) / 2)):
symbols.append(str(sort[sym][0].ID))

See the attached backtest for reference.

Best,
Derek Melchin

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.


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