Quantum Annealing Algorithm for Expected Shortfall based Dynamic Asset Allocation
Samudra Dasgupta Arnab Banerjee


Quantum Annealing for Expected Shortfall



Purdue University

S. Dasgupta and A. Banerjee
Samudra Dasgupta and Arnab Banerjee
Quantum Annealing Algorithm for Expected Shortfall based Dynamic Asset Allocation
Quantum Annealing Algorithm for Expected Shortfall based Dynamic Asset Allocation
    Samudra Dasgupta and Arnab Banerjee
    December 30, 2023
=================================================================================

 

The 2008 mortgage crisis is an example of an extreme event. Extreme value theory tries to estimate such tail risks. Modern finance practitioners prefer Expected Shortfall based risk metrics (which capture tail risk) over traditional approaches like volatility or even Value-at-Risk. This paper provides a quantum annealing algorithm in QUBO form for a dynamic asset allocation problem using expected shortfall constraint. It was motivated by the need to refine the current quantum algorithms for Markowitz type problems which are academically interesting but not useful for practitioners. The algorithm is dynamic and the risk target emerges naturally from the market volatility. Moreover, it avoids complicated statistics like generalized pareto distribution. It translates the problem into qubit form suitable for implementation by a quantum annealer like D-Wave. Such QUBO algorithms are expected to be solved faster using quantum annealing systems than any classical algorithm using classical computer (but yet to be demonstrated at scale).







§ INTRODUCTION

The 2008 mortgage crisis is an example of an extreme event - also called tail risk. Such crises happen more frequently than what a Gaussian distribution will suggest. Statisticians call this evidence for a fat left tail.

The discipline of extreme value theory tries to estimate such tail risks. Good risk managers realize that risk management should be geared towards extreme events. The day-to-day volatility management is best left to sales departments responsible for profitable growth. In fact well managed institutions excel in maintaining the delicate balance between profitable growth and risk controls (especially on human dimensions). The implication here is that traditional approaches for risk measurement like volatility or even Value-at-Risk are no longer considered good guiding metrics by the Risk division in financial institutions. Instead finance managers increasingly prefer using the expected loss when the  loss has already exceeded a threshold. This is known as Expected Shortfall in literature. To understand why Expected Shortfall is preferred over Value-at-Risk or volatility as risk measure, we direct the reader to the excellent book by McNeil et al. <cit.>. Further discussions on this topic can be found in <cit.>, <cit.> and <cit.>.

Sparse data availablility for tail risks makes estimation of parameters (such as for generalized pareto distribution) in Extreme Value Theory  difficult. The Monte Carlo overhead also becomes significant. Thus a Markowitz type optimization problem that uses Expected Shortfall as the risk measure quickly becomes extremely computationally intensive.

Such a problem is ripe for attack by Quantum Computing. Quantum Annealing and/or universal circuits, through the magic of quantum superposition and entanglement, are anticipated to solve such problems in exponentially less time. QUBO (Quadratic Unconstrained Binary Optimization) problems in particular can be solved faster using quantum annealing systems than any classical algorithm using classical computers.

More generally, much work is going on in leveraging quantum computation for machine learning. See <cit.> for a discussion on the quantum advantage in data science. <cit.> provides an excellent review of the state of the art in quantum computing for finance while <cit.> provides an easy to follow introduction of quantum computing for data scientists. In risk management domain, <cit.> provides a quantum amplitude algorithm for measuring Value-at-Risk and Conditional Value-at-Risk. Their calculations prove the theoretical superiority (asymptotically) of quantum algorithms to classical monte carlo approaches.

This paper provides the quantum annealing algorithm in QUBO (Quadratic Unconstrained Binary Optimization) form for a dynamic asset allocation problem using expected shortfall constraint. It was motivated by the excellent work done in <cit.> which is one of the first applications of D-wave[See <cit.>, <cit.>, <cit.> and  <cit.> for some of the latest implementation examples using the D-Wave machine] based quantum optimizer to a Markowitz setting. However the framing of the problem (e.g. fixed investments associated with fixed assets) made the problem academically interesting but not useful for modern finance practitioners.
 
Section <ref> states the problem statement, Section <ref> develops the algorithm step-by-step, Section <ref> lays out potential avenues for future work, and Section <ref> concludes by summarizing the main contributions of this paper. Given the large number of symbols floating around in the paper, we have added an appendix for the reader's ease (comprising definitions of the symbols).



§ PROBLEM STATEMENT

Consider a fund manager who has been asked to invest $1 Mn in the public financial market. She can select from any publicly traded instrument and can change the asset allocation periodically. However, the following four guidelines need to be followed:


  * Performance will be tied to the absolute return of the portfolio

  * Total risk assumed should be below a threshold

  * Risk threshold should adjust dynamically[In other words, take lower risk in volatile markets and higher risk in stable times]

  * No shorting[This means one cannot sell an asset one does not own by temporarily borrowing it from someone and then buying it back again from the market later to return the stock borrowed. The risk of not being able to close a short is often too high during crisis.]


The options for the risk measure can be:


  * Volatility (σ): the standard deviation of portfolio return 

  * Value-at-Risk (VaR_α): the VaR at confidence level α is the smallest number l such that the probability that the loss exceeds l is no larger than (1-α)

  * Expected Shortfall (ES_α): the expected loss given the loss has exceeded VaR_α


Both σ and VaR_α are unable to capture the tail characterstics needed for extreme value based risk measurement. Modern finance practitioners prefer ES_α which is what we use in this paper. The two questions we need to answer are:


  * What is the optimal asset allocation at any instant?

  * How should the weighting change with time?




§ QUANTUM ANNEALING FOR DYNAMIC ASSET ALLOCATION




 §.§ Input Space

Here we discuss the input space in more details including some specification choices.



  * Asset Universe Composition and the returns matrix R_NT

The main input needed is the matrix of historical asset returns . The matrix has N rows where N denotes the number of assets and T columns where T is the length of the time-series. It is preferable to use ETFs (instead of individual stocks, bonds etc.) to get more diversification benefits with less transaction costs. The N asset ETFs should be spread across asset classes. A good asset universe will include:


  * G20 Currency ETFs

  * Commodity ETFs such as precious metals ETF, agricultural product ETFs (e.g. wheat, cash crops), Utility metals ETF (e.g. copper, aluminium)

  * Real estate ETFs

  * Domestic Stocks ETF (small cap, mid cap, large cap)

  * International Stocks ETF (preferably global market cap weighted ex-US)

  * Bond ETFs, T-bill ETFs


  * The vector of asset means R is the mean of 𝐑_𝐍𝐓 over time dimension. It has N elements corresponding to N assets. Each element of the vector is called μ_i. 

  * The frequency of returns should be daily or higher.

  * The historical time-period covered by the matrix is critical as it must encompass at least two crisis periods e.g. 2002 and 2008 (hence don't choose ETFs which do not have such history).

  * Probability level α (manager choice) determines the probability level for Expected Shortfall calculation. We use 1%.

  * Expected Shortfall target at time T, ES_T. It serves as the dynamic risk threshold. It increases in magnitude (i.e. risk assumed increases) when market volatility is low and decreases in magnitude (i.e. risk assumed decreases) when market volatility is high. It is quantitatively discussed in the Parameter Initialization section.

  * Variance-covariance matrix Σ = [σ_ij]: It is calculated as:

    σ_ij= (r_i-μ_i)·(r_j-μ_j)/T-1

where r_i and r_j are the asset return vectors (with T elements) for the ith and jth asset respectively. Similarly, μ_i = ∑_k=1^Tr_i,k/T and μ_j = ∑_k=1^Tr_j,k/T are the asset return means for the ith and jth asset respectively.

  * Precision parameter, L (manager choice): This determines the discretization granularity of the weights vector w. It represents the number of qubits used to represent weight w_i.

  * Convergence criterion, η% (manager choice): This determines the convergence criterion for the algorithm.

    | 1-ES_i/ES_T| ≤η%

This is needed because the Expected Shortfall form used is an approximation to enable QUBO formulation of the problem for quantum annealing.




 §.§ Output Space
 
The output will be a vector of qubits δ of length Np where N is the number of asset ETFs and p=log_2L. Here L is the precision parameter for weights vector w discussed in the previous subsection <ref>. The weight w_i of asset i is given by:

    w_i=∑_j=1^p2^-jδ_ij


Note that δ_ij can be only 0 or 1. Moreover, due to the finite precision effects, w_i ∈ [0,1) i.e. it can never equal the upper bound 1.



 §.§ Objective Function with Constraints

The essential problem is to maximize w·R, where w is the asset weights vector and R is the asset means vector, subject to the following constraints[Equivalently minimize (-w·R)]:


  * 100% of the amount available is desired to be invested i.e.

    ∑ w_i = 1

However, due to finite precision effects described in <ref>, the allowed values of w_i are quantized. Thus the best we can do is to push ∑ w_i to as close to 1 as permitted. The leftover weight 1-∑ w_i, if positive, is assumed to sit in cash and not invested. If negative, that small amount is assumed to be borrowed[This will incur interest expenses but we have ignored that in this iteration].


  * Consciously limit risk taking i.e.

    |ES| ≤ |ES_T|



  * No short selling i.e.

    w_i ≥ 0

This is automatically implied by the form for (<ref>) and hence does not need to be explicitly modeled. 



However this framing is not yet QUBO (remember QUBO stands for quadratic unconstrained binary optimization) and hence not suitable for Ising Hamiltonian formulation required by quantum annealers.



 §.§ Quantum Annealing Algorithm

The core of the algorithm is to solve the following optimization problem:

    min_w     1/2w^T C_t w
    s.t.     μ_t^Tw = p 
       ∑w = 1,  w≥0.



The algorithm proceeds as follows:


0.5cm

Variables:

    
  * μ_t: the mean return vector of time window t
    
  * σ_spy_t: the volatility of SPY's returns during time window t
    
  * C_t: the co-variance matrix of the sample returns during time window t
    
  * α: risk level parameter
    
  * EST_t: the target expected shortfall at time window t
    
  * ESt: the expected shortfall during the optimization process at time window t
    
  * ϵ: error tolerance parameter
    
  * δ: profit adjustment scale, could change dynamically during runs






























































































§ FUTURE WORK

Quantum Computing has a lot of potential applications in financial risk management. There is a plethora of NP hard optimization problems in a wide varierty of sub-fields such as liquidity risk management, credit risk management, operational risk management etc.

The immediate domains of future work for the problem we have discussed in this paper are:


  * Implement the same problem in a universal circuit model quantum computer.

  * Compare the performance of D-Wave vs IBM-Q for time taken, solution quality, robustness to noise and ability to scale.

  * Use base-N (N>2) encoding to reduce the number of qubits required. For this we need to use physical quantum systems that can have more than two eigen states for measurement.

  * On the purely financial optimization front, the model can be made more realistic by adding liquidity constraints on the ETFs, removing no short selling constraints and implementing a regime switching model for volatility (used for setting the Expected Shortfall target). However, these non-critical refinements can await adequate qubit capacity.




§ CONCLUSION

To our knowledge, this is the first attempt at a quantum algorithm for an Expected Shortfall based Dynamic Asset Allocation. More specifically, a QUBO (or Ising Hamiltonian) formulation for the Expected Shortfall Optimization problem is provided.

This is significant because modern finance practitioners have very little faith on volatility or Value at Risk as an efficient risk metric and so approaches like <cit.> will find limited adoption. The current management philosophy on risk management is geared towards extreme tail risks (occurrence frequency once in a decade or less) and not towards day-to-day business-as-usual risk.

The algorithm is dynamic because the risk target emerges naturally from the market volatility. There is no arbitrary (expert judgment based) input from a portfolio manager. We have not come across a dynamic quantum annealing algorithm for financial risk management in literature.

Moreover, the algorithm avoids complicated statistics like generalized pareto distribution (GPD) <cit.>. GPD requires sufficient tail data for estimating parameters. But if there were sufficient data, then GPD would not have been needed! So it is a tough balancing act and the implementation often boils down to judgement driven heuristics. We avoid this problem by using a simple approach (quadratic in weights) that uses a gaussian as an initial crude guess for the tail and then iteratively converges on the true Expected Shortfall. This approach has the added advantage of avoiding two pitfalls that practitioners often face:


  * deriving risk measures from a time series that has been generated using monte carlo simulation (that used a probability distribution fitted over sparse data) OR

  * undermining risk by using the normality assumption shortcut


Lastly, an interesting feature of our algorithm is focus on asset class diversification. This is important because in calm markets some pairs of instruments within the same asset class (e.g. JPM vs Caterpillar within the asset class `stocks') may show misleadingly low correlation. But that diversification benefit vanishes in times of extreme volatility (e.g. everything heads downwards - there is no safe harbor) - exactly when you desperately need the benefit to kick in! We use a small number of ETFs but cover asset classes more comprehensively thereby spanning a broader financial universe which generates superior efficient frontiers.



§ APPENDIX

Convention followed: Matrices are in capital, bold e.g. 𝐑. Vectors are in small, with an arrow over e.g. w. Numbers are in small e.g. σ. Below is a list of the variable definitions:



  * N: number of assets

  * T: number of data points in the time series for each asset

  * 𝐑_𝐍𝐓: asset returns matrix. The matrix has N rows where N denotes the number of assets and T columns where T is the length of the time-series.

  * R: mean (over time) asset return vector with N elements

  * μ_i: ith member of R

  * r_i: asset return vector (with T elements) for the ith asset

  * w: weights vector

  * L: number of qubits used to represent weight w_i

  * p: = log_2L

  * Σ: variance-covariance matrix  

  * σ_ij: an element of the variance-covariance matrix

  * σ: volatility

  * α: confidence Level

  * VaR_α: value-at-risk at confidence Level α

  * ES_α: Expected Shortfall at confidence Level α

  * ES_i: portfolio's expected shortfall at iteration i

  * ES_T: portfolio's expected shortfall target (for current time T)

  * η: convergence threshold




§ ACKNOWLEDGMENT

We thank Peter Lockwood for the valuable suggestions and edits.

00
mcneil A. McNeil, R. Frey and P. Embrechts, “Quantitative Risk Management”, Princeton Series in Finance, 2005
goldberg37 L. Goldberg, M. Hayes, and O. Mahmoud, “Minimizing Shortfall”,  Forthcoming in Quantitative Finance
gilli39 M. Gilli and E. Këllezi, “An Application of Extreme Value Theory for Measuring Financial Risk”,  Computational Economics, 2006
tasche42 D. Tasche and L. Tibiletti, “Approximations for the Value-at-Risk approach to risk-return analysis”,  EFMA 2001 Lugano Meetings, 2001
riste01 D. Riste et al., “Demonstration of quantum advantage in machine learning”, Quantum Information, April 2017
orus02 R. Orus, S. Mugel and E. Lizaso, “Quantum computing for finance: overview and prospects”, arXiv:1807.03890v2, 2019
kopczyk03 D. Kopczyk, “Quantum machine learning for data scientists”, arXiv:1804.10068v1, 2018
woerner05 S. Woerner and D. Egger, “Quantum Risk Analysis”, arXiv: 1806.06893v1, Jun 2018
elsokkary04 N. Elsokkary et al., “Financial Portfolio Management using D-Wave’s Quantum Optimizer: The Case of Abu Dhabi Securities Exchange”, IEEE, 2017
peng51 W. Peng et al., “Factoring larger integers with fewer qubits via quantum annealing with optimized parameters”, SCIENCE CHINA Physics, Mechanics and Astronomy, 2019
long53 G. Long, “General quantum interference principle and duality computer”, Communications in Theoretical Physics, 2006
yin54 Z. Yin and Z. Wei, “Why quantum adiabatic computation and D-Wave computers are so attractive?”, Science Bulletin, 2017
wittek55 P. Wittek and C. Gogolin, “Quantum enhanced inference in Markov logic networks”, Scientific reports, 2017
jiang52 Jiang et al., “Quantum Annealing for Prime Factorization”, arXiv:1804.02733v2, Jun 2018
rebentrost29 P. Rebentrost and S. Lloyd, “Quantum computational finance: quantum algorithm for portfolio optimization”, arXiv: 1811.03975v1, Nov 2018
bian36 Z. Bian et al., “The Ising model: teaching an old problem new tricks”,  D-Wave Systems, Aug 2010
glover40 F. Glover, G. Kochenberger and Y. Du, “A Tutorial on Formulating and Using QUBO Models”,  arXiv: 1811.11538, May 2019
bertsimas41 D. Bertsimas, G. Lauprete and A. Samarov, “Shortfall as a risk measure: properties, optimization and applications”,  Journal of Economic Dynamics and Control, 2004
papoulis A. Papoulis and S. Pillai, “Probability, Random Variables and Stochastic Processes”, Tata McGraw-Hill, 2002
nielsen M. Nielsen and I. Chuang, “Quantum Computation and Quantum Information”, Cambridge University Press, 2010
aleksandrowicz G. Aleksandrowicz et al., “Qiskit: An Open-source Framework for Quantum Computing”, Cambridge University Press, 2019

