robertmartin8 / PyPortfolioOpt

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

Conditional value-at-risk bug #5

Closed robertmartin8 closed 4 years ago

robertmartin8 commented 6 years ago

Currently, the CVaR optimisation using NoisyOpt is a little buggy. Because the weights aren't normalised by default, we must post-process them. However, this post-processing also means that the final weights don't respect the initial bounds. I'd appreciate any suggestions for a fix.

robertmartin8 commented 5 years ago

I have received a lot of feedback, and it is clear to me that my current implementation of CVaR needs to be greatly improved or removed. Right now, we basically have a negative_cvar_objective that computes the CVaR from 10,000 runs – this objective is then naively optimised via noisyopt.

I am aware that CVaR optimisation can be formulated as a linear programming problem, so I would like to rewrite the code to do that, and remove the noisyopt optimisation, which has proven to be quite unstable.

http://artax.karlin.mff.cuni.cz/~branm1am/download/VAO_HW1.pdf https://www.ise.ufl.edu/uryasev/files/2011/11/kro_CVaR.pdf http://www.diva-portal.org/smash/get/diva2:479147/FULLTEXT01.pdf

farbodbahari commented 4 years ago

Hi Robert, Are you still considering implementing the CVaR? I have used nonconvex_objective method from EfficientFrontier and then minimized CVaR (Negative CVaR) function via SLSQP solver. It appears to me it is properly working. I would be happy to send you my code and see it yourself if you'd like to.

robertmartin8 commented 4 years ago

Hi @farbodbahari,

I'd love to take a look if you don't mind sharing! That said, CVaR can be implemented as a convex problem, so realistically I won't be adding CVaR to the library until I've figured that out (or someone else PRs it).