Modern Portfolio Theory

Investors are always on the lookout for the best investment opportunities. But what constitutes the best investment? A hedge fund might attempt to maximize profit, while a family office might want to minimize risk. The notion of best investment is not universal: each investor will find the compromise between risk and returns which suits them best.

Returns are easy to calculate. Say you own real estate shares. Your shares’ values go up 2%. Your returns on investment are 2% of the price you bought your shares at. Easy.

Risk is a little more elusive. Shares’ values fluctuate. How much they might go up or down is set by their volatility. Low risk shares are fairly constant (volatility near zero) while bitcoin shares fluctuate wildly (high volatility). Financial experts use risk and volatility interchangeably.

One way to discriminate between portfolios of investments is to compare the ratio of their forecast returns to their risks. This is known as the Sharpe ratio. In the following, when we say a portfolio is optimal, we will mean it has the highest Sharpe ratio.

Dynamic Problem

Our aim here is not to just tell investors where to park their money. We want to find the best sequence of buys and sells.

Imagine gold increases steadily in value, while umbrella and sun cream shares fluctuate with the weather. If you want to buy shares once, and sell after a month, then gold promises the highest returns.

But imagine you can accurately predict the weather. Then you can buy umbrellas when the weather deteriorates, and sell them to buy sun cream as it clears. By repeating this over the course of a month, you can actually make more money than your one time gold investment.

What makes this problem hard is that every buy or sell of shares has cost. This means that your optimal portfolio is some complex combination of gold, umbrella, and sun cream shares.

Types of Investments

We generally think of investment as a continuous problem. You can buy any amount of gold right?

Yes, but this isn’t true for all assets. Certain funds will only allow you to invest in large bundles. This is typically the case for exchange-traded funds (ETF) shares.

The problem we are trying to solve is an optimization problem. The variables we are optimizing — the amount of assets you own — are integer variables. The fact these are not continuous actually makes this problem much harder! Almost impossible to tackle with standard computers.

Time can also be discrete. In the example we studied, we only allowed transactions once a month. This is partly for convenience. It is also a way to avoid solutions with many short transactions, as these generally lead to highly fluctuating (i.e: risky!) portfolios.

Quantum Computing Results

There are two parts to portfolio optimization:

  1. An objective function, which tells us the portfolio’s Sharpe ratio.
  2. A solver, which will find the portfolio with the highest Sharpe ratio.

So far, we’ve mainly discussed the objective function. Now, on to the pièce de résistance: the solver.

Quantum Annealing

The solver treats the objective function like a black box. The solver gives the box a portfolio, the box returns its score. The aim for the solver is to repeat this process until the best portfolio is found. A good solver repeats the process as few times as possible.

Financial optimization problems are difficult because there is an almost infinite number of portfolios you could build. However not all of these are interesting to us: many portfolios have mediocre performance.

This is where quantum computing can really help.

One method we studied is called quantum annealing. It is a way of exploring only portfolios which are close to optimal, while ignoring the ones which are of no interest to us. This is analogous to the way water spreads over land, exploring all the valleys but none of the peaks. The process is described in detail in the article: can we use quantum computers to predict financial crashes?.

Tensor Networks

In some cases, a smart use of classical computers can perform just as well as a quantum computer.

While solving an optimization problem, your solver must jump from one solution to another. Quantum computers have an advantage here because, in the quantum world, there exist many more ways to go from one solution to the next. While these intermediate portfolios have no physical significance, they allow us to take shortcuts when exploring the space of possible portfolios. This means we can find more direct routes to the best portfolio.

However, not all of these new intermediates are important to find the shortcut. Tensor networks are a family of algorithms which simulate quantum mechanics on a classical computer, focusing only on the parts which are important.

Using these algorithms, we were able to build a solver which can compete — in some cases outperform! — our quantum solver.


Using quantum computers and tensor networks, we were able to find the best portfolio among 10382 candidates — many, many times more than the number of atoms in the Universe! This problem is completely out of reach of standard computers.

Our final portfolio boasted a staggering 68% return on investment over a 4 year period. Not bad!

Reducing the Problem Size

The largest quantum computer on Earth only has 5000 quantum bits (for reference, your laptop has billions of bits). How can you fit such a large problem on such a small chip?

Cluster your Data

One way to reduce the problem’s size is to group assets which move in similar ways.

Imagine you want to build a portfolio of different currencies. You would like to know when to buy, when to sell, and when to hold euros, dollars, Bitcoin, Ethereum, …

This problem’s difficulty grows exponentially with the number of currencies. And there are many currencies!

Imagine your core strategy is to make the most of the high liquidity of crypto and the relative stability of fiat. You can make this problem much simpler by realizing crypto currencies tend to move in similar ways. You can start by asking when you should buy crypto and when you should buy fiat. This will give you a rough description of the best portfolio composition.

The key intuition here is that all interesting portfolios follow this same rough description. Now you’ve identified the group of interesting portfolios, it’s much simpler to find the best one among them.

This is not only useful when resources are scarce. Even the best solvers struggle when the space of candidate portfolios is vast. Eliminating uninteresting portfolio options early reduces the risk of getting stuck with a suboptimal solution.

Fragment the Problem

Remember the umbrella example? You can’t just invest in the most profitable shares every day: the costs of buying and selling stocks will likely outweigh your profits.

You can expect, however, the best investment portfolio for one month to be some combination of each days’ near optimal investments. This is great because quantum processors are samplers. This means it’s easy for them to give us many good portfolios. All that’s left is to find the best way to combine these using classical computers (this is the easy bit).

This is an example of a hybrid algorithm. We fragmented our problem into two bits: 1) find several good investments for today; 2) combine them into a portfolio. We gave the quantum computer small, hard jobs. This means its small number of quantum bits wasn’t an issue. We brought all these results together using a classical computer. This makes the most of its huge computational resources, without being bogged down by its slow algorithms.

Take Home Messages

  1. The best investment portfolio maximizes profit while minimizing risk.
  2. This problem is out of reach of standard computers for problems of commercially relevant dimensions.
  3. Our quantum annealing solver only needs to search the space of near-optimal portfolios to find the best ones.
  4. Our tensor networks solver can simulate quantum systems of gigantic dimensions by focusing only on the important bits.
  5. We use hybrid quantum-classical algorithms to reduce the problem size. These fraction the problem, so only the hard parts are solved on the quantum computer.
  6. We were able to find the best investment portfolio in a space of 10382 candidates. This low risk portfolio gave a 68% return on investment over a 4 year period.

Want to know the technical details? Read the full paper here.

Article originally published on Multiverse Computing