robertmartin8 / PyPortfolioOpt

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
https://pyportfolioopt.readthedocs.io/
MIT License
4.28k stars 930 forks source link

5 Assets out of all Assets #424

Closed AdamTheDestroyer closed 2 years ago

AdamTheDestroyer commented 2 years ago

How can i get the best 5 Stocks with their weights out of all Stocks i have?

There is a new Bank Product, which i want to use for my retirement preperation.

-Once every month i can invest in 5 ETFs without buying costs. -Once every month i can reorganize all the money i have invested before and invest it to other ETFs (also without costs).

Therefore i trying to optimize a Portfolio with all available ETF Stocks and take just 5 of it for my reorganization.

Is there a way i can do this?

Greetings Adam

robertmartin8 commented 2 years ago

Does this mean that every month you want to optimise a portfolio s.t. the constraint that num assets = 5?

AdamTheDestroyer commented 2 years ago

Yes you are right :-). For example, there are 200 possible Etfs in which I could invest my money.

But I am just allowed to choose 5 of them once every month.

I am thinking about something like, optimize 200 etfs, take the highest 5 weights, and optimize them again?

Greetings Adam

robertmartin8 commented 2 years ago

That seems like a reasonable heuristic. Alternatively, you could try a constraint on the number of assets (discussed in the FAQs) and in several of the issues.

Best of luck!

AdamTheDestroyer commented 2 years ago

Thank you!