This repo is associated with the Financial Applications use case of the Machine Learning & Optimisation group of the NEASQC European project. Its primary focus is the development of the Python library Quantum Quantitative Finance Library (QQuantLib), which encompasses various state-of-the-art quantum algorithms and techniques tailored for the financial industry. Many of these contributions were developed within the project framework. The QQuantLib was programmed using the quantum software stack myQLM developed by EVIDEN.
The LICENCE
file contains the default licence statement as specified in the proposal and partner agreement.
The mandatory Python libraries and packages for using the QQuantLib can be found into the environment.yml file.
The Quantum Quantitative Finance Library is structured as a standard Python library within the QQuantLib folder. It is organized into several packages:
- Data Loading (DL) package: Located at QQuantLib/DL, this package comprises modules responsible for loading data into quantum circuits.
- Amplitude Amplification (AA) package: Found at QQuantLib/AA, this package contains modules for creating amplitude amplification (or Grover-like) operators.
- Phase Estimation (PE) package: Located at QQuantLib/PE, this package includes modules for phase estimation algorithms applicable in amplitude estimation procedures.
- Amplitude Estimation (AE) package: Situated in QQuantLib/AE, this package focuses on implementing various amplitude estimation algorithms.
- Finance package: Housed in QQuantLib/finance, this package implements modules for employing amplitude estimation techniques to solve financial problems.
- Quantum Machine Learning for VaR (qml4var): Located in QQuantLib/qml4var, this package focus on implementing mandatory workflow for building and training Parametric Quantum Circuits (PQC) that can be used as a surrogate models for complex and time-consuming financial distributions. The trained surrogate models can be used for risk analysis and VaR computations.
- QPU package: Located at QQuantLib/qpu, this package comprises modules for selecting different EVIDEN Quantum Process Units (QPUs) compatible with the QQuantLib library.
- Utils package: Positioned at QQuantLib/utils, this package contains multiple modules with utilities utilized across other packages.
A series of Jupyter notebooks have been developed in the misc/notebooks folder as tutorials. These notebooks explain the functionality of the various packages and modules within the library, as well as demonstrate how to utilize them to solve typical problems encountered in the financial industry.
In the benchmark folder, three Python packages are presented to assess the performance of various quantum algorithms:
- compare_ae_probability: This package enables easy configuration of different amplitude estimation algorithms and their application to a simple amplitude estimation problem (this is getting the probability of a fixed state when a probability density array is loaded into a quantum circuit). For comparison between AE methods please review notebook CompareAEalgorithmsOnPureProbability.ipynb.
- q_ae_price: This package simplifies the configuration of price estimation problems for different financial derivatives (call and put options, and futures) and solves them using various configurations of quantum amplitude estimation algorithms. For comparison between AE algorithms please refer to: Compare_AE_algorithms_On_PriceEstimation.ipynb
- qml4var: This package allows to the user trains PQC that can be used as surrogate models of time consuming financial distribution functions.
This work is supported by the NEASQC project, funded by the European Union's Horizon 2020 programme, Grant Agreement No. 951821.
The html documentation of the QQuantLib library can be access at: https://neasqc.github.io/FinancialApplications
You can test the library in binder using following link: