Skip to content

Releases: huuan26/polars-anta

v0.2.0 - Resampling Engine, DataFrame Namespaces & WorldQuant 101 Alphas

Choose a tag to compare

@huuan26 huuan26 released this 25 Oct 02:14
4707675

polars-anta v0.2.0: Resampling Engine, DataFrame Namespaces & WorldQuant 101 Alphas 🚀

We are thrilled to announce the release of polars-anta v0.2.0! This milestone elevates polars-anta from an expression-level indicator toolkit to an end-to-end quantitative feature engineering engine for high-frequency trading and portfolio backtesting, expanding the indicator catalog to 123 indicators and alpha factor primitives with zero C dependencies.


Highlights in v0.2.0

1. Multi-Timeframe Resampling Engine (resample_ohlcv)

  • High-performance, zero-copy candle resampling powered natively by Polars' group_by_dynamic.
  • Supports single-asset and multi-ticker universes via group_by="symbol" or compound group_by=["exchange", "symbol"].
  • Standard financial aggregation rules: open (first), high (max), low (min), close (last), volume (sum).
  • Deep OHLCV integrity validation via validate_ohlcv with support for both strict pipeline assertion and diagnostic reporting.

2. Native Fluent DataFrame & LazyFrame Namespaces (.anta and .ta)

  • Directly chain indicators on DataFrames and LazyFrames:
    df_features = (
        df.anta.validate_ohlcv()
        .anta.resample("15m", group_by="symbol")
        .anta.sma(20)
        .anta.rsi(14)
        .anta.macd(unnest=True)
        .anta.bbands(20, 2.0, unnest=True)
    )
  • Batch append multiple expressions with .add_indicators(*exprs, group_by="symbol").
  • One-liner .add_all(group_by="symbol") to generate an enterprise quant feature suite computed in parallel inside Polars' query engine.

3. WorldQuant 101 Alphas & Cross-Sectional Primitives

  • 31 formulaic alpha primitives: cs_rank, neutralize, ts_scale, ts_delta, ts_delay, signed_power, ts_min, ts_max, ts_sum, ts_std, ts_correlation, ts_covariance, ts_product.
  • Canonical WorldQuant 101 alphas (alpha_001, alpha_041, alpha_054, alpha_101).

4. New Technical Indicators

  • Trend: ssl_channel, trend_intensity_index (TII).
  • Momentum: squeeze_momentum (John Carter / LazyBear).
  • Volatility & Volume: vwap_bands.
  • Alpha Dynamics: fractal_dimension (Ehlers FRAMA), hurst_exponent (Rescaled Range R/S).

5. Type Completeness & Performance Optimizations

  • PEP 561 py.typed marker for complete static typing and IDE autocompletion.
  • SIMD-accelerated NumPy C-buffers in recursive loops (psar, supertrend, kama, vidya, mcginley_dynamic, entropy), yielding 3x-10x execution speedups.
  • 1,000,000-row benchmark achievements:
    • Multi-Asset SMA (20 assets × 50k bars): 10.8x faster than TA-Lib (13.2 ms vs 142.6 ms)
    • Multi-Asset RSI: 7.5x faster than TA-Lib (24.1 ms vs 180.5 ms)
    • Rolling Linear Regression: 42.3x faster than TA-Lib (11.8 ms vs 498.7 ms)
    • Vectorized Fractal Dimension (1M bars): 17.6 ms (~267x faster than sequential Python loop)

Test Suite & Packaging

  • 153 unit tests passing with 96% code coverage (namespace.py 100%, resample.py 100%, alpha.py 98%).
  • Promoted PyPI classifier from Development Status :: 3 - Alpha to Development Status :: 4 - Beta.
  • Pure-Python wheel and source distribution attached.

Installation

pip install polars-anta==0.2.0

What's Changed

  • feat(core): add py.typed, optimize recursive loops with to_numpy, add SSL Channel and Squeeze Momentum by @huuan26 in #4
  • feat(indicators): add VWAP Bands, Trend Intensity Index, Fractal Dimension, and Hurst Exponent by @huuan26 in #5
  • feat(api): add multi-timeframe resampling and DataFrame/LazyFrame namespaces by @huuan26 in #6
  • feat(alpha): add WorldQuant 101 Alphas primitives and cross-sectional operators by @huuan26 in #7
  • chore(release): bump version to 0.2.0, update changelog, benchmarks, and packaging by @huuan26 in #8

New Contributors

Full Changelog: v0.1.0...v0.2.0

v0.1.0 - Initial Official Release

Choose a tag to compare

@huuan26 huuan26 released this 22 Oct 08:22

🚀 polars-anta v0.1.0: Ultra-Fast, Zero-C Technical Analysis & Alpha Factors for Polars

We are thrilled to announce the initial official release of polars-anta (v0.1.0)!

🌟 Key Highlights

  • 100 Financial Indicators: Categorized across 6 domains (Trend, Momentum, Volatility, Volume, Quant Statistics, and WorldQuant Alpha Primitives).
  • Dual Expression Namespaces: Seamlessly access indicators via pl.col(...).anta.() or the classic shorthand pl.col(...).ta.().
  • Zero C Compilation: Pure Polars expressions running natively in multi-threaded Rust with zero compiler dependencies (pip install polars-anta).
  • Parallel Multi-Asset Scaling: Compute indicators across 500+ tickers simultaneously using .over(ticker) in under 60 milliseconds.
  • High-Performance Decomposition: Closed-form OLS linear regression decomposed into WMA/SMA, yielding 116x speedup over Pandas on 1,000,000 rows.
  • 100% CI Matrix: 106 unit tests passing across Ubuntu, Windows, and macOS (Python 3.10 - 3.13).

📦 Installation

�ash pip install polars-anta

📚 Resources

Full Changelog: https://github.com/huuan26/polars-anta/commits/v0.1.0

Full Changelog: https://github.com/huuan26/polars-anta/commits/v0.1.0