qfd
qfd

Reputation: 788

mixed integer quadratic programming in python

I was wondering if someone could give me some guidance in setting up my objective.

I am trying to minimise variance in python with some cardinality constraints on the number of assets in my portfolio. I am not sure what package would help me do this. And if there was a working example for the above.

Upvotes: 0

Views: 5106

Answers (2)

Erwin Kalvelagen
Erwin Kalvelagen

Reputation: 16724

Below is a MIQP model that illustrates how we can model a portfolio problem with the number assets limited to be between minAssets and maxAssets. If an asset is in the portfolio, furthermore its fraction is limited to be between fmin and fmax.

enter image description here

In this link you can also see how you can try to solve this problem with just a series of linear MIP problems.

MIQP solvers are readily available: CVXPY/ECOS_BB, Cplex, and Gurobi are a few examples. These are all callable from Python. A simple portfolio QP model would be a good starting point (no doubt such a model is available in the examples for any of these solvers).

Upvotes: 2

Razmik Melikbekyan
Razmik Melikbekyan

Reputation: 758

You may have a look at some links, which are about python package CVXOPT:

https://cvxopt.org/examples/book/portfolio.html

https://scaron.info/blog/quadratic-programming-in-python.html

Upvotes: 0

Related Questions