View on GitHub
Open this notebook in GitHub to run it yourself
Rainbow Options with Direct Amplitude Loading
This notebook covers the implementation of the Direct Amplitude Loading Method for the rainbow option presented in [1]. 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, though 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:Direct Method
The direct exponential amplitude loading encodes in the following function: where is the binary complement of () and , the maximum value that can be stored in the register. For loading , the is initialized to all zeros. One controlled rotation for each qubit is performed. The rotation angles are . All the probabilities of getting a in the are then collected by a multi-controlled X (MCX) gate and stored in the state of a target qubit.Output:
Iterative Quantum Amplitude Estimation (IQAE) Algorithm
Output:
Post-process
Add a term to the post-processing function:Run Method
Output: