Skip to content

Error trying to maximize Sharpe #3

@JVA89

Description

@JVA89

Hello,

I am trying to maximize Sharpe with this code adding this line:

sharpe = ret / risk

just before the problem definition and changing it by:

prob = Problem(Maximize(sharpe), [sum(x)==1, x >= 0])

obtaining this problem;

DCPError: Problem does not follow DCP rules. Specifically:
The objective is not DCP. Its following subexpressions are not:
[-2.16695988e-03 -9.60588203e-04 -6.80243265e-04 -9.10794378e-04
2.84821499e-04 -1.84951106e-03 -2.41240531e-03 -2.39710967e-03
-1.59690065e-03 -1.96844915e-03 2.78261359e-03 1.32043210e-04
3.10924999e-05 -2.04406783e-03 -3.59892133e-04 7.34013179e-04
1.08369348e-03 -2.05024607e-03 1.14489241e-03 -4.87174427e-04
-9.55131222e-05 -1.19424145e-03 -2.19036230e-03 -1.10589192e-03
-2.40868247e-03 -1.45145088e-03 -3.10006405e-04 -1.55078960e-03
-2.62811048e-03 -2.54809462e-03 -6.85525210e-05 -1.73200801e-03
-2.35653381e-03 -1.32429376e-04] * var446 / QuadForm(var446, [[0.00092668 0.00036417 0.00045662 ... 0.0002323 0.00041562 0.00010376]
[0.00036417 0.00046147 0.00021776 ... 0.00024083 0.00027291 0.0001139 ]
[0.00045662 0.00021776 0.00077415 ... 0.00028546 0.00028192 0.00015766]
...
[0.0002323 0.00024083 0.00028546 ... 0.00051062 0.00027009 0.00016667]
[0.00041562 0.00027291 0.00028192 ... 0.00027009 0.00059854 0.00011856]
[0.00010376 0.0001139 0.00015766 ... 0.00016667 0.00011856 0.00044083]])

Do you have any idea to solve it?

Thanks in advance and regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions