Code Monkey home page Code Monkey logo

optimization-python's Issues

Error trying to maximize Sharpe

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

df.set_value is not supported

Page: Portfolio_optimization.ipynb

Please change this line:
mr.set_value(date,s,ret)

To this:
mr.at[date, s] = ret

Expansion of Data using USDA and Kendall Datasets

Issue in prob.solve() --cell 30

I am trying to reimplement code in your notebooks. I get the error "PulpSolverError: Pulp: Error while executing /usr/local/lib/python3.6/dist-packages/pulp/solverdir/cbc/linux/64/cbc"
I tried checking the installations which seems to be fine. Can you suggest what might be the issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.