Hello,
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.
Shile Wen
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
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.
Miguel Palanca
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
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.
Derek Melchin
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
with
Additionally, there is currently a bug in the python implementation of the BlackLittermanOptimizationPortfolioConstructionModel so we need to comment out the line that reads
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
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.
Derek Melchin
Hi Mitch,
See the attached backtest for reference.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Mitch Christow
Hi Derek,
Thank you very much for posting the code. I am trying to use this in a local LEAN-CLI implementation and I am not getting the import statement right since VS Code cannot find the definition for CryptoCoarseFundamental.Universe I tried locating the API documentation that would tell me which module I would need to import, but have not been able to find it. Could you let me know what the right import statement would be to make this work? Thanks for your help.
Cheers,Mitch
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.
Mitch Christow
Quick follow up. It looks like CryptoCoarseFundamentalUniverse is not available in lean. I am running lean and the lean-cli on my local windows machine (lean version 1.0.124).
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.
Derek Melchin
Hi Mitch,
Try
We updated the dataset listing to include this information.
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
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.
Mitch Christow
Hi Derek,
Thanks for the response. I had tried that approach and unfortunately I still get the same error. I wonder if it has something to do with the version of the lean engine that I am running locally? I checked and the lean version number is 1.0.124, I tried updating, but that seems to be the latest version. Do you have any additional suggestions what I could try?
Cheers,
Mitch
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.
Louis Szeto
Hi Mitch
We're reducing the size of LEAN and making framework/brokerages models as plugin. Thus, the CryptoCoarseFundamentalUniverse is in a separate repo. You may try to download the below files in the repo and put them in
/Lean/Common/Data/UniverseSelection/
directory in your local LEAN:Best
Louis
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.
Jacek Trociński INVESTOR
Louis Szeto Volume, as an indicator, can be particularly deceptive when filtering a universe of cryptocurrencies.
There is evidence of rampant wash trading on centralized exchanges that artificially inflate volume metrics:
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3530220
Market capitalization is a better indicator for filtering and universe selection.
Will QuantConnect offer supply or market cap data for cryptocurrencies in the future?
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.
Derek Melchin
Hi Jacek,
We are in the process of adding a Crypto market cap dataset.
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.
Jacek Trociński INVESTOR
Derek Melchin Awesome, looking forward to that!
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.
Mitch Christow
Hi Louis,
Haven't had time over the holidays to try this but now I got back to working on the local implementation of a crypto algorithm. As you prescribed I tried to copy the two cs files into the `/Lean/Common/Data/UniverseSelection/` directory. However I only found the UniverseSelection directory in my ‘\anaconda3\envs\qc\Lib\site-packages\QuantConnect\Data\UniverseSelection’ and inside of that folder was a __pycache__ folder and two __init__.py files.
I can only assume that since I am using the Lean CLI, that all the actual Lean files are located inside the lean docker image, which I cannot modify. If my explanation is correct, then is there another way to handle crypto universe selection on a local lean CLI installation? Thanks again for all your help.
Cheers,
Mitch
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.
Timothy
Hello all.
How would one go about changing the frequency of the algorithm to work hourly? I would like the solution to work with a dynamic universe. I have tried a few things and i'm stuck for ideas.
Kind Regards,
Tim
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.
Santa24
I think universe selection per se is only on daily basis and triggered once per day, same as the equities
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.
Louis Szeto
Hi Timothy and Santa 24
Thank you for the answer. It is correct that only daily filtering is available for now.
Best
Louis
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.
Papa Bear
any update on the market cap data set?
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.
Louis Szeto
Hi Papa Bear
Please refer to CoinGecko Market Cap dataset.
Best
Louis
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!