robertmartin8 / PyPortfolioOpt

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

Per Asset Max value (p * weight ) constraint in long short portfolio #503

Open AnkitAggarwalAlphagrep opened 1 year ago

AnkitAggarwalAlphagrep commented 1 year ago

Hi

I'm creating a long short market neutral portfolio using following function.

ef.max_quadratic_utility(market_neutral=True)

and I have the net exposure constraint also.

def create_gross_exposure_constraint(w):
    return cp.norm1(w)  <= 2

I'm trying to add net asset value constraints as explained below:

  1. I want the net exposure < 1 Million USD (this number can be changed). What does this mean is If i do discrete allocation using above weight: abs(Position_of_Asset * Price_of_Asset) < 1 Million USD.

@robertmartin8 Please do let me know how can I do that.

Thanks Ankit Aggarwal