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
I was wondering how I could implement the Black-Litterman Portfolio Construction model with multiple alpah sources? My understanding is that each of the alphas would emit an insight, get consolidated using the consolidator, and generate trading signals executed by the execution model and Portfolio constructor? Ran into an issue and it seems that this algo doesnt seem to want to actually trade.
It seems the alpha insights are generating correctly. Not sure where the disconnect would be for the constructor.
Any help would be sincerly appreciated! I have attached a backtest/code for reference.
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.
Shile Wen
63.5k Pro
,
Hi Miguel,
The reason for this is because this PCM requires Insight magnitude, thus the default Alpha Models in this algorithm will need to be copied and tweaked to include magnitude as an argument. I've added magnitude as an argument to the custom Alpha this can be seen in the attached backtest.
Furthermore, this backtest shows that when using Alphas added through AddAlpha and SetAlpha, only the Alpha Model added from SetAlpha will be used, thus I'd suggest using AddAlpha with multiple Alpha models.I'd also suggest looking at the EMA Universe on how to avoid using History calls daily which can greatly slow down the backtest.
If you are still having issues, please update with a simplified backtest that isolates the issue.
Best, Shile Wen
0
Miguel Palanca
656 Pro
,
Hi Shile Wen,
Thank you for your help!
For your history design suggestion, would it be similar to the first code snippet below?
Additionally, I've run into an error where the algorithm doesn't seem to trade? I updated the resolution to minute resolution and added magnitudes to the alphas. I don't have too much experience creating alphas. Are these the correct modifications to the standard alpha models? It doesn't seem like the magnitudes are able to be manually set?
Thank you in advance,
Miguel
if cf.Symbol not in self.holdsec:
self.holdsec[cf.Symbol] = SymbolData(cf.Symbol)
# Updates the SymbolData object with current EOD price
upsec = self.holdsec[cf.Symbol]
upsec.update(cf.EndTime, cf.AdjustedPrice)
0
Derek Melchin
STAFF Pro
,
Hi Miguel,
Yes, that code snippet would be similiar.
The algorithm above doesn't trade because the insights need to be given a `magnitude`. To add a magnitude, we just need to replace
Additionally, there is currently a bug in the python implementation of the BlackLittermanOptimizationPortfolioConstructionModel so we need to comment out the line that reads
from Portfolio.BlackLittermanOptimizationPortfolioConstructionModel import BlackLittermanOptimizationPortfolioConstructionModel
By commenting out the line, the C# version of the model is used by default. We've created a GitHub Issue to have the problem with the python version of the model resolved. Subscribe to our progress here.
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.
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!