Part of the XAD ecosystem — the fastest automatic differentiation library for C++. If this is useful to you, please star the core XAD repository.
This repository builds QuantLib Python bindings with automatic differentiation, enabling fast risks calculation with QuantLib in Python. It wraps C++ QuantLibAAD in Python. It uses elements from QuantLib-SWIG and is kept in sync with it.
You can install it as:
pip install QuantLibAAD
import QuantLibAAD as qlIt links the XAD library that the xad package ships, so
QuantLib and xad share one active tape per thread: a xad.adj_1st.Tape records QuantLib's
calculations as well as your own.
This package was called QuantLib-Risks up to version 1.33.3. QuantLib-Risks 1.44.0 is the
last release under that name: a deprecated alias that installs QuantLibAAD 1.44 and keeps
import QuantLib_Risks working with a DeprecationWarning. Newer versions are published as
QuantLibAAD only, so please switch to pip install QuantLibAAD and import QuantLibAAD.
Anyone pinned to QuantLib-Risks==1.33.3 must also pin xad<2.
Run these notebooks on Google Colab, with nothing to install:
| Notebook | What it shows |
|---|---|
| Quickstart: a European option's Greeks in one adjoint sweep, checked against QuantLib's analytic Greeks and bumping | |
| Curve risk: a swap book's sensitivities to every quote of a bootstrapped curve in one sweep |
For documentation and other resources, see https://www.xcelerit.com/xad/docs/quantlib-aad/python/ .
If you have found an issue, want to report a bug, or have a feature request, please raise a GitHub issue.
- XAD Comprehensive automatic differentiation in Python and C++
- QuantLibAAD: Fast risk evaluations in Python and C++
Please read CONTRIBUTING for the process of contributing to this project. Please also obey our Code of Conduct in all communication.
This repository follows the QuantLib versions closely. With each new QuantLib release, a new release of QuantLibAAD is prepared with the same version number.
This project is licensed under the GNU Affero General Public License - see the LICENSE.md file for details.
It contains code from QuantLib and QuantLib-SWIG, which are shipped with a different (compatible) license. Both licenses are included in LICENSE.md