robertmartin8 / PyPortfolioOpt

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

Constraints on absolute sum of weights #461

Closed lcykrbn closed 1 year ago

lcykrbn commented 2 years ago

Hello, thank you very much for this great tool!

I have a question. I allowed short selling for individual asset weights in my code and I am trying to put a constraint on the "sum of absolute values" of assets. for example, if the optimizer assigned -20% to an asset, the sum of other assets should be 80%, not 120%. How can I add such a constraint?

Thanks a lot! Olcay.

lcykrbn commented 2 years ago

Hello again, I also have another related question. I want the sum of all assets that have positive weight to sum up to 1, and assets with negative weights should be kept apart from this summation. This is becaues I consider all short positions as leverage.

robertmartin8 commented 1 year ago

This is a difficult problem: see #133 for ideas