How to import 'negative_cvar' from PyPortfolioOpt?

Viewed 282

I need to use CVaR from PyPortfolioOpt but I encountered an error.

When I use this code :

from pypfopt.objective_functions import negative_cvar

I received the error:

Import Error:
cannot import name 'negative_cvar' from 'pypfopt.objective_functions' (C:\Users\Saad\anaconda3\lib\site-packages\pypfopt\objective_functions.py)
1 Answers

CVaR was available in PyPortfolioOpt until version 0.5.3, but has since been removed. The project maintainer wrote on GitHub on July 21, 2020:

Hi guys, thanks for the feedback. CVaR is something I want to add, but it's actually quite hard to do it properly.

See GitHub issue Plz add your CVaR feature back in #155.

Related