qiskit-optimization
qiskit-optimization copied to clipboard
How to return weights instead of binary numbers for PortfolioOptimizer
Hello,
I understand that the PortfolioOptimizer in Qiskit Finance/Optimization can solve quadratic programs such as minimum variance. Following the Qiskit Optimization tutorial. However, it returns binary integers on whether or not to select a stock. How do I change the class code to return a weight that each stock should hold within the portfolio?
https://qiskit.org/documentation/finance/tutorials/01_portfolio_optimization.html
Take a look at this, see if its what you need, which was done some time back Qiskit/qiskit-finance#57 - there is a unit test added which shows its use etc.
So to my understanding, we can find integer returns by using PortfolioOptimization.bounds. However, this becomes very costly? Is there a way to return float weights? Or am I misunderstanding something.
The portfolio optimization used to have only a buy or not result for each stock, and was changed to support integer amounts. This is the functionality it has. Now the portfolio optimization code relies on Qiskit Optimization to solve the problem it defines, through the model it creates. You can potentially look at using Qiskit Optimization more directly to define a problem/model that more fits your needs and have it solve it.