Metadata-Version: 2.4
Name: nanoql
Version: 2.1
Summary: nanoql for Python: quantitative finance, stateless by design, through nanoql's C interface
License-Expression: Apache-2.0 AND BSD-3-Clause AND BSL-1.0 AND CC0-1.0 AND MIT AND Minpack AND SunPro AND LicenseRef-Jaeckel AND LicenseRef-JoeKuo AND LicenseRef-FpML-Public-License-3.0
License-File: LICENSE
License-File: NOTICE
License-File: THIRD_PARTY_NOTICES.md
License-File: dotnet/LICENSE.TXT
License-File: dotnet/THIRD-PARTY-NOTICES.TXT
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Author: The nanoql Authors
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Classifier: Typing :: Typed
Project-URL: Homepage, https://nanoql.org
Project-URL: Documentation, https://nanoql.org/docs/
Project-URL: Source, https://github.com/nanoql-dev/nanoql
Project-URL: Issues, https://github.com/nanoql-dev/nanoql/issues
Project-URL: Changelog, https://github.com/nanoql-dev/nanoql/blob/v2.1/CHANGELOG.md
Description-Content-Type: text/markdown

# nanoql for Python

nanoql for Python: quantitative finance, stateless by design, through nanoql's C interface. Calendars, curves,
instruments, pricing engines and models are each a plain function of their inputs, with market conventions as data,
and the same inputs always give the same results.

```shell
pip install nanoql
```

One wheel per platform, for every Python from 3.11, with NumPy 1.26 or later and nothing compiled on install: Windows
x64 and Linux x64 (`manylinux_2_28`, glibc 2.28 or later); Windows Arm64, Linux Arm64 and macOS on Apple silicon follow
in later releases. The wheel holds nanoql's native library, so no .NET runtime is needed.

## A first swap

A five-year SOFR swap on a flat curve:

```python
import datetime
from nanoql import ConventionSet, DiscountingSwapEngine, EvaluationContext, FlatForward, MakeOIS, Period, TimeUnit

today = datetime.date(2026, 10, 15)
context = EvaluationContext(today)
qs = ConventionSet.quant_lib()
curve = FlatForward(today, 0.036, qs.day_counter("Actual365Fixed"))

swap = (MakeOIS(Period(5, TimeUnit.Years), qs.overnight_index("Sofr", curve))
        .with_fixed_rate(0.036).with_nominal(10e6)
        .to_overnight_indexed_swap(context))

result = DiscountingSwapEngine.calculate(swap, context, curve)
print(f"NPV {result.npv:,.2f}, fair rate {result.fair_rate:.4%}")
```

Names follow PEP 8 (`curve.discount(5.0)`, `swap.fixed_rate`), a getter is a property, and an object's handle is
released when Python collects it, or at once by `close()` or a `with` block. `import nanoql.experimental` opts in to
the experimental API. The rules are in [the bindings guide](https://nanoql.org/docs/bindings.html).

[A notebook](https://github.com/nanoql-dev/nanoql/blob/main/docs/notebooks/first-steps.ipynb) takes this swap
further, to bootstrapped curves, €STR discounting and Euribor forecasting, a SABR smile, an American put and a CDS; it [runs in Google Colab](https://colab.research.google.com/github/nanoql-dev/nanoql/blob/main/docs/notebooks/first-steps.ipynb) with nothing to
install.

## How it is checked

The core's results are checked against QuantLib 1.44, using test vectors generated by QuantLib's Python package and
by QuantLib built from source; the extensions ported from QLNet are checked against QLNet 1.13.2. What the checks
cover, per module, is on [the validation page](https://nanoql.org/validation/).

## More

- [Documentation](https://nanoql.org/docs/).
- [Source and issues](https://github.com/nanoql-dev/nanoql), and
  [the changelog](https://github.com/nanoql-dev/nanoql/blob/v2.1/CHANGELOG.md).

## License

Apache 2.0. nanoql is derived from QuantLib. The wheel carries `LICENSE`, `NOTICE` and `THIRD_PARTY_NOTICES.md`,
which keep the copyright notices and licences of QuantLib and of the other code it carries, and the .NET runtime's
`LICENSE.TXT` and `THIRD-PARTY-NOTICES.TXT`, which Native AOT compiles into the library.
