View on GitHub
Open this notebook in GitHub to run it yourself
Rainbow Options with Brute-force Methodology
This notebook covers the implementation of the rainbow option using Qmod. The role of the notebook is to verify the result of a different methodology on a small scale problem, as it grows exponentially in the gate count. In finance, a crucial aspect of asset pricing pertains to derivatives. Derivatives are contracts whose value is contingent upon another source, known as the underlying. The pricing of options—a specific derivative instrument—involves determining the fair market value (discounted payoff) of contracts that afford their holders the right, although not the obligation, to buy (call) or sell (put) one or more underlying assets at a predefined strike price by a specified future expiration date (maturity date). This process relies on mathematical models, considering variables such as current asset prices, time to expiration, volatility, and interest rates.Data Definitions
The problem inputs:NUM_QUBITS: the number of qubits representing an underlying assetNUM_ASSETS: the number of underlying assetsK: the strike priceS0: the arrays of underlying asset pricesdt: the number of days to the maturity dateCOV: the covariance matrix that correlates to the underlyingsMU_LOG_RET: the array containing the mean of the log return of each underlying
Gaussian State Preparation
Encode the probability distribution of a discrete multivariate random variable taking values in describing the asset prices at the maturity date. The number of discretized values, denoted as , depends on the precision of the state preparation module and is consequently connected to the number of qubits () according to the formula :Sanity Check
To avoid meaningless results, the process must stop if the strike price is greater than the maximum value reacheable by the assets during the simulation. In this case, the payoff is , so there is no need to simulate:Maximum Computation
Precision Utils
Affine and Maximum Arithmetic Definitions
Considering the time delta between the starting date () and the maturity date (), express the return value for the -th asset as where , being the expected daily log-return value. It can be estimated by considering the historical time series of log returns for the -th asset. is obtained through the dot product between the matrix and the standard multivariate Gaussian sample: is the Gaussian discretization step, is the lower Gaussian truncation value, and is the sample taken from the -th standard Gaussian. is the entry of the matrix , defined as , where is the lower triangular matrix obtained by applying the Cholesky decomposition to the historical daily log-return correlation matrix:Brute-Force Amplitude Loading Method
This type of amplitude loading has an exponential scale, and is therefore used as a “sanity check” method for validating the result from the direct method and integration method that are part of the paper [1].Output:
Output:
Iterative Quantum Amplitude Estimation (IQAE) Algorithm
Output:
Output:
Post-process
Add a term to the post-processing function:Run Method
Output: