Skip to content

feat: support TA-Lib C 0.8.1(next release) - #754

Merged
mario4tier merged 1 commit into
devfrom
feat/talib-c-0.8.1-support
Sep 5, 2026
Merged

feat: support TA-Lib C 0.8.1(next release)#754
mario4tier merged 1 commit into
devfrom
feat/talib-c-0.8.1-support

Conversation

@mario4tier

@mario4tiermario4tier commented Jul 29, 2026

Copy link
Copy Markdown
Member

Rebased onto dev, and finished against the now-frozen TA-Lib C 0.8.1 surface.

TA-Lib C 0.8.1 becomes the minimum required version — against an older one the
build fails at compile time, which is the loudest way to say so.

What it adds

  • 201 functions, up from 161: the 40 TA-Lib C has added since 0.7.1.
  • MA_Type: HMA, DISABLED, DEFAULT, ZLEMA, RMA.
  • set_unstable_period(): 'RMA', 'HA', 'RVI'.

Three defects found on the way

  • The generators strip TA-Lib C's own streaming declarations by name. The verb
    list missed _Value and _Clone, which 0.8.1 declares for every function —
    403 stream accessors would have been parsed as batch functions. It now skips
    anything mentioning a TA_<FUNC>_Stream handle.
  • defaults.get('matype', 0) never matches a prefixed parameter, so KDJ's
    slowk_matype / slowd_matype defaulted to SMA where the C table says RMA.
    func.KDJ and abstract.KDJ returned different numbers, with no error.
  • SUPERTREND's integer output was about to be documented with the
    candlestick "values are -100, 0 or 100" wording. It is a +1/-1 trend direction.

Verification

Built against a 0.8.1 library: 81 tests pass. Re-running the generators
reproduces the committed _func.pxi and _stream.pxi byte for byte, so nothing
was hand-edited into a generated file.

Nine surfaces are checked to name the same 201 functions — the C abstract table,
__TA_FUNCTION_NAMES__, get_functions(), _ta_lib.pxd, _func.pxi,
_stream.pxi, both halves of _ta_lib.pyi, and abstract.pyi.

New tests, each shown to fail against the bug it covers:

  • test_func_and_abstract_agree — the two public APIs must return identical
    values for all 201. Reverting the KDJ fix makes it fail.
  • test_stubs_parse / test_stubs_cover_every_function — the .pyi files ship
    beside py.typed, and nothing else in the build reads them.
  • MA_Type dispatch for HMA/ZLEMA/RMA, plus DISABLED and DEFAULT.
  • RMA, HA and RVI added to the unstable-period cases.

Left for the release commit

talib/_ta_lib.c is untouched — it is refreshed at release time, together with
the version bump and the regenerated docs. An sdist built before that refresh
would carry the 161-function C file.

CI still triggers on master only, so this PR ran no checks; the verification
above is local.

@mario4tier
mario4tierforce-pushed the fix/752-unstable-period-ids branch from 282e50a to 5263446CompareSeptember 5, 2026 20:17
@mario4tier
mario4tier changed the base branch from fix/752-unstable-period-ids to devSeptember 5, 2026 21:19
TA-Lib C 0.8.1 is now the minimum required version.
- Bind the 40 functions added since 0.7.1: 161 -> 201.
- MA_Type gains HMA, DISABLED, DEFAULT, ZLEMA and RMA; set_unstable_period()
gains RMA, HA and RVI.
- generate_func.py / generate_stream.py: skip any declaration mentioning a
TA_<FUNC>_Stream handle. The verb list it replaces missed _Value and _Clone,
which 0.8.1 declares for every function.
- generate_func.py / generate_stream.py: a moving-average parameter not spelled
exactly 'matype' -- KDJ's slowk_matype -- defaulted to SMA rather than to the
function's own default, so func.KDJ and abstract.KDJ disagreed.
- abstract: ignore flag bits added after this wrapper was written instead of
raising KeyError, and keep the -100/0/100 wording for candlesticks only
(SUPERTREND's integer output is a trend direction).
- Building against an older ta-lib now fails at compile time; the import guard
explains a stale extension.
- Tests: func and abstract must agree on all 201, and the stubs must parse and
cover every function.
talib/_ta_lib.c is left untouched; it is refreshed at release time.
Claude-Session: https://claude.ai/code/session_01R8JMZAcnp5snoMjFd1HyMU
@mario4tier
mario4tierforce-pushed the feat/talib-c-0.8.1-support branch from 6fd65a0 to 75659b4CompareSeptember 5, 2026 22:26
@mario4tier
mario4tier merged commit 875f023 into devSep 5, 2026
@mario4tiermario4tier changed the title feat: support TA-Lib C 0.8.1 (proposal, for after the 0.8.1 release)feat: support TA-Lib C 0.8.1(next release)Sep 6, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@mario4tier