Hybrid quantum investment optimization with minimal holding period (2024)

The field of quantum computing is living an unprecedented expansion due to recent experimental advances. Quantum technologies as a whole1,2,3,4,5,6,7,8 are being benefited from recent results both on quantum computer implementations9,10,11,12,13,14,15 as well as on quantum communications16,17,18,19,20,21,22. Due to this, people have started to think seriously about industrial applications of quantum computers4. Among the different verticals, finance is among the most promising ones, given the ubiquitousness of intractable mathematical problems. For a detailed description of applications of quantum computing in finance, see Ref.23. Among these applications, one of the most prominent is quantum optimization. There are many important optimization problems in finance which can be solved more efficiently using quantum computing. See Refs.24,25,26,27,28 for some examples. In this setting, the most paradigmatic optimization problem in finance is that of portfolio optimization, both in its static and dynamic versions.

Our aim in this work is to solve the dynamic portfolio optimization problem. An issue that investors often face is that short term investments tend to be taxed much higher than long term investments. It is common for investors to impose a minimal holding period, preventing any purchased asset from being sold before a predetermined period of time. We build upon the work from Ref.29, and demonstrate an efficient post-selection protocol to impose the minimal holding constraint. Similarly to Ref.29, we further impose that investors must invest in integer bundles, as is typically the case for exchange-traded funds (ETF) shares.

Financial model

Our aim is to find the best investment trajectory for an investor, given a level of risk that they want to take. According to Modern Portfolio Theory, the optimal investment at a defined level of risk is the one which maximizes profit30. The portfolio’s risk—or volatility—is computed from the assets’ covariance matrix. The ratio of returns to risk is the Sharpe ratio, which is our metric for comparing investments. These are defined mathematically in what follows.

Let us define \({\omega }_{tn}\), the fraction of the total budget invested in asset n at time t. The optimal holding trajectory \({\omega }_{tn}\) minimizes the Modern Portfolio Theory cost function:

$$\begin{aligned} H_0 = \sum _{t} -\mu _t^T {\omega }_t + \frac{\gamma }{2} {\omega }_t^T \Sigma _t {\omega }_t. \end{aligned}$$

(1)

Here, \(\mu _t\) is the vector of the logarithmic returns at time t and \(\Sigma _t\) is the covariance matrix. The risk aversion \(\gamma \) controls the portfolios penalty for risk. This determines the amount of risk an investor is willing to take. The forecasted returns and covariance matrices can be deduced from the stocks’ prices. This is detailed, for instance, in Ref.29. Following this notation, the Sharpe ratio is given by

$$\begin{aligned} \mathrm{Sharpe} \equiv \frac{\sum _{t} \mu _t^T {\omega }_t}{\sqrt{ \sum _t {\omega }_t^T \Sigma _t {\omega }_t}}, \end{aligned}$$

(2)

which, as we said, is nothing but the ration between the total return (numerator) and volatility (denominator).

At any point in time, we would like the entire available budget to be invested. This constrains the holdings \({\omega }_t\) to be normalized at any time t. We enforced this by penalizing portfolios which did not respect this constraint. The cost function we optimized is therefore

$$\begin{aligned} H = H_0 + \sum _t \rho \left( \sum _n {\omega }_{tn} - 1 \right) ^2, \end{aligned}$$

(3)

where the Lagrange multiplier \(\rho \) is an hyperparameter of the model. Note also that Eq. (3) can be written as:

$$\begin{aligned} H = \sum _t h_t, \end{aligned}$$

(4)

for some \(h_t, t \in \{0, N_t\}\). This means that the optimal investment at time t is independent of our investment history, as long as no more constraints are included that correlate trading times among each other. In such a situation it is therefore sufficient to minimize \(h_t\) at every time t to compute the optimal holdings \({\omega }_t\). This is a good approximation, for instance, for the trading investment funds of an everyday investor, for which transaction costs and market impact may be negligible.

We assume shares can only be sold in large bundles. These constraints imply that our objective variables—the instantaneous asset holdings \({\omega }_{tn}\)—are integer variables. At any trading time, we can encode the qubit values to our qubits using a binary encoding:

$$\begin{aligned} {\omega }_{n} = \frac{1}{K} \sum _{q=0}^{N_q-1} 2^q x_{n, q}, \end{aligned}$$

(5)

where \(x_{n, q} \in \{0,1\}\) is the readout value of the \(q\text {th}\) qubit assigned to institution n, and K is the total investment.

This encoding has several consequences. First, the holdings are always bound by: \({\omega }_{tn} \in [0, 1]\). Since \({\omega }_{tn} \ge 0\), investors are not given the option to sell short securities. Allowing short-selling could be an interesting extension for this problem. Second, this encoding allows investors to split their total investment in a maximum of K bundles. This discretization is part of the reason why this problem is so hard to solve on classical computers29. From a practical perspective, using the bit variables the cost function can then be written as

$$\begin{aligned} H = x^T Q x, \end{aligned}$$

(6)

with x a vector of bit variables, and Q a matrix of real numbers. In the language of combinatorial optimization, this is a quadratic unconstrained binary optimization (QUBO) problem, and is the natural input for the D-Wave quantum annealer.

In Eq. (5), we have introduced the bit depth \(N_q\), the number of qubits which encode the \(n\text {th}\) asset holdings. Typically, we would choose \(N_q\) such that \(2^{N_q} -1 \ge K\). This choice allows the investor to invest their entire budget into a single asset. We may, however, want to impose a diversification constraint. Typically, large financial institutions are not allowed to invest more than \(5\%\) of their total budget in any single asset. Choosing \(N_q\) such that \(2^{N_q} -1 = 0.05 K\) naturally implements this diversification constraint.

Minimum holding period

The holding period is the amount of time which elapses between an investment’s purchase and its sale (or sale of a security). Because long-term gains are taxed more favourably than short-term gains, it is common to demand that investments meet a minimum holding period. In this study, we imposed a minimal holding period of 7 days, which is a natural timeframe for some realistic banking products.

Here we imposed this constraint by post-selecting investment trajectories which respected this condition. The number of possible trajectories grows exponentially \(O\left( N_a^{K \times N_t}\right) \). It is therefore computationally prohibitive to successively consider each trajectory and verify if they meet the minimal 7 day holding period.

Instead, we build the investment trajectory iteratively, following the flow chart presented Fig. 1. At every time t, we choose holdings \({\omega }_\text {guess}\) for that instant. We compute them by sampling at each time t the low-energy subspace of \(h_t\) in Eq. (4) using, in our case, the D-Wave machine. the fact that the problem can be decoupled into separate times t allows us to tackle more assets at every given time with the quantum annealer. The sampled instantaneous portfolios are considered in order of decreasing Sharpe ratio. As customary in finance, a large Sharpe ratio is an indicator of a good-quality portfolio, since it implies that the return is large for the risk being assumed. We note, however, that other figures of merit could be used, such as the returns (the larger the better), or the volatility (the lower the better). In our case, though we choose to work with the Sharpe ratio because of the afore-mentioned reasons. We only retain candidates which fulfil the minimum holding constraint.

Flow chart detailing the post-selection algorithm used to efficiently eliminate trajectories which do not meet the minimum 7 day holding period.

Full size image

By following iteratively, the algorithm implements a tree-like selection and efficiently rules out trajectories which do not meet the minimal 7-day holding period, as is illustrated in Fig. 2. Note that at any time t, there always exists at least one solution which meets the minimal 7-day holding period: the solution \({\omega }_t = {\omega }_{t-1}\).

Candidate investment trajectories are efficiently ruled out by the post-selection algorithm. Node \({\omega }^{(i)}_t\) represents the \(i\text {th}\) candidate holdings at time t. Green nodes meet the minimum holding period, while grey nodes do not. When the constraint is not met at time t, the node is crossed out and all resulting investment trajectories are eliminated.

Full size image

Alternatively, we could include this constraint by penalizing in Eq. (3) trajectories which do not meet the minimum holding period. The corresponding penalty term would then correlate different time steps between each other, such that the cost function would not have the separable form of Eq. (4). In such a case, the problem would become even more computationally intractable, and a global optimization strategy over all possible trading times would be necessary from the very beginning. It is therefore remarkable that our simple approach, based on quantum sampling and post-selection, produces such high-quality portfolios in an extremely efficient manner.

Dimensional reduction

The number of objective variables in this problem is proportional to the number of assets, multiplied by the bit depth. For problems of commercial value, this can be very large. Because current quantum resources in Noisy Intermediate Scale Quantum (NISQ) devices are limited, a good option is to apply dimensional reduction techniques. Reducing the space of solutions searched also makes it easier for the optimization routine to converge to the global minimum.

In Ref.29, authors described a method to cluster assets based on their time series’ similarity. In the following, we apply this method, and discard all except for the best asset in each cluster (based on its historical Sharp ratio). The dimensional reduction strategy follows from applying first a Hodrick-Prescott smoothing, to extract data trends, and then computing the euclidean distance between different pairs of trends of assets. Thanks to this, we can perform a clustering of the assets into clusters of assets of similar behavior. This dimensional reduction strategy also allows us to significantly lower the portfolio’s risk, by diversifying our investment among maximally uncorrelated assets. Moreover, our target investors typically select their investment risk category. To meet this risk requirement, we performed a pre-selection among available assets. We computed each assets’ historical volatility, and discarded any asset which significantly exceeded the agreed risk level. This allows us to construct portfolios for investors with different risk profiles: high-risk, medium-risk, low-risk, and so forth.

In practice, we determined the optimal number of clusters \(N_c\) by studying each clusters’ variance. In the studied data, we found that the mean clusters’ variance decreased exponentially with the number of clusters. For \(N_c>7\), the clusters’ variance did not significantly decrease, indicating that 7 clusters capture almost all of the system’s variations. We therefore set \(N_c=7\) in our calculations.

As a seasoned expert in the field of quantum computing and quantum technologies, I bring a wealth of knowledge and practical experience to shed light on the concepts discussed in the provided article. My expertise extends across various aspects of quantum computing, including quantum computer implementations, quantum communications, and their applications in finance.

First and foremost, the article discusses the unprecedented expansion of quantum computing, attributing it to recent experimental advances. Quantum technologies, encompassing both quantum computer implementations and quantum communications, are highlighted as benefiting from these advancements. This aligns with the current trends in quantum technology research and development, indicating a rapid growth in the capabilities of quantum systems.

The focus then shifts to the potential industrial applications of quantum computers, with finance being identified as one of the most promising verticals. The ubiquity of intractable mathematical problems in finance makes it an ideal candidate for leveraging the computational advantages offered by quantum computing.

Specifically, the article delves into quantum optimization as a prominent application in finance. Quantum optimization is showcased as a solution to efficiently address critical optimization problems prevalent in the financial domain. Notably, portfolio optimization is identified as a paradigmatic optimization problem in finance, encompassing both static and dynamic versions.

The main objective presented in the article is to solve the dynamic portfolio optimization problem, considering factors such as taxation on short-term investments and the imposition of a minimal holding period. The authors build upon previous work and propose an efficient post-selection protocol to enforce the minimal holding constraint, incorporating the use of quantum technologies.

The financial model introduced in the article aligns with Modern Portfolio Theory, where the optimal investment trajectory is sought to maximize profit while considering the level of risk an investor is willing to take. The Sharpe ratio, a key metric in finance, is defined and utilized to evaluate investments based on the ratio of returns to risk.

The optimization problem is formulated mathematically, introducing a cost function that is optimized to determine the optimal asset holdings over time. The article further incorporates the constraint that investors must invest in integer bundles, mirroring the characteristics of exchange-traded funds (ETF) shares.

Quantum encoding is introduced as a means to represent the integer asset holdings in a quantum computing context. The binary encoding of qubit values is employed, leading to a quadratic unconstrained binary optimization (QUBO) problem suitable for quantum annealers, such as the D-Wave machine.

The article then addresses the challenge of a minimum holding period, a common requirement in finance. A post-selection algorithm is proposed to efficiently eliminate trajectories that do not meet the minimum holding period, employing quantum sampling and iterative selection based on the Sharpe ratio.

To address the computational complexity arising from a large number of objective variables, the article suggests dimensional reduction techniques. The authors apply clustering based on asset time series similarity, reducing the solution space and improving the efficiency of the optimization routine. This dimensional reduction strategy also aids in lowering portfolio risk by diversifying investments among maximally uncorrelated assets.

In conclusion, the presented article provides a comprehensive exploration of quantum computing applications in finance, focusing on dynamic portfolio optimization. The integration of quantum technologies, optimization algorithms, and dimensional reduction techniques showcases the depth of expertise and innovation in the field.

Hybrid quantum investment optimization with minimal holding period (2024)
Top Articles
Latest Posts
Article information

Author: Merrill Bechtelar CPA

Last Updated:

Views: 6282

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Merrill Bechtelar CPA

Birthday: 1996-05-19

Address: Apt. 114 873 White Lodge, Libbyfurt, CA 93006

Phone: +5983010455207

Job: Legacy Representative

Hobby: Blacksmithing, Urban exploration, Sudoku, Slacklining, Creative writing, Community, Letterboxing

Introduction: My name is Merrill Bechtelar CPA, I am a clean, agreeable, glorious, magnificent, witty, enchanting, comfortable person who loves writing and wants to share my knowledge and understanding with you.