Metadata-Version: 2.4
Name: techr
Version: 0.1.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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 :: Rust
Classifier: Topic :: Scientific/Engineering
Requires-Dist: polars>=1.39,<2
Summary: Polars expression plugins for techr indicators
Home-Page: https://github.com/alphaprime-dev/techr
Author: alphaprime-dev
License: MIT
Requires-Python: >=3.10, <3.14
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/alphaprime-dev/techr
Project-URL: Issues, https://github.com/alphaprime-dev/techr/issues
Project-URL: Repository, https://github.com/alphaprime-dev/techr

# techr

`techr` exposes technical indicators as Polars expression plugins.

## Installation

```bash
uv add techr
```

## Supported indicators

- `sma`, `wma`, `ema`, `disparity`
- `macd`, `macd_signal`, `macd_hist`
- `bband_middle`, `bband_lower`, `bband_upper`
- `stochf_percent_k`, `stochf_percent_d`
- `stoch_percent_k`, `stoch_percent_d`
- `ichimoku_base_line`, `ichimoku_conversion_line`
- `ichimoku_leading_span_a`, `ichimoku_leading_span_b`, `ichimoku_lagging_span`

## Usage

```python
import polars as pl
import techr as ta

df = pl.DataFrame(
    {
        "high": [11.0, 12.0, 13.0],
        "low": [9.0, 10.0, 11.0],
        "close": [10.0, 11.0, 12.0],
    }
)

result = df.select(
    ta.sma(pl.col("close"), period=2).alias("sma_2"),
    ta.macd(pl.col("close"), fast_period=12, slow_period=26).alias("macd"),
    ta.stochf_percent_k(
        pl.col("high"),
        pl.col("low"),
        pl.col("close"),
        fastk_period=14,
        fastd_period=3,
    ).alias("stochf_k"),
)
```

## Ichimoku Notes

- Standalone Ichimoku rolling-window lines such as `ichimoku_base_line` and `ichimoku_conversion_line` use `period`.
- `ichimoku_leading_span_a` uses `base_line_period` and `conversion_line_period` because it combines two lines.
- `ichimoku_leading_span_b` uses `period` for the rolling window and `base_line_period` for the forward displacement. The Python wrapper defaults `base_line_period` to `26`.
- `ichimoku_lagging_span` uses `base_line_period` for its backward displacement.
- Polars plugins keep the output row-aligned with the input, so `ichimoku_leading_span_a` and `ichimoku_leading_span_b` truncate the forward-projected tail from the core result.

## Development

```bash
cd polars
uv sync --group dev
uv run maturin develop --uv
uv run pytest
```

Build distributable artifacts locally with:

```bash
cd polars
uv run maturin build --release --sdist --out dist
uv run python scripts/check_artifacts.py dist
```

## Release

1. Update the version in `Cargo.toml`.
2. Merge the version bump to `main`.
3. `Polars Release` builds the artifacts and publishes them to PyPI.
4. After the PyPI publish succeeds, the workflow creates the matching `polars-vX.Y.Z` GitHub Release.

If the matching GitHub Release already exists, the workflow exits without publishing a duplicate release.

Before the first release, configure a Trusted Publisher for PyPI on `alphaprime-dev/techr`.

