Financial institutions deal daily with a spectrum of computationally intensive challenges. These include for example forecasting tasks, such as pricing and risk estimation, detecting anomalous transactions, analysing customer preferences and optimization problems like portfolio selection, devising optimal trading strategies, and hedging. Even if the relentless advancement in mathematical finance and computational science, fueled by both the financial industry and the scientific community, has armed institutions with a sophisticated toolkit (stochastic modelling, advanced optimization algorithms, and machine learning models) to tackle these problems, the complexity and volume of financial data continue to push the limits of computing.

This has sparked a surge of interest in quantum computing within both academic and industrial circles and this computing paradigm, with its fundamentally different approach to processing information, is believed to offers the potential to revolutionize problem-solving in finance in both the long and near term.

This field of research is often referred to as Quantum Finance, and this blog post marks the first in a series dedicated to the topic. In particular, this article discusses the speedup quantum computers can provide to an extremely important financial task: option pricing.

## Options

Options are financial derivatives that give the buyer the right, but not the obligation, to buy (call option) or sell (put option) an underlying asset at a predetermined price (called the strike price) within a specified time frame, after paying a premium for this right. The concept of options dates back to ancient Greece, where contracts resembling options were used for olive harvests by Thales of Miletus. However, the modern options market was established in 1973 with the creation of the Chicago Board Options Exchange, which standardized option contracts and brought greater transparency and accessibility to options trading.

Options play a pivotal role in financial markets for several reasons. They allow investors to hedge against potential losses in other investments, provide opportunities for speculation on the future direction of asset prices (buying a call (put) option represent a long (short) strategy), and offer ways to enhance portfolio returns through strategies like covered calls or protective puts.

There are various types of options, each with unique characteristics. The two primary categories are European and American options. European options can only be exercised at the expiration date, making their pricing models simpler and often less expensive. In contrast, American options can be exercised at any point up to and including the expiration date, offering greater flexibility but also more complex pricing models due to the additional considerations of when the option might be exercised. Options can also be categorized as vanilla or exotic. Vanilla options refer to the standard call and put options with straightforward payoff structures. These are the most common types of options traded. In contrast, exotic options, or non-vanilla options, have more complex features and payoff structures. Examples include:

**Barrier Options:**Options that are activated or extinguished if the underlying asset reaches a certain price**Asian Options:**Options where the payoff depends on the average price of the underlying asset over a specific period, rather than the price at expiration**Lookback Options:**Options that allow the holder to "look back" over time to determine the optimal exercise price.

Beyond this complexity, accurate pricing of options is crucial for maintaining fair trading practices, effective risk management, and overall market stability. Inaccurate pricing can in fact introduce significant risks, as it may lead to arbitrage opportunities where traders exploit price discrepancies for guaranteed profits, potentially causing market imbalances. Additionally, mispricing can result in inadequate hedging strategies, exposing investors and financial institutions to unforeseen losses and undermining confidence in the financial system. Thus, precision in option pricing is essential to mitigate these risks and ensure the smooth functioning of financial markets.

## Classical strategies for Option Pricing

Option pricing fundamentally depends on projecting the future value of the underlying asset, as the option's worth is derived from the underlying asset's price movements. To accurately price an option, it's essential to understand how the underlying security might evolve over time. Three primary factors influence the pricing of an option: the current price of the underlying asset, the time value of the option, and the implied volatility of the underlying asset:

**The price of the underlying asset**is the most critical factor affecting the option's premium. The premium reflects the right to buy or sell the underlying asset, and a higher-priced asset demands a higher premium compared to a lower-priced asset. This ensures that investors have sufficient incentive to purchase options on assets with varying price levels**The time value**of an option pertains to the duration between the purchase date and the option's expiration date. The longer the time until expiration, the higher the chance that the underlying asset will reach the strike price, making longer-term options more expensive than shorter-term ones with the same strike price**Implied volatility**is another crucial component in option pricing. As the perceived volatility of the underlying asset increases, so does the option's price. This is because higher volatility means a greater potential for significant price swings, offering more opportunities for profit to the option holder but also posing higher risk to the seller. Consequently, the seller demands a higher premium to compensate for this increased risk.

### Black-Scholes-Merton model

One of the most famous approach to pricing involves taking advantage of the stochastic nature of financial markets and modelling their dynamics with a formula we can analytically solve. Given the appropriate assumptions, this approach results in the famous Black-Scholes-Merton model:

$$C = S_0 N(d_1) - K e^{-rT} N(d_2)$$

where:

\(C\) is the price of the European vanilla call option

\(S_0\) is the price of the underlying asset

\(K\) is the strike price of the option

\(r\) is the risk-free interest rate

\(T\) is the time to maturity of the option

\(N\) is the cumulative distribution function of the standard normal distribution

\(d_1 = \frac{\ln\left(\frac{S_0}{K}\right) + \left(r + \frac{\sigma^2}{2}\right)T}{\sigma \sqrt{T}}\)

\(d_2 = d_1 - \sigma \sqrt{T}\)

The model however has some limitations, including assuming an arbitrage-free market, constant \(r\) over time, a constant volatility of the underlying asset over time, stocks not paying dividends, market being frictionless (no taxes and no transaction costs) to name a few. Because of these drawbacks, there are alternative analytical approaches to option pricing that address some of the unrealistic assumptions.

### Monte Carlo methods

What I want to discuss a little further however are the Monte Carlo methods, as the quantum approach to option pricing discussed below is, in many ways, a quantum analogue of the Monte Carlo pricing method.

Basically, Monte Carlo methods involve simulating a large number of possible paths that the underlying asset price might take over the life of the option. These simulations use random sampling to model the stochastic processes that govern asset price movements and each simulated path is used to calculate the payoff of the option. The average of these payoffs is then discounted back to the present value to obtain the option price.

Therefore Monte Carlo method is made of 3 steps:

**Model specification**: define the dynamics of the stochastic process governing the underlying asset's price dynamics**Path simulation**: generate a large number of random price paths for the underlying asset using the specified stochastic process. The idea is that each path is a possible future trajectory of the asset's price**Payoff computation and discounting**: compute the payoff of the option for each simulated path and discount the payoff to the present value using the risk-free interest rate. Than compute the average of the discounted payoffs to estimate the option price.

The strength of the Monte Carlo approach lies in its versatility as a generic methodology, making it especially valuable when the Black-Scholes-Merton model is inapplicable, such as in the pricing of path-dependent options.

It is also possible to derive the convergence rate of the method which, thanks to Central Limit Theorem, is \(O(\frac 1{\sqrt{N}})\) where \(N\) is the number of simulated paths. This means that to reduce the error by half, one must increase the number of simulations fourfold.

## Quantum strategies for Option Pricing

As next section will discuss, the quantum analogue to the Monte Carlo methodology offers a convergence rate is \(O(\frac 1n)\), providing a quadratic improvement over classical methods. While this speedup may seem modest, it is particularly significant for hedge funds and institutional investors who price large portfolios of options, often overnight. Even a slight improvement in convergence rates in fact can translate into substantial computational time savings, amounting to many hours. The quantum analogue to Monte Carlo methods is, similarly to the classical counterpart, made by three steps:

representing the probability distribution of the random variable identifying the option's underlying and any other source of uncertainty

build a circuit that computes the payoff based on the random variable

compute the expected value of the payoff and discount the result (this can be done classically and I am omitting this part not being particularly complicated).

### Encoding the probability distribution in a quantum register

The fist step, loading the distribution of the random variable identifying the option's underlying and any other source of uncertainty (\(X\) from now on), requires a quantum circuit that given the \(\{S_i\}\) asset price and the corresponding probabilities \(\{p_i\} \) (assuming the state space is discretized into \(2^n\) states, where \(n\) is the number of qubits of the register) is able to create the following state:

$$\ket{\psi}n = \sum{i=0}^{2^n-1} \sqrt{p_i} \ket{S_i}$$

The efficiency of encoding a probability distribution into a quantum state depends on the nature of the distribution. It has been demonstrated that log-concave probability distributions, such as the log-normal distribution assumed by the Black-Scholes-Merton model, can be efficiently encoded into a quantum state if the distribution is log-normal. To load states that do not share this property, it is possible to exploit the power of quantum Generative Adversarial Networks (qGAN), which are able to load a distribution in \(O(\text{poly}(n))\) gates rather than \(O(2^n)\) gates. While the details are beyond the scope of this article, it's worth noting that qGANs (quantum Generative Adversarial Networks) are hybrid quantum-classical algorithms. They consist of a classical neural network, known as the discriminator, and a variational quantum circuit, known as the quantum generator. The training process of a qGAN involves alternating optimization of the discriminator's parameters (\(\theta\)) and the generator's parameters (\(\gamma\)). After the training process the output of the process is:

$$\ket{\psi(\gamma)}n= \sum{i=0}^{2^n-1} \sqrt{p_i(\gamma)}\ket{i}_n$$

where \(p_i(\gamma)\) approximates the underlying distribution of the training data.

### Computing the payoff

Once the distribution is loaded, we need to compute the payoff function \(f\). Being an option's payoff piecewise linear (depending on whether the option is exercised or not), we only need to consider function of the form:

$$f(i) = f_0 + f_1(i)$$

and by using controlled Y-rotations it is possible to efficiently create the following operator:

$$R: \ket{i}_n\ket{0} \rightarrow \ket{i}_n\otimes(cos[f(i)]\ket{0} + sin[f(i)] \ket{1})$$

which, applied on a register representing a previously encoded distribution, results in:

$$R_\ket{\psi}n= \sum_{i=0}^{2^n-1} \sqrt{(p_i)}\ket{i}_n \otimes (cos[\tilde f(i)]\ket{0} + sin[\tilde f(i)]\ket{1})$$

where \(\tilde f(i) = 2c \frac{f(i) -f_{min}}{f_{max}-f-{min}} - c + \frac \pi 4\), with \(c \in[0, 1]\) and \(f_{min}\) (\(f_{max}\)) is \(\text{min}_if(i) \) (\(\text{max}_if(i)\)).

Consequently, the probability of measuring \(\ket{1}\) in the second register is:

$$P_1 = \sum p_i \space sin^2(\tilde f(i))$$

which can be approximate (with a third grade truncation error) by

$$P_1 \approx \sum p_i (2c \frac{f(i) -f_{min}}{f_{max}-f-{min}}-c + \frac 12) = (2c \frac{E(f(i)) -f_{min}}{f_{max}-f-{min}}-c + \frac 12)$$

all the values are known but \(E(f(i))\). To compute the expected value of the payoff function, a quantum algorithm known as quantum amplitude estimation (QAE) is required.

### Quantum amplitude estimation

Quantum amplitude estimation is the algorithm responsible for providing the quadratic speedup compared to classical Monte Carlo methods. Basically, assuming an operator \(A\) s.t.

$$A\ket{0}_{n+1}: \sqrt{1-p}\ket{\psi_0}_n \otimes \ket{0}+ \sqrt{p}\ket{\psi_1}_n \otimes \ket{1}$$

where \(p\) is unknown. QAE aims to estimate \(p\), i.e. the probability of measuring \(\ket{1}\) in the second register.

The idea is to build the operator \(Q\) s.t.

$$Q = AS_0A^\dagger S_{\psi_0}$$

where:

\(S_0= 1- 2 \ket{0}\bra{0}\)

\(S_{\psi_0}= 1- 2 \ket{\psi_0}\ket{0}\bra{{\psi_0}}\bra{0}\), representing a rotation of \(2\theta_p\) grades w.r.t. to \(\text{span}(\ket {\psi_0}\ket{0})\)

and it can be shown that \(sin^2(\theta_p) = p\).

Therefore, applying quantum phase estimation (shown in the above picture) on \(m\) sampling qubits, i.e. applying an m-fold Hadamard gate, using the \(m\) qubits to control different powers of \(Q\), applying the inverse Quantum Fourier Transform and measuring the \(m\) qubits' state results in an integer \(k\). Also, there are other formulation of QAE that are more suitable to the NISQ era.

Then \(p\) is estimated as:

$$\hat p = \frac{k\pi}{2^m}$$

and such estimation is s.t. with probability of at least \(\frac 8{\pi^2}\) the following hold

$$|{p - \hat p}| \leq \frac \pi {2^m} - (\frac {\pi}{2^m})^2$$

with a convergence rate of \(O(\frac 1n)\) (while the convergence rate of classical Monte Carlo methods is \(O(\frac 1{\sqrt{N}})\)).

Therefore, applying the operator \(A\) to the state prepared by the qGAN results in:

$$A \ket{\psi}n= \sum{i=0}^{2^n-1} \sqrt{(1 -f(S_i)} \sqrt{p_i}\ket{S_i}n\ket{0} + \sum{i=0}^{2^n-1} \sqrt{f(S_i)} \sqrt{p_i}\ket{S_i}_n\ket{1}$$

and being the probability of measuring \(\ket 1\) (what we called \(p\) before)

$$\sum p_i f(S_i) = E[f(S_i)]$$

it is possible to recover the undiscounted expected value of the option's payoff, which allows to compute

$$P_1 \approx (2c \frac{E(f(i)) -f_{min}}{f_{max}-f-{min}}-c + \frac 12)$$

### Pricing Vanilla Options

Therefore, reviewing the entire process for a vanilla option, we have that the payoff function for a call option is \(f_c\) is:

$$f_c(S_T) = max(S_T - K, 0)$$

while for a put the payoff function \(f_p\) is:

$$f_p(S_T) = max(K-S_T, 0)$$

where:

\(S_T\) is the price at expiration date

\(K\) is the strike price.

We already discussed hot to represent the linear part of the function, while to implement the \(max(\cdot)\) operator, it is necessary to implement a comparison circuit \(C\) between \(S_T\) and \(K\) (implemented using an ancillary register, Toffoli gates and CNOTs) performing the following transformation

$$C\ket\psi_n\ket 0 = \ket \phi_n = \sum{i < K} \sqrt{p_i}\ket i_n\otimes \ket 0 + \sum_{i \geq K} \sqrt{p_i}\ket i_n \otimes \ket 1$$

To represent the payoff function for use in QAE, another ancillary qubit is required and (for a call vanilla option), we set

$$\tilde f(i) = \begin{cases} g_0 \space \text{if} \space K>i\\ g_0 + g(i)\space \text{if} \space K\leq i\end{cases}$$

where \(g(i)\) is a linear function and \(g_0\) is to be defined.

Doing so we are able to reconstruct the following state:

$$\begin{align} R\ket{\phi}n\ket{0} &= \sum_{i < K} \sqrt{p_i} \ket{i}n \otimes \ket{0} \otimes \left( \cos[g_0]\ket{0} + \sin[g_0]\ket{1} \right) \notag \\ &\quad + \sum_{i \geq K} \sqrt{p_i} \ket{i}_n \otimes \ket{0} \otimes \left( \cos[g_0 + g(i)]\ket{0} + \sin[g_0 + g(i)]\ket{1} \right) \end{align}$$

Using QAE, the probability of measuring \(\ket 1\) in the last qubit is

$$\sum_{i < K} p_i \space sin^2(g_0) + \sum_{i \geq K} p_i \space sin^2(g_0 + g(i))$$

At this point it is necessary to define both \(g_0\) and \(g(i)\). To ensure the following

$$\begin{cases}f(i) = i - K \\ \tilde f(i) = g_0+g(i) \end{cases}$$

we get \(g(i)=\frac{2c (i-K)}{2^n-1 - K}\) and \(g_0 = \frac \pi 4 - c\).

By substitution and approximating as above

$$\begin{align} P_1 & \approx \sum_{i < K} p_i (\frac 12 - c) + \sum_{i \geq K} p_i(\frac 12-c + \frac{2c (i-K)}{2^n-1 - K})\\ &=\frac 12-c + \frac{2c}{2^n-1 - K} \sum_{i \geq K} p_i(i-K) \end{align}$$

which is exactly \(E[f(i)]\) up to a constant and a scaling factor.

## Conclusion

While quantum computers and quantum finance are not yet fully realized, and the discussed quantum approaches to option pricing are not fully yet applicable, especially for complex probability distributions, it is possible to simulate these procedures using various software development kits (SDKs). For instance, Qiskit Finance offers comprehensive resources, including resources on pricing various types of options, which I highly recommend.

And that's it for this article. Thanks for reading.

For any question or suggestion related to what I covered in this article, please add it as a comment. For special needs, you can contact me **here**.