# What is the risk factor on IBM's portfolio optimization notebook?

In the notebook "portfolio optimization" on IBM's platform the goal is to calculate the optimal stock selection using a classical and a quantum algorithm (VQE). A random portfolio is generated and then a risk factor is set.

What is the realistic value of this risk factor on the stock market and why do the authors select a risk factor of 0.5? How does it change the selection of the optimal portfolio?

• @Stefan Woerner: However, this is not a QUBO, i.e., it cannot be solved directly with VQE or QAOA. A common approach is to penalize the expected return by the weighted risk, which leads to the used objective μTx−qxTΣx and is a QUBO Why do first say it's not a QUBO and why after penalizing it becomes a QUBO? Commented Jun 23, 2022 at 18:09

The objective of the portfolio optimization problem is to trade off expected return ($$\mu^T x$$) with the risk taken ($$x^T \Sigma$$x). This could be achieved by introducing a constraint on the risk, e.g. $$x^T \Sigma x \leq R$$, for an acceptable risk level $$R$$ and then maximize the return under this constraint. However, this is not a QUBO, i.e., it cannot be solved directly with VQE or QAOA. A common approach is to penalize the expected return by the weighted risk, which leads to the used objective $$\mu^T x - q x^T \Sigma x$$, and is a QUBO.

The actual choice $$q=0.5$$ in the notebook is arbitrary and just for illustration. If you solve the problem for different $$q$$, you'll find different combinations of expected return and risk. E.g. for $$q=0$$ you consider a risk-neutral investor and the optimal solution would only maximize the expected return independent of the risk. If you increase $$q$$, the solution gets more and more risk-averse, ie., the return . Solving the problem for a reasonable set of $$q$$ leads to the so-called efficient frontier of risk and return, i.e., for every risk level, you'll get the maximum expected return that can be achieved.

In other words, $$q$$ is an implicit way to control the risk taken in the optimal solution of the resulting optimization problem. In practice, you are usually not interested in $$q$$ but in the risk and return, thus, you would have to do, e.g., a binary search over $$q$$ until you find a solution that does not exceed the acceptable level of risk $$R$$. You'd like to get as close to $$R$$ as possible while not exceeding it, since this should increase the expected return of the resulting portfolio.

A more general discussion of the portfolio optimization problem can be found here: https://en.wikipedia.org/wiki/Modern_portfolio_theory

• In other words, Markowitz portfolio optimization is done but on quantum computer. Commented Mar 21, 2020 at 16:53

You can find some information on another approach to portfolio optimization on quantum computer in this article: Quantum computational finance: quantum algorithm for portfolio optimization.

The authors deal with minimizing risk descibed by function $$w^T\Sigma w$$, where $$w$$ is vector of asset weights and $$\Sigma$$ is a covariance matrix. The minimization is subjected to requirement on expected return $$\mu$$: $$R^T w = \mu$$, where $$R$$ is vector of historical returns, and budget constraint $$\xi$$:$$P^T w = \xi$$ where $$P$$ is vector of asset prices.

Since constraints are equalities, Lagrange method can be employed. Moreover, optimized function is quadratic and constraints are linear, hence optimization is converted to solving of system of linear equations. Because of this, it is possible to empoloy HHL algorithm for solving system of linear equation on quantum computer.

Besides, one of authors of the article, Seth Lloyd designed also HHL algorithm.