Metadata-Version: 2.4
Name: aadc-quantlib
Version: 1.38.9
Summary: QuantLib 1.38 with Real = AADC-NG idoubleNG, SWIG-wrapped for Python
Author-email: Matlogica <info@matlogica.com>
License-Expression: LicenseRef-Proprietary
Project-URL: Homepage, https://matlogica.com
Project-URL: Documentation, https://matlogica.com/docs
Keywords: quantlib,quantitative-finance,derivatives,pricing,greeks,risk,automatic-differentiation,algorithmic-differentiation,adjoint,AAD
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: C++
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
License-File: THIRD-PARTY-NOTICES.txt
Requires-Dist: aadc<3,>=2.18.0
Dynamic: license-file

# aadc-quantlib

**QuantLib 1.38 with exact AAD sensitivities, from Python.**

`aadc-quantlib` is a build of [QuantLib](https://www.quantlib.org) 1.38 whose
`Real` type is the AADC-NG active double (`idoubleNG`), SWIG-wrapped for
Python. You price with the QuantLib API you already know; the [`aadc`
core](https://matlogica.com) records the pricing as it runs and replays it
compiled — with exact first-order sensitivities of every output with respect
to every input, no bumping, no re-pricing per input.

## Install

```sh
pip install aadc-quantlib
```

Wheels ship for CPython 3.10 through 3.14 on Linux (x86-64 and arm64), macOS
(Apple Silicon) and Windows (x64). The `aadc` core package is a declared
dependency and installs alongside; both must come from the same package index
so that exactly one `libaadc-ng` runtime image is loaded per process.

## The import is `aadc_quantlib`, not `QuantLib`

```python
from aadc_quantlib import QuantLib as ql
```

This package deliberately does **not** install itself under the `QuantLib`
name, so it can coexist in one environment with PyPI's own `QuantLib`
distribution. Existing `import QuantLib` code can opt in explicitly:

```python
import aadc_quantlib
aadc_quantlib.install_as_quantlib()   # makes `import QuantLib` resolve to this build
```

## Example: a European option, price and delta

```python
import aadc
from aadc_quantlib import QuantLib as ql

d = ql.Date(15, 6, 2026)
ql.Settings.instance().evaluationDate = d
ts = ql.YieldTermStructureHandle(ql.FlatForward(d, 0.03, ql.Actual365Fixed()))
vs = ql.BlackVolTermStructureHandle(
    ql.BlackConstantVol(d, ql.TARGET(), 0.20, ql.Actual365Fixed()))

s = aadc.idouble(100.0)
f = aadc.Functions()
f.start_recording()
sa = s.mark_as_input()
o = ql.VanillaOption(ql.PlainVanillaPayoff(ql.Option.Call, 100.0),
                     ql.EuropeanExercise(ql.Date(15, 6, 2027)))
o.setPricingEngine(ql.AnalyticEuropeanEngine(
    ql.BlackScholesProcess(ql.QuoteHandle(ql.SimpleQuote(s)), ts, vs)))
npv = o.NPV()
na = npv.mark_as_output()
f.stop_recording()

r = aadc.evaluate(f, {na: [sa]}, {sa: [100.0]}, 1)
print(float(npv), r[1][na][sa][0])
# 9.413403383853023 0.5987063256829239
```

The second number is the option's delta, taken from the recorded tape by
adjoint differentiation. It agrees with central finite differences to about
1e-11 — and unlike bumping, one recorded replay yields the sensitivity to
every marked input at once.

## Licence in one paragraph

Proprietary. The AADC engine this wheel records into is free for
**non-commercial and academic use only**; everything else — including
commercial evaluation and any calculation whose output reaches a book, a
client report or a regulator — is Production Use and needs a commercial
licence from MatLogica. The binding text is the licence shipped inside the
wheel at `<dist-info>/licenses/LICENSE.txt`, never this summary. The wheel
also redistributes QuantLib, QuantLib-SWIG and other third-party components
in binary form; each component's licence text is reproduced verbatim in
`licenses/THIRD-PARTY-NOTICES.txt` beside it. Commercial licences and
questions: <info@matlogica.com>.

## Which QuantLib is this?

QuantLib 1.38, patched so `Real = idoubleNG` and rebuilt against the AADC-NG
runtime. `ql.__version__` reports the QuantLib version;
`importlib.metadata.version("aadc-quantlib")` reports the wheel version.
