Quantum computing for financial risk measurement

Quantum computing allows a significant speed-up over traditional CPU- and GPU-based algorithms when applied to particular mathematical challenges such as optimisation and simulation. Despite promising advances and extensive research in hard- and software developments, currently available quantum systems are still largely limited in their capability. In line with this, practical applications in quantitative finance are still in their infancy. This paper analyses requirements and concrete approaches for the application to risk management in a financial institution. On the examples of Value-at-Risk for market risk and Potential Future Exposure for counterparty credit risk, the main contribution lies in going beyond textbook illustrations and instead exploring must-have model features and their quantum implementations. While conceptual solutions and small-scale circuits are feasible at this stage, the leap needed for real-life applications is still significant. In order to build a usable risk measurement system, the hardware capacity—measured in number of qubits—would need to increase by several magnitudes from their current value of about 102\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$10^2$$\end{document}. Quantum noise poses an additional challenge, and research into its control and mitigation would need to advance in order to render risk measurement applications deployable in practice. Overall, given the maturity of established classical simulation-based approaches that allow risk computations in reasonable time and with sufficient accuracy, the business case for a move to quantum solutions is not very strong at this point.


Introduction
The term 'quantum computing' refers to using quantum mechanics, i.e. the theory to describe physical properties and effects of atoms and subatomic particles, on specially designed devices. 1 Compared to 'classical' computations on CPU and GPU hardware, 2 the use of quantum hardware and specially designed software promises a significant speed advantage, dependent on the problem at hand. For certain types of applications, such as integer factorisation-often used as a basis for encryption-quantum computing is the only known way to obtain solutions in an acceptable timeframe.
The landscape of quantum technologies, research and investments has seen an exponential growth over recent years [55]. Financial institutions such as large banks have been investing substantially into quantum research-mainly on rented hardware with so far limited capabilities-and the exploration of its use cases. High hopes have been expressed for applications such as trading and risk management [11,20,22,44,69,90]. The recent trend of using machine learning for financial problems offers a straightforward extension to quantum computing. It is as such vigorously pursued by banks [19]. Suitable quantum applications are especially those where a large number of algorithmic repetitions is required, for example, the brute-force enumeration of possible solutions for a system of equations and, to a lesser extent, in Monte Carlo simulation.
The contribution of this study is an exploration of the feasibility of using quantum computing in actual large-scale risk applications in financial institutions. In a typical market risk application that makes use of simulating future market scenarios-such as a Monte Carlo-based Value-at-Risk (VaR)-a large number of risk factors and their joint evolution need to be reflected. Furthermore, the corresponding changes in the present value (PV) of instruments in a portfolio require revaluations in each potential future state. The situation in a counterparty credit risk context is similar: scenarios across a multitude of risk factors and, additionally, numerous time steps need to be combined with portfolio revaluations.
The analysis shows that the capacity of current state-of-the-art quantum systems, measured through the number of 'qubits', severely limits both the number of risk factors that can be simulated as well as the accuracy of their marginal and joint distributions. In conjunction with typical 'noise' patterns that quantum circuits experience in practice, risk measurement applications with real-life use cases are out of reach for the foreseeable future. 3 Bearing in mind that practical risk applications in financial institutions using classical computing are meanwhile mature and deliver accurate enough results in acceptable amounts of time even for large-scale portfolios, the business case for a move to quantum computing is not apparent at this point.
The paper is organised as follows. Sect. 2 summarises the current state of research into quantum applications in quantitative finance. Sect. 3 defines the framework for practical quantum use cases in risk measurement. It outlines fundamental challenges in terms of size, speed and accuracy requirements and recalls some essentials on quantum computing. The basic building blocks in the form of quantum amplitude estimation as well as techniques for scenario modelling and working with profit-and-loss (P&L) distributions are described. Furthermore, quantum-specific challenges for real-life use cases such as the handling of noise are covered. Sect. 4 presents an application to market risk as typically encountered in financial services. Starting from the underlying risk factor model with its calibration and the VaR calculation, the creation of a suitable quantum circuit is described. This is followed by an analysis of the estimation results. Covering the same aspects, a worked example for measuring counterparty credit risk is discussed in Sect. 5. In Sect. 6, the influence of adding typical quantum noise as present in current devices is illustrated. The Python-based Qiskit framework 4 of IBM is used for the actual implementations. Section 7 concludes and provides an outlook for future research.

Research landscape in quantitative finance
Quantitative finance is a prime candidate for the use of quantum computing, given that many algorithms rely on simulation or on solving complex optimisation problems which either demand a vast amount of computational power or are even unsolvable with classical approaches. 5 Practical applications of quantum computing in quantitative finance are still comparatively limited.
Pricing of derivatives. Amongst financial instruments, some classes are easier to handle than others. For the purpose of 'pricing', i.e. the determination of the PV, one will typically rely on (1) replication arguments-assembling the same payoff from more basic building blocks whose PVs are known or easier to obtain-and/or (2) assumptions on the future evolution of the value drivers (e.g. stock prices) and obtain the PV through mathematical derivation or simulation. A particular challenge are derivatives, whose values depend on that of one or more underlying variables. Especially the pricing of instruments with nonlinear payoffs such as options is an established challenge. 6 In case no closed-form pricing formulas or efficient PDE-based 7 approaches are available, Monte Carlo simulation is the standard tool. Quantum approaches have been proposed for a variety of applications, for example: • Pricing of standard ('vanilla'), path-dependent (e.g. barrier and Asian) and multiasset options in a Black-Scholes [9] and local volatility [28] framework [4,18,33,38,51,54,64,72,73,75,76,80] • Pricing of options under a stochastic volatility [16] and jump-diffusion process [95] • Pricing of American-style options [27,62] • Pricing of interest-rate derivatives with a multi-factor model [58,84] • Pricing of collateralised debt obligations (CDOs) [83] Risk measurement. In a financial context, 'risk' usually refers to an adverse event associated with a (financial) loss. Quantum applications that have been proposed so far span, for instance: • Estimation of risk measures such as VaR (see also Sect. 4), Conditional VaR (CVaR) [91] and the corresponding risk contributions [63] • Estimation of credit risk (Economic Capital) [30] • Sensitivity analysis for a (business) risk model at an exchange [15] Miscellaneous. Quantum algorithms have been applied across a range of other areas in finance as well. For example: • Portfolio optimisation-construction of 'optimal' portfolios, for instance, in terms of the best trade-off between expected return and risk [6,26,46,56,70,87,88] • Time series forecasting [31] • (High-frequency) trading and arbitrage [21,94] • Credit scoring and classification [61] • Handling of transaction settlements (i.e. the exchange of securities and cash between parties) at a clearing house [13] Notably, techniques for estimating gradients and higher-order derivatives on quantum hardware [57,78,81] are highly relevant for many applications in finance such as pricing, hedging and risk management. The same is true for techniques to reflect pseudo-random numbers, as an essential building block in typical Monte Carlo use cases, in a quantum circuit [50,65]. Crucial for risk applications is the reflection of the dependence structure amongst value drivers, usually expressed by means of copulas (see also Sect. 4). The corresponding quantum implementation [60,93] is therefore an important component. Furthermore, Quantum Machine Learning (QML) has received considerable attention across the full range of techniques such as supervised and unsupervised learning as well as generative modelling tasks [7,8,71,77]. Specifically for financial applications, methods for market scenario generation, such as the joint evolution of dependent risk factors [53], are a promising route [3,23,52,97].

Fundamental requirements
Practical use cases in quantitative finance usually exhibit several vital challenges. One of the most important ones is the scalability of any application-such as the pricing and/or risking of instruments-so that calculations with a minimum accuracy 8 are technically feasible within acceptable runtimes.
For instance, a market risk application in a large financial institution typically encounters the following 'size challenges': • Portfolios: 1,000 to 10,000 • Instruments/trades: 9 100,000 to 1,000,000 • Valuation parameters: 10,000 to 10,000,000 For the actual risk quantification, one would rely on: • Scenarios (for a subset of the valuation parameters): 100 to 1,000,000 • Time horizons (not necessarily equally spaced): 1 to 1,000 In spite of the inherent model risk, accuracy of risk measures is expected to be high in practice, usually not exceeding ±10% around the 'true' value. Risk calculations need to fit into a few hours as a maximum (e.g. overnight batches), but, dependent on the application, outputs can be required in a matter of minutes or even seconds (e.g. for intraday risk and what-if analyses for trading decisions).
These requirements drive, amongst others, storage needs as well as the minimum processing speed of a risk system.

Essentials on quantum computing
The core idea behind quantum computing is the ability to perform parallel computations at scale. As a building block, a two-dimensional quantum-mechanical system-a qubit-is used, which encodes the classical '0' and '1' bits in its basis states, |0 and |1 . Through superposition the quantum system can be in all of its states at the same time, which can be exploited from a computational angle.
In a practical application, one will usually (a) encode the input data through the initial states of the qubits, (b) bring those qubits into superposition, (c) apply an algorithm (also: oracle) across all states (see, for example, Sect. 3.3) and (d) measure one or several qubits. This measurement has a random result whose interpretation is to reflect the solution to the problem at hand. 10

Quantum amplitude estimation as a basis
Quantum Amplitude Estimation (QAE) [14] promises a speed-up in the calculation of expected values compared to 'classical' simulation. Concretely, with an operator A acting on a system 11 , the unknown parameter β = | ˜ 1 |˜ 1 | ∈ [0, 1] is estimated, the amplitude of the state |˜ 1 .
Quantum phase estimation leads to an estimatorβ with the property with a probability of at least 8/π 2 ≈ 81.1% (see, for example, [29]). M is hereby the number of quantum samples. Estimating β in this way leads to a quadratic speed-up compared to classical Monte Carlo simulation with its convergence rate O(M −1/2 ) . The original QAE requires large circuits and is computationally expensive. Various improvements have been developed over time [16,36,41,43,66,74,82] and form part of industry-standard implementations by now, for example, Iterative QAE (IQAE).

Modelling future scenarios
Distributions. In the context of quantitative finance, the evolution of asset prices is regularly modelled with the help of distributions. These can either reflect the prices directly or their changes (returns) relative to fixed (= current) values. Alternatively, one can simulate the valuation parameters that-in conjunction with pricing functionsdetermine the future value or return distribution of the assets in question. An example are stock prices that feed an option pricing formula.
For instance, assuming a log-normal asset distribution, the asset price S T at a time horizon T can be expressed through with μ := r − 1 2 σ 2 T + ln S 0 , S 0 as the current price, r as the risk-free interest rate and σ as the asset volatility.
In the quantum setup, one generally represents a random variable X through a quantum state consisting of n qubits [80]. The first step usually consists of a truncation to [X lower , X upper ] and a discretisation of the distribution. For the latter, let i = 2 n−1 j n−1 + · · · + 2 j 1 + j 0 with j k ∈ {0, 1} and k = 0, . . . , n − 1. The affine- then fulfills the requirement. With p i ∈ [0, 1] as the corresponding probabilities, one can use a loading operator P X to create a state with an n-qubit state |i n = | j n−1 . . . j 0 . The d-dimensional extension of (2) reads whereby ⊗ denotes the tensor product. This setup allows the reflection of future scenarios of quantities such as asset prices, if required also jointly with other factors.
Stochastic processes. In order to express the evolution of asset prices, their returns or those of their valuation drivers through time, stochastic processes are a convenient way to formalise the dynamics. Notably, a stochastic process (S t ) implies a distribution of its modelled quantities at any future time point 0 < t ≤ T .
An important and flexible class of stochastic processes is the Ornstein-Uhlenbeck (O-U) type [85]. It has many applications in quantitative finance and can be used, for example, to model mean-reverting behaviour. A typical application is the modelling of interest rates, whose values tend to be 'constrained' to certain corridors through time. An O-U process is Gaussian and Markovian. 12 The general form reads dx t = θ (μ − x t ) dt +σ dW t . Assuming the Markov property, in a discrete setting, the increments of (S t ) between t to t + 1 can be expressed by a distribution that depends only on S t .
In the quantum setup, in analogy to (3), one can prepare |ψ n as to reflect the prices or returns over time, based on N discrete time steps of length

Distributional properties: mean and quantiles
As explained, for example, in [91], one can define a function f : {0, . . . , 2 n − 1} → [0, 1] and with this an operator that acts on an ancilla qubit. After applying F to |ψ n |0 as per (2), one can use the resulting expression, to approximate various quantities of the distribution. QAE can be applied to obtain the probability of measuring |1 in the last qubit, equal to 2 n −1 i=0 p i f (i). This expression is also that of the expectation of a (discrete) random variable X , i.e. E[ f (X )].

Estimation of the mean.
With and from that E[X ]. Estimation of distribution quantiles. Quantile estimation is integral to risk measurement. Given the stochastic nature of the evolution of value drivers for financial instruments, their future values are expressed through distributions. By zooming into a particular quantile, one can summarise the risk in a single figure. For a random variable X and a given probability level α ∈ [0, 1], the quantile measure is defined as Q α (X ) = inf{x ∈ R : P[X ≤ x] ≥ α}. In a quantum setup, let so that applying the corresponding F I to |ψ n |0 yields a probability of measuring |1 in the last qubit of I i=0 p i = P[X ≤ I ]. With an interval search over I one can find the smallest I α that fulfils P[X ≤ I α ] ≥ α and that is hence an estimator for Q α (X ).

Motivation for application in risk measurement
Many risk calculations are based on Monte Carlo simulation in order to obtain a distribution of future 'states of the world', from which measures can be derived-and on which usually risk controls such as limits will be imposed.
Basic Monte Carlo approaches can be improved in various ways to enhance convergence beyond O(M −1/2 ). A typical example is the use of quasi-Monte Carlo simulation that relies on deterministic, low-discrepancy sequences of random draws.
However, these are difficult to work with in higher dimensions that are required in financial risk calculations with a large numbers of risk factors. Not only is a better convergence rate not guaranteed, but results can even be subject to biases.
A quantum implementation for risk measurement purposes aims at exploiting the quadratic speed-up of Monte Carlo simulation offered through the use of QAE, as described in Sect. 3.3, i.e. a convergence rate O(M −1 ). Established techniques to reduce further the variance of estimators can be applied if considered necessary and suitable for high-dimensionality problems.

Quantum-specific challenges
Commercially relevant risk calculations present a particular challenge for quantum computing, especially for the following reasons: • Number of risk factors and their dependence structure. The currently available quantum hardware exhibits only a limited number of qubits, typically not more than around 100 [34]. This can be a severe limiting factor for large-scale practical applications. Financial risk calculations often require a significant number of risk factors (see Sect. 3.1), modelled as correlated random variables. It is in part an algorithmic problem to construct these factors as quantum states in order to minimise the use of qubits as well as gates. Even the accurate reflection of distributions as per (2) and (3) already demands at least five qubits for each dimension (equivalent to a support with 2 5 = 32 discrete points). Operations for risk factor convolutions, the application of payoff profiles, the determination of distributional properties and QAE itself require a non-negligible number of additional qubits. While it is possible to 're-use' qubits in a quantum circuit-essentially by 'undoing' previous operations, exploiting the unitary nature of all quantum gates-this process is not only adding complexity but also subjects the circuit to noise (see below). Furthermore, while the number of available qubits in hardware grows, not all designs allow all operations across all qubits. An example is a 'swap' of any two qubits, which might be limited to certain parts of the system. Quantum simulators can be used to develop and test algorithms, but the size of the problems cannot exceed a certain size, given that the calculations would tend to be prohibitively expensive in terms of computation time on classical machines. As a consequence, at least until quantum hardware has reached a much more mature state, 'hybrid' approaches have been suggested: only time-critical and suitable operations-ideally in a highly QPU-optimised format-are passed from the CPU to the QPU and back afterwards, also bearing in mind noise implications [24].
• 'Noise'. Randomness arising from experiments like Monte Carlo simulation can be addressed by established statistical means such as confidence intervals as a function of the number of runs. An added layer of complexity in a quantum system stems from the fact that operations like gates are subject to 'quantum noise'. This encompasses any undesired sources that change the quantum system and can originate, for example, from hardware imperfections or thermal noise. Any practical quantum algorithm therefore needs to take the impact of noise on the estimation results into account (see also Sect. 6) and, ideally, mitigate them to the largest extent possible [35,48].

General setup
Market risk relates to adverse changes in the PV of financial instruments. The projection horizon is usually short, between one and ten business days. It is quantified by determining the future distribution of changes to a portfolio PV. An extreme outcome of this P&L distribution is the VaR, which serves as a standard market risk measure. 13 It quantifies the extent of possible financial losses over a specific time horizon and for a given level of confidence. For a random variable P representing the P&L and a probability α ∈ [0, 1], the measure is defined as Typical values in practice are α = 0.01 and α = 0.05. 14 For the actual risk calculation, it is common to model the joint distribution of the returns, i.e. moves, of all relevant risk factors (e.g. stock prices and interest rates for various maturities). In conjunction with a repricing of the instruments in a portfolio, this allows to determine the P&L distribution and, from that, the VaR. One distinguishes three key methods for its calculation: A. Historical VaR. Risk factors are modelled by directly applying historically observed returns to current market values. The dependence structure between risk factors is implicitly determined by their past co-movements. B. Parametric VaR. Risk factors are modelled using probability distributions calibrated to historical returns; simplifying assumptions such as a multivariate normal distribution are made in order to obtain closed-form expressions for the VaR. C. Monte Carlo VaR. Risk factors are again reflected by probability distributions calibrated to historically observed returns. The joint distributions are often fitted to historical data more closely than in the case of a Parametric VaR and, as such, usually do not allow for closed-form expressions.
The Monte Carlo VaR lends itself well to applying the QAE algorithm (as per Sect. 3.3). Practical use cases typically rely on a good representation of the marginal risk factor returns for which a normal distribution is an over-simplification. Figure 1 summarises the components of a Monte Carlo-based market risk calculation and how classical and quantum computer implementations differ. In Sect. 4.2, the risk factor modelling and its calibration are described. Besides the move from normal to non-normal marginal factor distributions, the way to 'decouple' those from the dependence structure with the help of copulas is introduced. Starting from the 13 See [49] as a standard reference on market risk. 14 An extension to Expected Shortfall (ES) [59] is straightforward. As a 'tail average', it is defined as

Fig. 1 Components of a market risk calculation-comparing classical and quantum implementations. In
Step A, risk factor model parameters are inferred from historical market data. With the exception of more complex model-fitting routines, there is no specific use case for a quantum algorithm, and the approach is identical to the classical one. Based on current market data, future scenarios of the world are then simulated in Step B. Combining those with risk factor sensitivities leads to the corresponding P&Ls (Step C). These two steps are formulated differently on a quantum compared to a classical computer: there are no Monte Carlo scenarios, with each being a realisation of a random variable. Instead, quantum registers represent the random variables for both the risk factor returns and the P&Ls. In order to obtain the output in the form of a risk measure (Step D), the classical approach makes use of the simulated P&L distribution and its statistics, such as an extreme quantile. A quantum algorithm will encode this last step (see Sect. 3.5) and ultimately rely on [Iterative] Quantum Amplitude Estimation to obtain a measurement derivation of the underlying P&L distribution, the VaR calculation itself is covered in Sect. 4.3. In Sect. 4.4, following the approach in [91], the model implementation on a quantum computer is presented; a special focus hereby lies on the distribution loading. Sect. 4.5 analyses the estimation results.

Return definitions
Let the set of d relevant risk factors for a portfolio, for example, stocks or commodity prices, at a time point t be denoted by Between any two points t and t + t, the vectors of absolute, logarithmic and relative risk factor returns are given by The approximation for the relative returns follows from series expansion and tends to hold in the case of small returns.

Accommodating empirical risk factor distributions
A common approximation used particularly in Parametric VaR is that risk factor returns over a period t follow a multivariate normal distribution: with mean vector μ and covariance matrix , both assumed to be constant over time. The associated risk factor distribution is then given by a multivariate extension of (1). An advantage of this normal model is that efficient implementations exist for the distribution loading, i.e. the preparation of quantum registers holding correlated normal random variables (see Sect. 4.4.1). In many empirical cases, however, marginal probability density functions (PDFs) of risk factor returns are leptokurtic, and the simple normal model is not sufficiently accurate. A more appropriate modelling of actual marginal distributions is one of the main reasons for choosing a Monte Carlo over a Parametric VaR.
Copulas [60,67] provide a convenient way of separating the marginal risk factor PDFs from the underlying dependence structure. This facilitates both calibration and efficient implementation of the Monte Carlo VaR, even for a large number of risk factors. The Sklar theorem of copula theory states that for real-valued random vari- For extreme market events, reflecting strong 'tail dependence' between the marginal risk factor distributions can be required. Here, as a simplifying assumption and in line with industry practice, a Gaussian copula is chosen: where (z) is the CDF of a standard normal variable, and d (z; K) denotes a joint standard normal multivariate CDF with mean zero and correlation matrix K. 15 For classical and quantum computers, variates reflecting empirical distributions can then be generated efficiently by applying functions G k such that X k = G k (Z k ). Hereby, Z k are random variables governed by Z ∼ N (0, K ). This is apparent when first considering the CDF of Z expressed in terms of the Gaussian copula, i.e. .
, the CDF of the targeted random variables can then be written as In classical Monte Carlo simulation, samples z = (z 1 , . . . , z d ) are drawn from the multivariate normal distribution d . From this, non-normal variates are obtained through On a quantum computer, a register represents a random variable, and the transformation G k is applied to each of them. Given the limited number of available qubits, it is convenient to define and calibrate the quantities of interest in the following standardised way, to ensure numerical values of X k of similar magnitude: with σ k obtained from in (4). The aim of the model calibration is to determine the G k for all k.

Calibration
Market risk models project the P&L over a short time horizon of length η (years). A typical value found in practice amounts to ten business days. An assumption of 252 business days per year translates into η = 10/252. The model calibration uses at least one year of historical data prior to the risking date. In the following, four years are chosen. This is helpful in obtaining sufficiently large samples in the tails of the distributions and thereby allowing a good demonstration of the approach. For illustration purposes, a portfolio driven by two risk factors-the stock prices of Microsoft Corporation (msft) and Apple Inc. (aapl)-is created. S 1 relates to msft and S 2 to aapl. Such a portfolio can consist of various financial instruments. If these were to be solely stocks, the sensitivity to price changes would be constant and equal to one (or minus one for stocks that are sold short). In the more general case, the portfolio with a current value of P will have sensitivities δ k = ∂ P ∂ S k to each risk factor and potentially higher-order ones as well.
The reference date for the calibration is selected as 1st April 2021, and the calibration data comprises the period 31st March 2017 through 31st March 2021. 16 The history of the prices for msft is plotted in Fig. 2a. By choosing ten-day returns for the calibration, the resulting distribution reflects the targeted risk projection horizon. As an initial step, the individual series of (overlapping) log-returns for the stock prices The distribution is leptokurtic; for example, a cumulative probability of 1% corresponds to a normal return of −2.33 standard deviations and an empirical return of −3.26 standard deviations. In d, for the cumulative probability associated with each empirical return on the y-axis, the corresponding normal return is plotted on the x-axis (a form of Q-Q plot); a function G as per (7) can be fitted to this data are calculated (omitting the risk factor index k in the following for clarity): 17 where s t i is the historical closing price at time t i , with i = 1, 2, ..., n indexing the business days.
For the actual marginal risk factor calibrations, it is useful to postulate that the mean ('drift') for each stock is equal to zero. This assumption is justifiable given that the estimation of the drifts from historical data points is not only prone to large estimation uncertainty but also not necessarily predictive of the future stock price trends.
In a multivariate normal model as per (4), the resulting parameters read μ := (0) and = This covariance matrix equates to standard deviations of the msft and aapl stocks of σ 1 = 0.0431 and σ 2 = 0.0587, respectively. 18 The pairwise linear correlation amounts to about +67%.
In line with the standardised form of (7), let denote the standardised risk factor series, with mean μ and standard deviation σ as their respective moments. From this, the empirical cumulative probability of each value x i , f i , is calculated as 19 The result for msft is plotted in Fig. 2b (linear scale) and 2c (log-scale).
As outlined in Sect. 4.2.2, the aim is to obtain functions G k for each return series k as per (7). To this end, Fig. 2d is a scatter plot for msft with x i on the y-axis ('empirical returns') and −1 ( f i ) on the x-axis ('normal returns'). G k is then fitted to this data. 20 Piecewise polynomials of low order will often be sufficient for this step, which is helpful for the implementation on a quantum computer.
For the marginal msft returns, a piecewise cubic fit using seven knot points is shown in Fig. 3a. The corresponding density is plotted in Fig. 3b, over a histogram of the empirical returns. Such an approach can capture the specificities of the marginal distribution. Even a simple piecewise linear fit using only two knot points (Fig. 3c) already provides a significant improvement over a normal distribution. In particular, as shown in Fig. 3d, a much-improved fit to the 1% cumulative probability is obtained.

VaR calculation
The portfolio P&L-between t and t + t-is a random variable, P, and expressed as a function of the changes in the risk factors, here S abs 1 and S abs 2 . With δ as 18 Under the assumption of normality of returns, the annualised and easier-to-interpret values read 22% and 29%. 19 Even when assuming perfect stationarity, the estimation from limited datasets results in uncertainty in the CDFs. This is not taken into account here but might deserve closer attention when judging quantum estimation errors and quantum noise with respect to their practical implications. 20 For simplicity, S rel t ≈ S log t is assumed here; by applying x i → exp(σ x i )−1 σ before the fit, this approximation can be removed.  (7) are obtained by fitting empirical to normal returns. A piecewise cubic fit is used in a and b, with the latter demonstrating a 'smoothing effect' on the PDF. c and d are based on a piecewise linear fit, which already provides a reasonable approximation of the tails of the empirical distribution the stock-specific portfolio sensitivity to price changes and only retaining first-order terms: 21 To facilitate the implementation on a quantum computer, the P&L equation is expressed using two constants a and b. 22 Furthermore, (7) is substituted: 21 The full 'repricing' of the portfolio would be an alternative, but given the computational demand, a sensitivity-based approach is often preferred when using a Monte Carlo-based VaR. Notably, higher-order sensitivities and various other improvements can be added in practice if deemed necessary. 22 For simplicity, the multiplication by b is performed as part of the distribution loading.
The normalised P&L is defined by omitting the constant a: The VaR is calculated from the quantiles of P norm , multiplied by a in order to obtain the final result.

Distribution loading for probability density functions
A range of algorithms has been proposed to create a joint PDF in a quantum state. The authors of [79] describe how an arbitrary quantum state can be initialised using 2 q−2 − 2q CNOT gates, where q is the total number of qubits used in all quantum registers representing the random variables. [42] describes an algorithm that can be used for 'efficiently integrable' PDFs. While a normal distribution can be handled, there is a restriction on the distributions that can be generated. More recent work attempts to find algorithms that can load arbitrary distributions with fewer gates [25,96]. The functions G k as defined in (7) can be applied to reflect the empirical marginal risk factor distributions needed for the VaR calculation. This provides an alternative to the 'direct' approach of [79]. The 'piecewise transformation' technique avoids the problem with the direct method that the number of required gates becomes prohibitive when generating large sets of risk factors as in typical market risk applications. Each approach has its advantages, however, and is presented in turn.
'Direct' loading. The approach of [79] is used to initialise two quantum registers representing the risk factor returns to a vector of amplitudes. This is the implementation of the loading operator P X from Sect. 3.4. 23 The amplitudes are calculated using the joint PDF. This can be achieved by expressing the PDF with the help of the copula C: Fig. 4 Marginal PDF of a calibrated quantum state. Using q = 4 qubits, the distribution-with 2 4 = 16 discrete states-is generated by (noise-free) simulation. The underlying CDF is the piecewise cubic fit of msft returns as per Sect. 4 whereby c denotes the copula density and f k (x k ) = d F k dx k . For the case of the Gaussian copula as in (5), the density is given by with ζ := ( −1 (u 1 ), . . . , −1 (u d )) and I d as the identity matrix [67].
In the d-dimensional case, the probabilities, p i 1 ,...,i d , are computed using the joint PDF from (9). The discrete values of x k are given by x i k k with i k ∈ {0, . . . , n − 1} and n indicating the number of possible values of x k : A 'loaded state' for the msft returns based on q = 4 qubits is shown in Fig. 4. For this calculation, piecewise cubic fits (as per Fig. 3a) are used to generate the CDF. 24 Piecewise transformation. An alternative way to load the distribution is to apply transformations-the functions G k as in (7)-to quantum registers that have been loaded in a multivariate normal state (for which efficient algorithms exist). These transformations are applied to each register in isolation. The number of required gates therefore scales linearly with the number of risk factors, rendering the algorithm suitable for large-scale calculations. The functions G k themselves are constructed as piecewise transformations.
For the distribution loading, a three-section piecewise linear transformation is applied to a quantum register |i n , a discretised random variable defined by (2) and based on n qubits. The function is shown in Fig. 3c on the example of msft. The transformation can be written as The transformation is given by As an example, a three-qubit normal distribution is converted into a five-qubit empirical distribution (n = 3, m = 2). Figure 5a shows the transformation of the actual values, and Fig. 5b plots the integer transformation as per (10). For comparison, the piecewise transformation of the real quantities without discretisation is displayed. Five qubits are chosen to represent F(i), a compromise that provides a sufficiently good fit whilst keeping the number of qubits low. This form of distribution loading is not identical to the 'direct' approach but instead represents a redistribution of the probability density. The normal distribution in Fig. 5c is transformed into the empirical distribution as per Fig. 5d.

Quantum circuit
Following the approach of [91], QAE (see Sect. 3.3) is used to compute the VaR. Figure 6a shows the layout of the circuit. It calculates cumulative probabilities of the  5 Piecewise transformation applied to a three-qubit register. a and b show a piecewise linear fit of the transformation from normal to empirical returns and a discretised form of this transformation that can be applied to the (integer) quantum registers. c and d provide the PDFs of the quantum registers pre-and posttransformation, respectively, illustrating the redistribution of probabilities. Note that an extra two qubits are added for d normalised P&L P norm as per (8); all numerical values derived and shown subsequently are for the case a := 1, which is just a multiplicative constant. Furthermore, an example value of b := 1 is chosen, although the circuit can accommodate an arbitrary value by means of modifying the piecewise transformation coefficients. 26 A correlated normal distribution is first loaded into two three-qubit registers by circuit P(x) of Fig. 6a. 27 Each three-qubit random variable is then transformed into an empirical random variable using a piecewise linear transformation circuit and added to the result register; three extra qubits are needed to store the result. Finally, an additional integer comparator-as described in [91]-is used to generate the singlequbit objective, the amplitude of which is to be estimated. A bisection search applied to the CDF is then employed to calculate the VaR (see as well [91] for more details).  6 Quantum circuit for market risk. a shows the circuit that obtains a quantum register of P&Ls. As a final step, an integer comparator ('cmp') is applied, which flips the objective qubit if the register value is less than a specified integer; the amplitude of this objective is then estimated using QAE. In order to test the Qiskit implementation, one million measurements of the result register are used to construct the probability distribution of the P&L, as shown in b. For comparison, the equivalent distribution is obtained by classical Monte Carlo simulation through one million samples drawn from a continuous multivariate normal distribution and transformed using (6); the result is displayed in c The details of the piecewise transformation circuits are shown in Fig. 7. Integer comparators compare the value in the n-qubit register to c 0 and c 1 of (10). The resulting qubits are used to control three in-place multiply-add circuits that apply the three linear transformations of (10) for p ∈ {0, 1, 2}. Each of the three performs an in-place multiplication by a classical integer and in-place addition with the result, followed by an addition with a classical integer. This arithmetic makes use of circuits adapted  7 Quantum circuit for piecewise transformation applied to a three-qubit register. Three conditional in-place multiply-add circuits are used to apply (10) for p ∈ {0, 1, 2}. The coefficients a p and b p used in the multiply-adds are classical. Two integer comparators store the result of i ≥ c 0 and i ≥ c 1 into ancilla qubits ancilla_0 and ancilla_1, respectively. Two additional qubits, ancilla_8 and ancilla_9, are used to calculate booleans i < c 0 and c 0 ≤ i < c 1 from these qubits. ancilla_8, ancilla_9 and ancilla_1 are then utilised to condition the multiply-add circuits. The multiply-add circuits include an 'uncompute' step, and additional gates (shown) are added to uncompute ancilla_8, ancilla_9 and ancilla_10. Finally, the comparator ancillas ancilla_0 and ancilla_1 are uncomputed. These steps allow the ancilla qubits to be re-used from [86]. 28 A number of ancilla qubits are required to perform the piecewise transformation. These are 'uncomputed' following each transformation and then re-used for each marginal distribution.
The circuit 'depth', as a measure of size and representing the smallest number of steps required to execute an experiment, depends on the circuit transpiler and the quantum hardware to run on. While gates without common qubits can be processed in the same step, every gate that has at least one qubit in common needs to act on a different step. Using only elementary rotation and conditional NOT gates, the depth amounts to 9,387 (q = 2 per risk factor) and 22,589 (q = 3), respectively. 29

Estimation results
All computations are carried out on a quantum simulator. 30 The implementation of the quantum circuit is tested by executing the quantum circuit and the final comparator 28 The ripple-adder of [86], as opposed to an approach based on the Quantum Fourier Transformation, is selected, because it is expected to be more noise-tolerant for the next generation of quantum computers. 29 The Qiskit implementation allows the transpilation of the circuits and provides a 'depth' method to obtain the gate count. 30 As of November 2022, IBM provides (paid-for) access to systems with 27 qubits, extended to up to 127 qubits on experimental devices; see https://quantum-computing.ibm.com/services?services=systems.  Fig. 6a to calculate the probability distribution of the normalised P&L. This is shown in Fig. 6b. The analogue can be achieved classically, by using the PDF of the discretised quantum register output from P(x) of Fig. 6a and the same coefficients for the piecewise approximation as in the quantum case. In this way, it is verified that the same distribution is produced. The classical calculation without using the same discretisation as the quantum circuit-in fact, without discretisation at all-is shown in Fig. 6c.
With this validation complete, the (Iterative) QAE algorithm 31 is applied to the objective qubit of the circuit of Fig. 6a. This is used to obtain the CDF of the normalised P&L as per (8). The cumulative probabilities are shown in Fig. 8a, b which are identical apart from the scale. The results are plotted with three qubits for each of the two correlated normal registers (the case shown in Fig. 7), as well as the twoqubit case for comparison. The result obtained without discretisation error is also provided as a reference. For this comparison, continuous normal distributions are used in place of the discretised versions, in conjunction with a piecewise linear transformation free from discretisation error. 32 This can be thought of as being the result calculated with a large number of qubits. Results for three typical P&L quantiles are found in Table 1. 33 Using q = 3 qubits for each normal register provides a tolerablethough still rather large-level of discretisation error. The 99% VaR calculated using three qubits amounts to -6.22 and differs by around 14% from the correct value of -5.44. Practitioners would therefore likely require a larger number of qubits. 34 The figures compare the VaR at various quantiles between classical (Panel A) and quantum computations (Panel B). The latter result from applying IQAE, with 2 10 = 1,024 shots each, on a quantum simulator. The input registers use q = 2 and q = 3 qubits per risk factor, respectively. Confidence intervals are very tight and hence omitted in the table. Relative unsigned differences between the quantum-derived figures and the references values in Panel A are shown in parentheses 5 Application to counterparty credit risk

General setup
Counterparty credit risk (CCR) is concerned with cases where one party to a portfolio of instruments-usually bilaterally negotiated financial derivatives-defaults and is not able to honour its obligations. 35 Examples of such transactions are forwards, which allow to lock in an exchange rate such as USD/EUR in advance, and options, which entail the right to purchase or sell assets such as stocks or commodities at a pre-determined price at a later date. While market risk is centred around losses occurring from a decline in the value of instruments, CCR arises from portfolios that have a positive PV and which cannot be realised if the counterparty defaults. Since the surviving party, such as a bank, will typically have hedged the exposure with othernon-defaulted-counterparties, it is left with 'open' positions in this case. Replacing those in the market will in some circumstances only be possible at worse conditions than at origination. CCR is therefore the loss associated with these replacement costs. Contrary to straightforward loans, the exposure over time versus a particular counterparty is not deterministic if the instruments are exposed to PV changes. This is nearly always the case with derivatives. 36 CCR modelling is about estimating the Potential Future Exposure (PFE).
If trade netting has been agreed between the parties, positive and negative PVs can be offset against each other in the case of a default. A notable mitigant of CCR exposure is the use of collateral, which can be posted between the counterparties or by one or both of them to an independent depositary. As an example, if party A buys an option from party B, B will post the PV of the option at inception as collateral ('variation margin'). This, in turn, renders the resulting exposure equal to zero since A could use the collateral to enter a new option trade in case B were to default. As the value of the option evolves over time, the collateral balance is either topped up or decreased-or in some cases, left unchanged. 37 For the purposes of PFE measurement, the collateral balance through time is added to the portfolio PVs to determine the overall counterparty exposure profile. 38 In spite of using variation margin, residual CCR can result from the legal and operational process associated with a default requiring several days or even weeks to complete. A re-hedging in the market by the surviving counterparty might hence only take place with a delay. During this 'slippage' period, the market value of the portfolio can evolve and lead to non-zero replacement costs even after taking any received collateral into account. As a solution, additional 'initial margin' can be posted by both parties, these days typically to a third-party custodian bank. In case of a default, the amount is released to cover any slippage-related costs. 39 In order to obtain the PFE of a portfolio, one will focus on a projection horizon (T ) that covers the period up to the longest maturity across all instruments. The time interval is divided into N , not necessarily equally spaced discrete points t i ∈ [0, T ], i = 1, 2, . . . N with t i < t i+1 and t 0 = 0. In the first process step, risk drivers of the instruments (e.g. stock prices) are diffused over time, expressed either by means of stochastic processes or through distributions. 40 In certain cases, the resulting risk factor distribution at each t i is known in closed form; in the most general case, it can be approximated through Monte Carlo simulation. On the back of the joint risk factor distributions across time, the corresponding instrument PVs as well as the resulting portfolio PVs are determined as a second step. 41 In cases where collateral is exchanged between the parties, a third step is added, applying the projected collateral value across time and adding it to the PVs. Since CCR is only concerned with positive balances vis-a-vis a counterparty, the portfolio PVs including collateral are transformed into exposures by flooring them to zero. The result of these steps is a series of exposure distributions E t i , i = 1, 2, . . . N . 42,43 Given the stochastic nature of the exposure, one will often work with quantile measures, q c (E t i ), to quantify the CCR. Hereby, c ∈ {0.90, 0.95, 0.99} are typical quantiles chosen in practice. 44 One can 37 If the instrument can have a positive or negative value to the parties, such as in the case of an interest-rate swap, the side that posts (receives) collateral over time can alternate. 38 If the collateral itself were to be exposed to changes in value over time, for instance, because it consists of bonds or cash in a different currency, these fluctuations would need to be modelled as well. 39 The protection from CCR through variation and initial margin is still not guaranteed to be allencompassing since extreme market moves might not be sufficiently covered. 40 As noted previously, the former imply the latter. 41 Given the typically much longer projection horizon compared to the market risk case, counterparty credit risk almost exclusively relies on full trade and portfolio repricing and not on sensitivity-based approaches. 42 The exposure at t 0 is equal to the current portfolio PV plus any collateral balance-and, as such, deterministic. 43 The integration of a non-zero 'slippage period' would demand a slightly more complex setup, which is not discussed here. 44 An application closely linked to CCR is the calculation of various valuation adjustments ('xVA'). These combine the PFE, the counterparty default probability over time, the cost of received and posted collateral and other parameters in order to adjust the 'fair value' of a portfolio PV and allow the hedging of related changes. Proposals for a quantum implementation on the example of 'CVA', the Credit Valuation Adjustment, are provided in [2,92].

Fig. 9
Components of a counterparty credit risk calculation-comparing classical and quantum implementations. The components of the counterparty credit risk calculation are broadly analogous to those in the market risk case (see Fig. 1). Again, the main implementation difference lies in the move from Monte Carlo scenarios to working directly with random variables in the form of qubit registers loosely interpret CCR as a through-time variant of market risk, with a focus on the positive rather than the negative tail of the P&L distributions.
The following exploration builds on the market risk example from Sect. 4. In this case, let the portfolio consist of bought call options on each of the two stocks, msft and aapl, and both maturing at time T = 2 (years from now). The respective stock prices over time shall be denoted by S k,t , k = 1, 2. The options give the holder the right to purchase the underlying stock at T and a pre-determined price ('strike') K . If the stock price ends up above K at maturity, the option will be 'in-the-money' and can be exercised against the seller accordingly. 45 For simplicity, let K = 0 for both options here, which means that they are always exercised at maturity and, importantly, that their PVs are equal to S k,t for all t. With risk factors and instrument values coinciding in this case, the revaluation over time (see step two above) can be avoided. The initial option premia are assumed to sum up to 100. They have been paid by the buyer, and collateral (variation margin) in the same amount has been posted by the seller; this hence renders the initial exposure E 0 = 0. No further collateral is exchanged throughout the life of the instruments. The PFE projection interval [0, T ] is reflected by N = 2 equidistant time steps of length T /N . Figure 9 provides a sketch of the components required for a counterparty credit risk calculation and how classical and quantum computer implementations differ.

Risk factor model
The risk drivers behind an exposure calculation need to be evolved in a dependent ('correlated') way, as for market risk applications. The historical calibration period in practice usually stretches over three years or more. A particular challenge in CCR modelling is to capture the long-term evolution of risk drivers and their dependence.
For the postulated example portfolio composed of call options, the two stock prices are the only relevant risk drivers. 46 Assuming that these evolve according to (4) as in the market risk case, the means ('drifts') μ again amount to zero for both stocks.
Recalling that the covariance matrix in Sect. 4.2.3 is based on ten-day returns, its values are scaled to = · 252 10 in order to reflect an annual horizon.

Exposure calculation
The starting point is given by E 0 = 0. With a time horizon of T = 2 (years) and N = 2 time points for the process discretisation, the PFE for the options portfolio from the buyer's perspective is to be determined at t = 1 and t = 2(= T ). In each of these periods, the joint stock returns are governed by N (μ, ). This, in turn, describes the PV evolution of the two options over time and, as such, determines the counterparty exposure for the option holder. Ignoring a flooring to zero for better illustration, the CDFs of the respective exposures E t are described by the distributions of PVs, including the initial collateral. The 90%, 95% and 99% quantiles serve as dedicated exposure measures.

Setup for a quantum computer
The approach follows the technique for measuring credit risk in [91], extended to a multi-period setup. 47 The steps to reflect the task on a quantum computer consist in • loading the probability distributions (see Sect. 3.4); • adding the distributions across time steps; 48 • using (Iterative) Quantum Amplitude Estimation (see Sect. 3.3) to determine the values of the CDF and, from that, the exposure quantiles.
For the two-dimensional risk factor distribution, assume that each of the marginal stock return distributions is discretised using q qubits. Repeating this over all N time steps results in 2q N qubits required for the quantum setup. The addition of the distributions across time steps as well as the final IQAE step demand additional qubits. In Fig. 10, the case of q = 2 and N = 2 is depicted in a stylised circuit diagram. Figure 11 provides a snapshot of the first few gates when preparing the actual quantum circuit scheme. In a two-time step setup and again using only elementary Fig. 10 Stylised quantum circuit for counterparty credit risk. The setup shows a two-period setting. The first block of qubits (risk_factor_prob1) reflects the two risk factors, discretised with two qubits each. The second block (risk_factor_prob2) is the equivalent set for the second period. qae_objective is the objective qubit required for the (iterative) quantum amplitude estimation. sum_factor_risk_factors serve for the addition of the risk factor distributions. The final CDF_return_sum are used to evaluate the CDF at a given point. aux_addition and aux_compare are the required ancillaries for the circuit rotation and conditional NOT gates, the circuit depth reads 1,015 (q = 2 per risk factor) and 2,237 (q = 3), respectively.
Note that it is not obvious how to create a single quantum circuit that can provide measures for distributional quantiles at several time points as an output. A pragmatic way to generate exposure figures over multiple forecasting horizons is to use separate quantum circuits for each, which can be generated algorithmically in a straightforward manner.  11 Quantum circuit for counterparty credit risk-gate decomposition. The graph shows the first set of gates behind the loading of the probability distribution for the first risk factor, as per Fig. 10. U (θ, φ, λ) standards for single-qubit gate and its Euler rotation angles. In the given case, U (θ, 0, 0) represents rotations along the Y-axis with angle θ . The two-qubit '+' operations are conditional NOT ('CNOT') gates. Using only these two elementary building blocks, the entire circuit with its 20 qubits (of which twelve are 'state qubits') has a depth of 1,015-a number that typically also depends on the optimisation during the transpilation.

Estimation results
The main output from the estimation is the CDF of the exposure at a given time point. Results are again obtained with the help of a quantum simulator. In Fig. 12, the classically derived CDF are compared to those from the quantum computation; for the latter, q = 2 or q = 3 qubits are used for each of the risk factor distributions. 49 In the given example, the 'correct' CDF is depicted (right scale), together with its 90% quantile as a typical risk quantity in the CCR context.
At both t = 1 and t = 2 (years), when using only q = 2 qubits per risk factor, the resulting CDF is very far off (left scale). This is driven by the fact that the risk factor distributions are discretised only very coarsely (four points each). With q = 3 qubits per risk factor (eight points each), the approximation is much better. In the latter case, the deviation from the correct CDF is well below 0.05 across the range for both projection horizons. Table 2 summarises how the CDF estimations translate into actual exposure figures. At inception at t = 0, the exposure is zero. The table provides the PFE at both time horizons, t = 1 and t = 2, and for the 90%, 95% and 99% quantile.
The results from the classical computation-here obtained as the sum of two multivariate normal distributions and hence available in closed form-are shown in Panel A. These figures reflect scenarios where the (highly correlated) stock prices increase substantially, giving rise to high PVs of the options in the portfolio. In spite of the initial collateral exchange, a counterparty default could result in a sizable undercollateralisation and associated replacement costs for the option holder.
As evidenced in Panel B, in line with results for the CDF in Fig. 12, using only two qubits per risk factor leads to significant errors in the exposure estimates. 50 This renders those essentially unusable in practice. The case of three qubits per factor limits the PFE errors to about ±10%, which is more tolerable and reaches a level of approximation that might be suitable for practical applications in risk measurement. For example, the actual 90% quantile one and two years ahead reads 82 and 134, respectively. The quantum equivalents with three qubits per risk factor are 75 and 127, i.e. off by 9% and 5%. For the example at hand, the results for the classical case are known in closed form (dotted CDF, right scale). The quantum estimations are obtained by using q = 2 or q = 3 qubits to reflect each of the distributions; notably, the actual quantum circuits require a series of additional (ancillary) qubits to execute the required operations. The figures show the differences in CDF across the distribution range (left scale). The 90% quantile, as a typical quantity to measure counterparty credit risk exposure, is marked explicitly (vertical dotted line). Confidence intervals around the quantum estimates, obtained by applying IQAE with 2 10 = 1,024 shots each, are very tight and hence omitted in the figures. Notably, they are of much lower magnitude than the differences in the CDFs themselves. The analyses in Sects. 4 and 5 assume ideal, not yet available quantum hardware. Besides the discussed loss of accuracy from a limited number of qubits, quantum circuits experience 'noise' in practice. This results from quantum processors being susceptible to their environment and losing their quantum state due to quantum decoherence [35,48]. The theoretical quadratic speed-up compared to classical Monte Carlo simulation is therefore highly dependent on whether this quantum error can be contained and ideally eliminated in future [5]. Until this is achieved, quantum noise needs to be factored into any results obtained from circuits like those proposed here for risk measurement. Otherwise, certain conclusions would not be valid: for instance, even when adding more and more qubits to a system, the measurement of financial risks could still be of no use if noise levels distorted the resulting figures. While the aspect of quantum noise lends itself to further in-depth research, at least an approximate impact analysis is required for the cases discussed here. Understanding the sensitivity of the measurements to typical noise levels sheds light on how much noise can be tolerated to render results accurate enough for practical applications.
The magnitude of quantum noise on current state-of-the-art gate-based devices amounts to about 0.1% for each gate, somewhat varying, for example, based on how many qubits a gate is applied to [39]. In the following, all one-and two-qubit gates in the quantum circuit as well as the final measurement are subjected to these noise levels to form a simplified 'noise model'. Practically, this entails flipping each bit with the given probability on every affected operation in the circuit. Continuing the work on a quantum simulator, 51 the model is applied to the example for counterparty credit risk from Sect. 5. 52 Using q = 3 qubits per risk factor and time point t = 1, Fig. 13a compares the CDF for the PFE in the case of no noise as well as with the defined noise model. It is visually evident that the resulting perturbation can have a non-negligible influence on the risk measurement. In Fig. 13b, the noise level is varied around the base case of 0.1% with a factor of 2 i , i = −3, −2, . . . , +3; from this, the resulting relative errors in the CDF quantiles relative to the 'noise-free' case are calculated. For instance, the 90% quantile in the base case with 0.1% of noise exhibits a relative error of about 15%. For lower noise levels, the relative error in the quantile(s) tapers down, while it increases substantially in the case of more pronounced noise.
According to Table 2, even for the promising case with q = 3 qubits per risk factor, the typical noise levels distort the estimations and-given relative errors easily exceeding ±25%-render them essentially unusable.

Conclusion and outlook
The study investigates the feasibility of implementing real-world risk measurement applications on quantum computers. Typical use cases in financial institutions such as banks require large-scale solutions with usually several thousands of risk factors. The core challenge is to project those at one or over several future time points and revalue portfolios of instruments accordingly. Extending previous research, this paper contributes a feasibility analysis with respect to running realistic market and counterparty credit risk applications on quantum devices.
On a conceptual level, modelling risk factors and simulating their joint behaviour that ultimately determines the relevant distributions for risk measurement is feasible. The single-horizon nature of a market risk measure renders the setup more accessible than for the case of counterparty credit risk, which demands multiple, longer-term projections. Moving away from idealised normal distributions and potentially even a linear dependence structure amongst risk factors is achievable.
The central limiting aspect from a practical angle is the far too-limited capacity in terms of available qubits on real-world devices that would be necessary to reflect the large set of required risk factors with sufficient accuracy and across multiple forecasting horizons. Specific optimisations such as in-place additions of risk factors are possible, but this does not materially address the limitation. A secondary though still important aspect is quantum noise: even for basic examples of VaR and PFE calculations, the accuracy of risk estimations is quickly downgraded beyond a tolerable level. Loading realistic probability distributions to quantum registers and representing non-trivial payoffs and pricing functions are additional obstacles.
In the current 'noisy intermediate-scale quantum' (NISQ) era, the path to real-world applications in risk measurement depends heavily on progress in the various active Fig. 13 Influence of 'noise' in the counterparty credit risk example. When adding 'noise' of 0.1% to all one-and two-qubit gates in the quantum circuit as well as for the final measurement, a shows the influence on the CDF for a horizon of t = 1 (years) and q = 3 (qubits) for both risk factors. b illustrates how different levels of noise translate into errors in the estimation of typical PFE quantiles areas of quantum research. Besides the hardware and its accessibility, error control and mitigation are essential topics to be addressed. Hereby, the trade-off between model and circuit complexity on one side and acceptable measurement error tolerance on the other side need to be operationalised for practical use. The optimal interaction between CPU, GPU and QPU is another field for further exploration, specifically for risk applications. In [89], three critical attributes for quantum computing performance are put forward-quality (measured by quantum volume), speed (measured by circuit layer operations per second), and scale (measured by number of qubits). The ultimate aim is to define holistic benchmarks that capture all system components, are appropriate for real-world applications, without being too cumbersome to execute and difficult to interpret.
Overall, the analysis evidences that the number of qubits available on current hardware, and even within quantum simulators, is still far too low to render an actual business application viable. This constraint might be eased in the not-too-distant future, however, based on claims that hardware with more than 1,000 qubits are deemed achievable by 2023 [34]. Nevertheless, only once the stated target of 1,000,000 qubits on a fault-tolerant quantum computer by 2029 is reached [17], at least certain computationally intensive algorithms and applications from the financial engineering world might be routinely handled with quantum hardware.
Given the comparatively new technology, applying quantum computing-especially in established areas such as risk measurement-will face certain scepticism at the beginning. This is even more relevant when also applied for calculating regulatory capital requirements and, as such, demanding approval from supervisors. The initial enthusiasm by banks is already wearing a bit thin meanwhile, given that ready-to-use technology is still a long way off [22]. The business case from a computational angle is not very strong in areas such as market and counterparty credit risk since running 'traditional' calculations even in large financial institutions is currently a matter of minutes or at most a few hours. A quadratic speed-up of Monte Carlo simulations is hence not removing major obstacles. The pricing of derivatives, even complex ones, has already been established in principle by now-with promising short-term feasibility [18]. However, the commercial need for a large-scale roll-out is not apparent even here, given that the speed-up is ultimately limited and that latency for non-vanilla derivatives is not a significant concern in practice. The same might not be true for so far intractable problems such as portfolio optimisation, which are therefore more suitable contenders for a first wave of real-world (risk) applications.

Data availability
The stock prices used in the study are publicly available (Yahoo! Finance).
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.