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

ValueError: Workspace allocation error! #432

Closed YanaHeyv closed 2 years ago

YanaHeyv commented 2 years ago

Hey, thank you for the amazing package! I am having a workspace error. I have only 22 assets included and I have enough memory, so I do not see the problem? I used the program for other asset classes assets = ['NVO', 'TMO', 'BMY', 'ZTS', 'DXCM', 'ILMN', 'LZAGY', 'CHGCY', 'WXXWY', 'A', 'VRTX', 'BIIB', 'GMAB','CRL', 'VTRS', 'EXAS', 'NVCR', 'TEVA', 'NTLA', 'ZLAB', 'JAZZ', 'EVO', 'NBIX', 'CRSP', 'TLRY','PRGO', 'HCM', 'RGEDF', 'FATE', 'NEO'] yahoo_financials = YahooFinancials(assets) data = yahoo_financials.get_historical_price_data(start_date='2020-01-01', end_date='2020-12-31', time_interval='daily') df = pd.DataFrame({ a: {x['formatted_date']: x['adjclose'] for x in data[a]['prices']} for a in assets}) df.fillna(method='ffill',inplace=True) image

Kind regards, Yana

robertmartin8 commented 2 years ago

Can you please check your mu and S to make sure there are no NaNs, or infinities? This seems to be the same as #440

YanaHeyv commented 2 years ago

Thank you very much for solving my problem! This was the case indeed.