MATLAB: How to limit the number of assets selected in working with Portfolio objects

assetsfinanceFinancial Toolboxoptimizationportfolio

I am working with Portfolio objects, and I would like to limit the number of assets selected to just the best 50.
How can I do this?

Best Answer

You will need to manually sort your assets. You can then select the best 50, or however many you would like, using one of the following methods:
1) If you want a long portfolio, you can sort the assets based on the expected returns and pick the 50 highest.
2) If you want to short portfolio then you can sort and select the 50 assets with the highest negative returns.
3) If you want to select the top 50 assets that deliver the best value for a custom criteria, you can use the Optimization Toolbox directly to create a model with constraint to the number of assets in the portfolio. There is an example you can follow in the documentation:
Related Question