Implementation of a quantum circuit using Quantum Amplitude Estimation (QAE) to approximate European call option prices. This project demonstrates the application of quantum computing to financial derivatives pricing.
The goal is to design a quantum circuit that constructs a state where the amplitude encodes the expected payoff of a call option:
E[(S_T - K)_+]
Where:
S_Tis the underlying asset price at maturityKis the strike price- The subscript
+denotes the positive part
The Quantum Amplitude Estimation algorithm is then used to extract this value, representing the compounded price of the call option.
The project operates within the Black-Scholes framework with parameters:
S0: Initial stock priceK: Strike priceT: Time to maturityr: Risk-free interest ratesigma: Volatility
The quantum algorithm encodes the problem as follows:
- Probability distribution loading: Store the log-normal distribution of final prices in quantum amplitudes
- Payoff encoding: Use controlled rotations to encode the affine payoff function
- Comparison circuit: Implement quantum comparators to handle the
max(0, ...)operation - Amplitude estimation: Apply QAE to extract the option price from the quantum state
quantum/
├── Source/
│ └── quantum_pricing.ipynb # Main implementation notebook
├── README.md
└── LICENSE
The notebook implements several quantum circuits:
| Component | Purpose |
|---|---|
encode_affine_function |
Encodes affine functions using rotation gates |
make_comparator |
Quantum circuit for integer comparison |
make_distribution_circuit |
Loads probability distribution into quantum state |
integration |
Combines all components into the pricing circuit |
- Python 3.8+
- Qiskit >= 1.0
- qiskit-aer
- qiskit-algorithms
- NumPy
- SciPy
- Matplotlib
git clone git@github.com:floflo777/quantum.git
cd quantum
pip install qiskit qiskit-aer qiskit-algorithms numpy scipy matplotlibOpen the Jupyter notebook and execute cells sequentially:
jupyter notebook Source/quantum_pricing.ipynbThe notebook includes:
- Classical Black-Scholes pricing for validation
- Monte Carlo simulation comparison
- Step-by-step quantum circuit construction
- Final integration and QAE evaluation
The quantum algorithm approximates the Black-Scholes price with configurable precision. Key parameters affecting accuracy:
n: Number of qubits (determines price grid resolution)d: Scaling factor for affine encodingnum_stddev: Range of the price distributionepsilon_target: QAE precision parameter
- Stamatopoulos, N., et al. (2020). "Option Pricing using Quantum Computers"
- Woerner, S., & Egger, D. J. (2019). "Quantum Risk Analysis"
- IBM Qiskit Learning: Basics of Quantum Information
MIT