Skip to content

floflo777/quantum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantum Option Pricing

CI License: MIT Python Qiskit

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.

Overview

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_T is the underlying asset price at maturity
  • K is 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.

Theoretical Background

Black-Scholes Framework

The project operates within the Black-Scholes framework with parameters:

  • S0: Initial stock price
  • K: Strike price
  • T: Time to maturity
  • r: Risk-free interest rate
  • sigma: Volatility

Quantum Approach

The quantum algorithm encodes the problem as follows:

  1. Probability distribution loading: Store the log-normal distribution of final prices in quantum amplitudes
  2. Payoff encoding: Use controlled rotations to encode the affine payoff function
  3. Comparison circuit: Implement quantum comparators to handle the max(0, ...) operation
  4. Amplitude estimation: Apply QAE to extract the option price from the quantum state

Project Structure

quantum/
├── Source/
│   └── quantum_pricing.ipynb    # Main implementation notebook
├── README.md
└── LICENSE

Components

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

Requirements

  • Python 3.8+
  • Qiskit >= 1.0
  • qiskit-aer
  • qiskit-algorithms
  • NumPy
  • SciPy
  • Matplotlib

Installation

git clone git@github.com:floflo777/quantum.git
cd quantum
pip install qiskit qiskit-aer qiskit-algorithms numpy scipy matplotlib

Usage

Open the Jupyter notebook and execute cells sequentially:

jupyter notebook Source/quantum_pricing.ipynb

The notebook includes:

  1. Classical Black-Scholes pricing for validation
  2. Monte Carlo simulation comparison
  3. Step-by-step quantum circuit construction
  4. Final integration and QAE evaluation

Results

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 encoding
  • num_stddev: Range of the price distribution
  • epsilon_target: QAE precision parameter

References

  • 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

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors