BQ-Bank: A Quantum Software for Finance and Banking
The power of quantum computing may bring a revolution in finance and banking. Here, we present quantum software, BQ-Bank for option pricing, Value at Risk, portfolio optimization, and others. BQ-Bank can be run on a real quantum computer such as superconducting system or on an emulation system based on a classical computer with an interface. BQ-Bank, such as other quantum types of software, represents a new generation of the toolbox that likely brings disruptive innovations to the financial industry and banking market in the future. BQ-Bank also provides the classical Monte Carlo solution, so that users can compare their quantum results with classical ones directly. Our simulation results for a variety of examples show the superiority of quantum solutions.
Based on quantum physical principles, such as quantum superposition and quantum entanglement, quantum computers [1, 2] can provide unprecedented powerful computational capabilities. Compared with classical algorithms, quantum algorithms possess tremendous speedup in solving certain problems, such as Shor’s algorithm  for integer factorization, Grover’s algorithm [4, 5] for unsorted database search, and Harrow–Hassidim–Lloyd (HHL) quantum algorithm  for linear systems of equations.
Quantum computers are expected to have a substantial impact on the financial industry and banking market [7, 8]. Financial institutions such as J. P. Morgan Chase, Barclays Bank, and Goldman Sachs Group have already established collaborations with quantum computing companies such as IBM and Amazon to explore the use of quantum computing in finance. Spanish bank CaixaBank has also joined hands with IBM to develop a financial asset risk analysis simulation project. Canada’s BMO Financial Group and Scotiabank have partnered with Australian quantum computing startup Xanadu to develop quantum Monte Carlo algorithms to improve the efficiency of financial transactions and optimize real-time pricing. Recently, Everbright Technology, together with the Beijing Academy of Quantum Information Sciences and Boson Quantum Technology, has released a quantum portfolio product–Tiangong Jingshi (https://finworld.qboson.com) quantum computing quantitative strategy platform.
On the one hand, the concept of quantum computing can be mysterious to the general public, and performing quantum algorithms requires prior knowledge for people in the finance and banking sectors and is beyond their capabilities on their own; this limits the desire of the public to explore in the quantum computing world; on the other hand, experts in quantum computing are interested in how quantum computing can apply in the industry such as finance and banking but do not know how to realize them.
Here, we report a quantum software platform designed for the finance and banking industry, Biwon Quantum Bank (BQ-Bank) (http://biwonq.baqis.ac.cn/#/pages/finance). It includes four commonly used modules in finance and banking: option pricing, option revenues, Value at Risk (VaR), and portfolio optimization. With the graphical interface and preset data, one can access and use the previous four modules without any prior knowledge of quantum computing, helping the public especially financial workers to learn and perform applications of quantum computing in finance.
In this section, we present quantum algorithms that are required in finance and banking, and demonstrate how they are harnessed to solve problems in the modules. In each module, we first offer detailed descriptions of the problem and models, then introduce the solution with conventional classical methods of simulation, and a quantum solution. Finally, we compare the results of the conventional method with its quantum counterpart. More specially, in subsections 2.1 and 2.2, we introduce how quantum amplitude estimation algorithm can apply to calculating option pricing and VaR; and in subsection 2.3, we give a simple description of quantum approximate optimization algorithm (QAOA), a method that is believed to be adaptive to current noisy devices.
2.1. Option Pricing and Revenues
2.1.1. Black-Scholes Option Pricing Model
An option is a right for the buyer in a contract, who can choose whether to exercise the right or not. Therefore, the option buyer needs to pay a certain price to the option seller for the option right. The price of option buying and selling is often determined by the option market exchange, which reflects the entire option market’s assessment of the future price trend of the underlying asset. However, such a method is often not that efficient, and options market prices often fail to reflect their actual prices, especially in markets with smaller volumes. So, we need a price to guide options trading. On the other hand, a large number of speculators in the market need to evaluate the difference between the market price of the option and its actual value, to invest in option buying and selling.
The research on option pricing can be traced back to the year 1900, when French financial expert Laures Bachelier discussed option pricing in his doctoral dissertation . Since then, various option pricing models have been proposed, such as the binomial option pricing model [10, 11], trinomial option pricing Model , and Black-Scholes option pricing model . Among these, the Black-Scholes model is the most widely known, which was proposed by Fisher Black and Myron Scholes and furthermore developed by Robert Merton.
Generally, to use the Black-Scholes model to estimate the price of an option, say, European-style call and put option, some assumptions shall be made, such as the revenues of the underlying asset follows a normal distribution, the risk-free rate is constant, and investors can borrow unlimitedly at this rate, (more details can be found in “Section I: Option Pricing and Black-Scholes Model” of the supplementary material from section VIII of the main manuscript.)
(1) Call Option. The equation for pricing a call option based on the Black-Scholes model has the following form:where is the call option price, is the current price of the underlying asset, is the standard normal cumulative distribution function, is the exercise price, is the risk-free interest rate, is the time of option expiration, and and are given as follows:where is the standard deviation of the stock’s returns.
(2) Put Option. The equation for pricing a put option based on the Black–Scholes model represented by the previous same parameters can be expressed as follows:where is the put option price.
A classical simulation method for calculating the option pricing value is Monte Carlo simulation, which is widely used for dealing with uncertainty in many aspects of business operations. In option pricing, Monte Carlo simulation can be used for sampling estimation to calculate the value of an option with multiple sources of uncertainties and random features.
2.1.2. Quantum Solution
Now, we show a quantum option pricing algorithm, as a quantum version of Monte Carlo solution to the option pricing problem. Considering European-style options, the procedure of the typical quantum algorithm for option pricing is as follows:(1)Generate expiration date prices for the underlying asset by a stochastic process(2)Calculate revenues of the option at each price (3)Obtain the averaged revenues on the expiration date in a risk-neutral world:(4)Calculate its present value which is the option price, where is the risk-free interest rate and is the option expiration date.
The quantum option pricing algorithm starts with generating the quantum state of the option revenues and the underlying asset distribution on the expiration date. Then, the quantum amplitude estimation algorithm [14–17] (QAE, for more details, see “Section II: Quantum Amplitude Estimation” in the supplementary material from section VIII of the main manuscript.) is utilized to obtain the option price.
Now, we explain how the QAE algorithm is used for option pricing. By applying an operator to an qubit system initialized in , the final quantum state readswhere can be encoded as the option price, represents the revenue of option contracts at price , and stands for the probability distribution of price . Let be the probability of the -th qubit staying in state , the value of can be estimated by the QAE algorithm as follows:which is the expected value of the option on the expiration date in (4).
The previous equation shows how to obtain option value with the QAE algorithm in a simplified way; a more detailed and accurate procedure lists are as follows: Step 1. Under the assumption of random walk theory, the price distribution of the underlying asset at the option expiration date is After sampling and discretizing of the distribution into , they are encoded into the amplitudes of a certain qubit basis, and the corresponding state can be efficiently prepared by parameterized quantum circuits : where corresponds to the price in (7). Step 2. For the revenue function of in the case of call option, the revenue function can be divided into two parts, and . This is achieved by adding an extraqubit (the -th qubit) to the system, distinguishing the two parts with and of the -th qubit, respectively. Step 3. By encoding the revenue function into a special function which satisfies and adding an ancillary qubit initialized in state , the first qubits can be used as control qubits to rotate the ancillary qubit as an angle in a function of as follows: Step 4. After the measurement, we obtain the probability for which the -th qubit and the ancillary qubit both in state
As we know, the function can be approximated as while approaches zero. Thus, when the value of is small enough, the following approximation is valid:
Now, it is clear that can be calculated with the probability , and it follows that the result value of current option is also on a silver platter.
2.1.3. Examples and Results
In the previous subsection, one see that quantum computing plays an important role in option pricing. However, for the general public, due to the mysteriousness of quantum computing itself, and it is neither easy nor practical to learn quantum computing and quantum programming. To overcome this problem, we have established a BQ-Bank web page, which provides software applications related to option pricing with a friendly user interface. We illustrate our modules for option pricing and option revenues with concrete examples.
(1) Option Pricing. The user interface for the quantum option pricing module of European-style is shown in Figure 1. In this user interface, we provide six main inputs as follows:(1)The current market price of the underlying asset(2)The option contract’s valid period(3)The risk-free interest rate(4)The annualized volatility(5)The option exercise price(6)The choosing option of call or put options
In the backend, we provide three algorithms to calculate the option price as follows:(1)Black–Scholes model(2)Quantum algorithm(3)Classic Monte Carlo algorithm
In conducting option pricing with the quantum algorithm, the users need to input the number of qubits (denoted with ) in the user interface. For the convenience of comparison, the sampling number of the classic Monte Carlo algorithm is set to . After clicking the execution button, the calculation result is shown in Figure 2, with respect to the standard value shown by the Black–Scholes model, and the result of option pricing from the quantum algorithm is better than that from the classical Monte Carlo algorithm. Because of the randomness involved in both algorithms, the results will vary slightly from run to run.
(2) Option Revenues. Due to the discrepancy between the option price calculated by the theoretical model and the option price in the real market, speculators can arbitrage by buying and selling options. An application for calculating the expected option revenues strategy is also integrated into BQ-Bank, and the quantum algorithm in the backend is still based on the previous quantum option pricing algorithm. Specifically, this module calculates the expected option revenues portfolio by estimating the price of each option with a quantum option pricing algorithm and comparing it with the option market price.
Similar to the inputs of option pricing, one can find the user interface for calculating expected option revenues in Figure 3. In addition to four inputs (i.e., the current market price of the underlying asset, the option contract’s valid period, the risk-free interest rate, and the annualized volatility of the asset), there are also other user input parameters required to construct an option portfolio. For example, to add another pattern of options by clicking the “+” sign icon at the end of its option input line, and to delete one pattern of options by clicking its respective “trash can” icon. Each pattern of options contains the option for call/put option, the option for buying/selling options, its exercising price and the option fee.
After executing the calculation, the result is shown in Figure 4. From the figure, we can get the estimated value of the expected revenues obtained by the three algorithms for the option portfolio we set. With respect to the standard value shown by the Black-Scholes model, the result with the quantum algorithm is better than the classical Monte Carlo algorithm’s. Also, due to the randomness involved in both algorithms, the results will vary slightly from run to run.
2.2. Value at Risk (VaR)
2.2.1. Classical Solution
VaR is a parameter used to assess investment losses , and is often used as a risk measure of risk management. A more specific definition gives that the value of the maximum expected loss of an asset portfolio due to market price changes within a given confidence interval during the holding period, as depicted in Figure 5, takes the form ofwhere is the profit and loss distribution (note the loss value is negative and the profit value is positive), is the given probability, and is its cumulative distribution function.
There are three kinds of classical VaR algorithms, namely, Historical VaR (H-VaR), Parametric VaR (P-VaR), Monte Carlo VaR (MC-VaR) . However, these algorithms rely on different assumptions, so that their final VaR values are often different.
(1) H-VaR. When we have a certain amount of historical data in our hands but do not know the probability distribution of asset losses, we can assume that the asset’s future losses and gains are merely repetitions of past situations. Then, we use the VaR of the historical data to estimate the future VaR. The specific method is to sort the historical data by size, and determine the position of VaR in the sorting according to the product of the probability and the size of the historical data.
(2) P-VaR. If we assume that the asset’s loss distribution follows a normal distribution, we can use historical data to estimate the mean and variance of the normal distribution, then use the normal distribution function to calculate the VaR at the probability .
(3) MC-VaR. Here, we use the Monte Carlo method to simulate future asset market changes. A variety of risk factors need to be considered in the simulation process, which makes the simulation methods diverse and difficult. Among them, the geometric Brownian motion model is relatively simple. In the process of computer simulation, the geometric Brownian motion discrete model iswhere is the price of the asset at time , is the first-order difference of the prices, is the mean value of historical returns, is the standard deviation of historical returns, and is the unit time of returns. In the MC-VaR method, we randomly select according to the normal distribution at each step of the time evolution of the asset holding period, so as to calculate sampling points on the expiration date.
2.2.2. Quantum Solution
In this subsection, we show how the QAE algorithm applies in calculating VaR [21, 22]. We discretize a random variable and then map it into a qubit system , where is the number of sampled qubits, so any random variable can be represented by a quantum state with probability in state :
Consider a quantum operation acting on sampling qubits and an ancillary qubitwhere function . Similar to (5), we can get the following equation:
Employing the QAE algorithm, we can obtain the quantum state probability with the ancillary qubit in state .
If we define function as
Equation (19) can be rewritten as
Thus, we can get the probability of the ancillary qubit in state , . When , there exists , which means is the VaR with a confidence of and a precision of , showing the quantum algorithm has a quadratic speedup compared to the classical MC-VaR method .
2.2.3. Examples and Results
Now, we show how three different classical VaR algorithms, H-VaR, P-VaR, and MC-VaR, and our quantum algorithm perform for the same instance. As we can see, in the case studied in Figure 6, we choose the normal distribution as our model, 0.95 confidence and 30 holding days of assets which are combined of two assets, China Bao An and Ping An Bank with 10 of each are purchased.
The results for both classical and quantum methods in different sampling points are shown in Figure 7, where we see that H-VaR and P-VaR are independent of the sampling points, which is quite intuitively obvious since both are calculated mainly based on historical data of assets without any sampling. As to MC-VaR, its VaR approaches to P-VaR with sampling points increasing, and even at 512 sampling points, there are still a small difference between P-VaR and MC-VaR. While the VaR with quantum algorithm approaches P-VaR monotonically with sampling points increasing and at 32 or larger sampling points, the VaR with the quantum algorithm is exactly equal to P-VaR. As the result shown in this instance, the VaR with the quantum algorithm is closer to P-VaR than that with the Monte Carlo method at the same sampling point, and we argue that the quantum algorithm performs better than the Monte Carlo method.
2.3. Portfolio Optimization
Portfolio optimization  is an important problem that many investors will encounter. It requires investors to invest in candidate financial assets in order to minimize the risk under the condition of a certain return or maximize the investment return under the condition of a certain risk. If the number of candidate assets is very large, the classical algorithms used to solve such problems usually have high time complexity and are difficult to implement. Thanks to the powerful computing performance of quantum computing, the quantum algorithm can give the portfolio of assets with the optimal budget number among the candidate assets .
We use the mean-variance combinatorial optimization method, and the model for this problem can be expressed aswhere(i) in quantum algorithms represents the vector of binary decision variables. If the asset is purchased, and when not. in classical algorithms is the weight of purchasing the corresponding asset, and .(ii) represents the expected return of each asset.(iii) represents the covariance between the expected returns of each asset.(iv) is the risk factor, which indicates the investor’s investment risk preference.(v)1 represents a -dimensional vector whose elements are all 1 s.(vi) represents the investment budget, which is the number of assets purchased from assets in quantum algorithms case (assuming the price of each asset is 1). Usually, in classical algorithms case.
2.3.2. Quantum Solution
According to the equation of the problem model in (22), the loss function is given as follows:in which the first term represents the risk of the investment, the second term is the return of the investment, and the last term is a penalty function with as the penalty parameter and is usually set large.
Our portfolio optimization scheme uses a combination strategy of classical and quantum methods. First, it uses quantum algorithms to select the optimal portfolio of assets with a budgeted number of candidate assets. Then, it uses classical algorithms to calculate the assets selected by quantum algorithms (i.e., QAOA). Finally, it predicts the optimal strategy of purchasing assets and achieves maximum returns. With the aid of quantum algorithm, we can filter out the assets that do not need to be purchased, and the difficulty in implementing the classical algorithm is greatly reduced.
QAOA [25, 26], which can be classified as a variational quantum algorithm (VQA) [27, 28], is a quantum algorithm with a wide range of applications in the recent Noisy Intermediate-Scale Quantum (NISQ)  era. QAOA was proposed by Edward Farhi et al. in 2014 to approximately solve the combinatorial optimization problems. For a combinatorial optimization problem, which can be defined by a binary string of bits , the aim is to determine the string that minimizes or maximizes the classical objective function .
QAOA can transform a combinatorial problem into an optimization problem. By mapping the binary variables into quantum spin operators , the classical objective function can be changed into a quantum Hamiltonian:whose ground state corresponds to the optimal solution of the problem.
In the case of QAOA with layers, we usually initialize the state of the quantum system as and then alternately act the problem Hamiltonian and the mixed Hamiltonian on the quantum system as follows:which results in a wave function with variational parameters as follows:
The expected value of under this variational wave function can be obtained by measuring the quantum system:then, solve the optimal parameter on a classical computer, achieving
In the ideal case, the quantum state should be the optimal solution, but it should be noted that the depth of a parameterized quantum circuit is not infinite, so it is likely that
So, contains only the approximate optimal solution. Suppose is a superposition of computational basis states, i.e.,
Usually, the greater of the probability that the ground state is measured in the eigenstate of , the greater of the probability that its corresponding bit string is the optimal solution.
2.3.3. Examples and Results
In conducting portfolio optimization with quantum algorithms, we made two assumptions about the problem to simplify the model:(1)All assets should have the same price (assumed to be 1)(2)The given budget should be an integral multiple of the price of an asset, and it needs to be all used for investment, which means that assets need to be purchased
In this case, the portfolio optimization problem under these two assumptions corresponds to choosing a subset of assets from assets. We need to convert the loss function shown in (23) into a Hamiltonian to complete the encoding of the portfolio optimization problem. Because the value of the binary variable (0 or 1) indicates whether the asset needs to be purchased, we need to construct a Hamiltonian whose eigenvalues corresponding to them. Since the eigenvalue of the Pauli operator is , we can construct the Hamiltonian as , which corresponds to two eigenvalues 0 and 1. So, one can use the mapping to convert the loss function into a Hamiltonian whose ground state corresponds to the optimal solution of the portfolio optimization problem.
As mentioned previously, we use a variational quantum algorithm, especially QAOA, to approximately solve the ground state of a Hamiltonian. Here, we list the procedure how we solve the portfolio optimization problem with QAOA and other algorithms:
(1) Preparation. For each candidate asset , given its preferred maximum share and minimum share (where ) of the combinatorial assets, purchased assets budget , risk factor , and historical period of all candidate assets , as shown in Figure 8.
(2) Assignment. When the minimum share of an asset satisfies , it means the asset will definitely be purchased and will be assigned into the assets set , and the total number of the assets set is defined as . Else when , the asset needs to be determined by QAOA whether it needs to be purchased or not, and which asset will assigned into another assets set .
(3) Optimal Selection with QAOA. Since there are already assets that have been determined to be purchased for sure, only assets need to be selected from the set using QAOA. According to the mapping , the loss function can be converted into a systematic Hamiltonian with qubit number , and the ground state of this Hamiltonian is the optimal solution, where the mixing Hamiltonian is .
The following procedure is divided into two parts:(i)Quantum Part. Prepare a variational state on a quantum computer, where , and then obtain the expectation of Hamiltonian .(ii)Classical Part: Update with the classical optimization algorithm, such as COBYLA, and go back to the quantum part until approximately reaches a minimum. The optimal combination of assets to be purchased, as defined , is obtained from the variational state at this point, and the optimal combination of assets to be purchased is .
(4) Proportion Optimization. Finally, a trust-constr constraint algorithm is used to give the optimal proportion of the assets in the optimal portfolio to the constraints of every asset as assigned in the preparation step. Figure 9 shows the optimal result of an input example corresponding to Figure 8, including the optimal portfolio and its corresponding history return curve.
We have developed a quantum software BQ-Bank, which comprises 4 modules: option pricing, option revenues, VaR, and portfolio optimization. In each module, we start with the underlying problems and models, then we discuss the conventional algorithms and their quantum solution, and at the end we take an example and compare the results of the conventional algorithms with their quantum solution. The results show that the quantum solution usually outperforms the conventional algorithms. With the succinct design and the preset data set of BQ-Bank, people with or without quantum background can access and complete their interest tasks on a silver platter without trained skills.
The data sets generated and/or analyzed during the current study are available from the corresponding author upon reasonable request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
The authors would like to thank Dr. Zai-sheng Lin for helpful discussions. This work was supported by the National Natural Science Foundation of China (Grant nos. 12004206 and 12005015).
For details of the Black–Scholes model and the Quantum Amplitude Estimation algorithm, see the supplementary material. (Supplementary Materials)
B. Paul, “The computer as a physical system: a microscopic quantum mechanical Hamiltonian model of computers as represented by turing machines,” Journal of Statistical Physics, vol. 22, no. 5, pp. 563–591, 1980.View at: Google Scholar
R. P. Feynman, “Simulating physics with computers,” International Journal of Theoretical Physics, vol. 21, no. 6/7, 1982.View at: Google Scholar
P. W. Shor, “Algorithms for quantum computation: discrete logarithms and factoring,” in Proceedings of the 35th annual symposium on foundations of computer science, pp. 124–134, IEEE, Santa Fe, NM, USA, November 1994.View at: Google Scholar
A. Scott and P. Rall, “Quantum approximate counting, simplified,” in Symposium on Simplicity in Algorithms, vol. 24, 32 pages, SIAM, 2020.View at: Google Scholar
Y. Yamai, T. Yoshiba et al., “On the validity of value-at-risk: comparative analyses with expected shortfall,” Monetary and Economic Studies, vol. 20, no. 1, pp. 57–85, 2002.View at: Google Scholar
G. Paul, P. Heidelberger, and P. Shahabuddin, “Efficient Monte Carlo methods for value-at-risk,” Mastering Risk, vol. 2, pp. 5–18, 2000.View at: Google Scholar
D. Durand, “Portfolio selection: efficient diversification of investments,” The American Economic Review, vol. 50, no. 1, pp. 234–236, 1960.View at: Google Scholar