Metadata-Version: 2.5
Name: alphatonic
Version: 0.3.1
Summary: alphatonic measures how well trading signals predict future returns
Project-URL: Homepage, https://github.com/mblum/alphatonic
Project-URL: Documentation, https://mblum.github.io/alphatonic/
Project-URL: Source, https://github.com/mblum/alphatonic
Project-URL: Issues, https://github.com/mblum/alphatonic/issues
Project-URL: Changelog, https://github.com/mblum/alphatonic/blob/HEAD/CHANGELOG.md
Author: Manuel Blum
License-Expression: MIT
License-File: LICENSE
Keywords: alpha,backtesting,factor,finance,information coefficient,quant,signal
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: jinja2>=3.1
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.2.2
Requires-Dist: pydantic>=2.6
Provides-Extra: report
Description-Content-Type: text/markdown

# alphatonic

[![CI](https://github.com/mblum/alphatonic/actions/workflows/ci.yml/badge.svg)](https://github.com/mblum/alphatonic/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mblum/alphatonic/blob/master/LICENSE)

alphatonic measures how well trading signals predict future returns. Give it signal scores and
prices in pandas DataFrames to produce information coefficients, uncertainty estimates and offline HTML reports.

With alphatonic you can:

- Measure cross-sectional and time-series information coefficients, including single-asset signals.
- Estimate uncertainty with Newey–West and equal-weighted cosine standard errors and a block
  bootstrap.
- Assess how costly a signal would be to trade, using rank-persistence and bucket-turnover
  statistics.
- Render an offline HTML tearsheet, and browse your trials with `alphatonic serve`.

Start with the
[tutorial](https://mblum.github.io/alphatonic/tutorials/first-evaluation/),
or browse the [docs](https://mblum.github.io/alphatonic/).

## Try it

Python 3.11 or newer. Install from [PyPI](https://pypi.org/project/alphatonic/):

```sh
python -m pip install alphatonic
```

```python
from alphatonic import evaluate
from alphatonic.demo import synthetic_market

factor, prices = synthetic_market(n_assets=30, n_bars=500, ic=0.04, seed=7)  # or your own tables
result = evaluate(factor, prices, horizons=[1, 5])

result.summary.query("method == 'spearman'")[["horizon", "mean", "ci95_lower", "ci95_upper"]]
result.tearsheet("tearsheet.html")
```

Open `tearsheet.html` in your browser.

## Changelog

See the [changelog](https://github.com/mblum/alphatonic/blob/master/CHANGELOG.md) for what
changed in each release.

## Development

```sh
uv sync --all-extras --locked
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run pyright
```

See [Contributing](https://github.com/mblum/alphatonic/blob/master/CONTRIBUTING.md)
for setup, tests and the release process.

## License

[MIT License](https://github.com/mblum/alphatonic/blob/master/LICENSE). Copyright 2026 Manuel Blum.
