u/AMGraduate564

[RELEASE] pandas-ta-classic v0.6.20 - Code Modernization, Fluent Chaining, Property-Based Testing, and 89% Test Coverage etc.

[RELEASE] pandas-ta-classic v0.6.20 - Code Modernization, Fluent Chaining, Property-Based Testing, and 89% Test Coverage etc.

Hey r/algotrading,

pandas-ta-classic is the community-maintained fork of pandas-ta — a comprehensive technical analysis library for pandas DataFrames. This release is the largest update since the fork, spanning 66 commits and 338 changed files.

GitHub: github.com/xgboosted/pandas-ta-classic
PyPI: pip install pandas-ta-classic

🎯 TL;DR

  • TA-Lib exact parity — Wilder smoothing, chained EMA lookbacks, and PSAR reversal checks now match the C library within float64 precision. All 60 oracle tests pass at tol=1e-7.
  • Fluent API chainingdf.ta.chain().sma(50).rsi().macd(). Chain indicators in one expression, call df.ta.unchain() to go back to normal mode.
  • Property-based testing — 55 Hypothesis tests verify mathematical invariants (SMA(constant) == constant, RSI ∈ [0,100]) across random inputs.
  • Test coverage 78% → 89% — 1427 tests, zero failures. Every indicator has offset, fill, and None-guard coverage.
  • Code modernized — Python 3.9–3.14, 370 dead-code instances removed, tal alias replaced with talib everywhere.

⚡ Fluent API Chaining (PR #113)

import pandas_ta_classic as ta

df = df.ta.chain().sma(50).rsi().macd().bbands(20)
# df now has SMA_50, RSI_14, MACD_12_26_9, MACDh_12_26_9, MACDs_12_26_9,
# BBL_20_2.0, BBM_20_2.0, BBU_20_2.0, BBB_20_2.0, BBP_20_2.0

df.ta.unchain()  # back to normal append mode

No more repetitive append=True on every call. The chain mode accumulates columns in one fluent expression, then unchain() returns you to standard usage.

🔬 TA-Lib Parity Fixes

Wilder's Smoothing

The PR #112 remediation extracted wilder_smooth() into a shared utility (utils/_wilder.py). It implements Wilder's cumulative-sum smoothing with the correct sum(raw[1:length]) seeding, matching TA-Lib's internal PLUS_DM / MINUS_DM calculation exactly. Used by dm.py — no more hand-rolled NumPy loop inlined.

Chained EMA Lookbacks

DEMA, TEMA, and T3 now correctly strip leading NaN before feeding EMA output back into EMA. This matches TA-Lib's lookback of depth*(length-1). Extracted into _ema_chain() in overlap/ema.py, reducing ~70 lines of repetitive boilerplate to ~10.

PSAR Reversal Check

The SAR guard (max/min clamp at row-1/row-2) now applies before the reversal test, matching TA-Lib's behaviour. Previously, the raw projected SAR was checked, causing off-by-one splits at reversal bars.

Bug Fixes

  • cdl_doji — fixed <<= threshold and added shift(1) to match TA-Lib's look-ahead behavior
  • ichimokuapply_fill now covers all 5 output series (was 3)
  • pvr — added None-guard, offset, and fill support
  • 13 indicators — added missing apply_fill for fillna/fill_method kwargs

🧪 Test Infrastructure

assertions.py + IndicatorSpec

assert_indicator_standard(self, IndicatorSpec(
    func=ta.rsi,
    args=[self.close],
    expected_name="RSI_14",
    expected_type=Series,
    none_arg_idx=0,
))

One call tests: return type, name, columns (DataFrame), offset, fill (fillna, ffill, bfill), None-guard, and length-in-name. Applied uniformly across all indicator test modules.

Property-Based Testing

55 Hypothesis tests using @given(price_series(), ...). Examples:

  • SMA(constant) == constant for all window sizes
  • BBANDS: lower ≤ mid ≤ upper for every row
  • RSI output always ∈ [0, 100]
  • STDEV always non-negative
  • Offset preserves length, fillna removes NaN
  • verify_series(None) returns None

Fixture Auto-Regeneration

tests/__init__.py now regenerates expected_values.json and regression_snapshots.json on import when TA-Lib is installed. No more stale fixtures — test data is always in sync with the code.

make test-all   # regenerate fixtures + run 1427 tests
make fixtures   # regenerate fixture JSONs only (requires TA-Lib)

Oracle Parity

  • 60/60 TA-Lib oracle tests now pass at tol=1e-7 — exact float64 match achieved by the Wilder smoothing and chained EMA fixes

📦 Package & Quality

Code Modernization

  • Removed 279 unnecessary # -*- coding: utf-8 -*- declarations (UP009)
  • 65 useless f"..." prefixes (no placeholders) removed
  • 87 unused imports removed across candle/overlap/momentum modules
  • Optional[X]X | None, List[Y]list[Y] (pyupgrade)
  • taltalib rename — all test files now import talib directly
  • ruff CI-critical checks (E9, F63, F7, F82) — all passed

Python Support

Tested and passing on Python 3.10, 3.11, 3.12, 3.13, 3.14.

🔗 Links

u/AMGraduate564 — 1 day ago

MCP for fetching YouTube video subtitles?

Is there an MCP server available that can fetch YouTube video subtitles? I'm thinking of prompting the YouTube playlist URL and the MCP server will fetch subtitles or transcripts of all the videos in that playlist for analysis.

ty

reddit.com
u/AMGraduate564 — 12 days ago

Hey r/algotrading,

Over the past couple months pandas-ta-classic has had a huge wave of contributions land on main. Here's a rundown of what's new if you haven't checked in recently:


🕯️ 62 Native Candlestick Patterns (no TA-Lib required)

60 new cdl_*.py pattern files were added natively. Every pattern — Engulfing, Hammer, Morning Star, Three Black Crows, you name it — is now pure Python. TA-Lib is never used for CDL even if installed. Access all of them via df.ta.cdl_pattern(name="engulfing").


📈 30+ New Indicators

Trend / Momentum: adxr, dx, plus_dm, minus_dm, sarext, cpr (4 methods: classic/camarilla/fibonacci/woodie), lrsi, pmax, macdext, macdfix, stochf, fosc, rocp, rocr, rocr100, trixh, vwmacd

Overlap / MA: mama/fama, ht_trendline, tsf, mmar, rainbow, mavp

Hilbert Transform cycles: ht_dcperiod, ht_dcphase, ht_phasor, ht_sine, ht_trendmode — full HT family now supported

Volatility: Chandelier Exit (ce), avolume, cvi, hvol

Volume: vfi, emv, marketfi, vosc, wad

Stats / Math: beta, correl, md, stderr, linregangle, linregintercept, linregslope, edecay, new math namespace with add/sub/mult/div + rolling ops

Cycle: dsp (Detrended Synthetic Price)


⚡ Performance: Numba JIT + NumPy Vectorization

  • SSF, MCGD, HWMA, RSX, PSAR, Supertrend, QQE and others get optional @njit(cache=True) via numba
  • Install with: pip install pandas-ta-classic[performance]
  • Measured speedups: RSX 230×, HWMA 70×, MCGD 43×, SSF 42×, Supertrend 13×, QQE 10×, PSAR 6×
  • 15 additional indicators got NumPy sliding_window_view vectorization (replacing slow .iloc loops)

🧪 Oracle / Parity Test Suites

New test_oracle_talib.py and test_oracle_tulipy.py validate results against TA-Lib and tulipy on shared SPY fixtures. Zero skipped tests — every divergence is explicitly documented.


🔧 Breaking Changes to be Aware Of

  • qqe() now returns 6 columns (was 3) — adds long band, short band, direction
  • linreg(angle=True) now returns degrees by default (was radians) to match TA-Lib
  • stdev/variance ddof now defaults to 0 (population, was 1 sample) to match TA-Lib

📦 Other Quality of Life

  • uv package manager fully documented alongside pip
  • Automatic version management via setuptools-scm (no more manual version bumps)
  • Dynamic Category dict — no more manually registering new indicators in _meta.py
  • Python version support follows a rolling 5-version policy (now includes 3.14)
  • Total indicator count: 224 (up from ~213)

GitHub: https://github.com/xgboosted/pandas-ta-classic
Install: pip install pandas-ta-classic or uv add pandas-ta-classic

Feedback and PRs welcome — especially on the oracle parity tests if you spot any formula divergences.

reddit.com
u/AMGraduate564 — 21 days ago