Metadata-Version: 2.4
Name: xpectral-quant
Version: 1.0.0
Summary: Quant analytics and market data for Polars DataFrames
Project-URL: Homepage, https://github.com/bayquant/xpectral-quant
Author: BayQuant
License: MIT License
        
        Copyright (c) 2025 BayQuant
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: finance,market-data,polars,quant
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.12
Requires-Dist: massive>=2.0.2
Requires-Dist: numpy>=1.26
Requires-Dist: polars>=1.34.0
Requires-Dist: pyarrow>=21.0.0
Requires-Dist: python-dotenv>=1.2.1
Description-Content-Type: text/markdown

# Xpectral Quant

![Spectral decomposition](assets/xpectral_banner.gif)

Quant analytics and market data that extend **Polars** DataFrames via the
accessor pattern.

Part of the Xpectral project, alongside [`xpectral-chart`](https://github.com/bayquant/xpectral-chart)
(fluent Bokeh charting). Both install into the shared `xpectral` namespace and
can be used together.

## Modules

- **`xpectral.quant`** — Financial metrics (returns, volatility, beta) via
  `pl.col(...).quant.returns()`, plus a `Portfolio` builder.
- **`xpectral.data`** — Market data from the Polygon/Massive API with caching
  and rate limiting, plus simulations (`BrownianMotion`).

## Usage

```python
import xpectral.quant  # registers the .quant accessor
import polars as pl

df = pl.DataFrame({"close": [100.0, 101.0, 99.5, 102.0]})
df.with_columns(pl.col("close").quant.returns())
```

Importing `xpectral.quant` / `xpectral.data` is what registers the accessors and
loads market-data credentials.

### Market data credentials

`xpectral.data` reads Polygon/Massive API credentials from an `xpectral/.env`
file (loaded automatically on `import xpectral.data`). Create it with your keys;
it is git-ignored and never committed.

See each subpackage's README for module-level docs:

- [`xpectral/quant/README.md`](xpectral/quant/README.md)
- [`xpectral/data/README.md`](xpectral/data/README.md)

## Install

```bash
pip install xpectral-quant
```

```bash
uv add xpectral-quant
```

For development:

```bash
uv sync
```
