Skip to content

Support TA-Lib 0.8.3 C library - #785

Merged
mrjbq7 merged 16 commits into
masterfrom
dev-v0.8.3
Oct 28, 2026
Merged

mrjbq7 merged 16 commits into
masterfrom
dev-v0.8.3

Conversation

@mrjbq7

@mrjbq7 mrjbq7 commented Oct 28, 2026

Copy link
Copy Markdown
Member

Reviewing the dev branch with its changes.

wheels.yml no longer builds TA-Lib C, so its TALIB_C_VER was read only by
tests.yml. Read the version from setup.py instead, so a bump cannot leave
the shared-library test on the old release.
Output bit 128 is now a confirmation level (+/-200 on the bar that confirms
an earlier pattern), not the old strength range. Output bits 0x4000 (display
shift) and 0x8000 (weak pattern, +/-80) and function bits 0x2, 0x4 and 0x8
were dropped: output_flags could not tell that CDLENGULFING writes +/-80.

Refs #126
A Function call that raised skipped the restore of the parameters and
price names it was given, so they stuck and the next call used them:
after abstract.SMA(d, timeperiod=0) failed, abstract.SMA(d) failed too.
Restore them on every path. set_parameters also checks every value before
writing any, so a rejected call leaves the function as it was.

Refs #194
`make cython` from the repo root, with Cython 3.3.0 and numpy 2.5.4 in
.venv (python3.12). Built from this file without Cython: 1714 passed,
1 skipped.
The generators added begidx to every integer output of a function whose name
contains INDEX. TA-Lib C 0.8.3's ZIGZAG returns a bar index in outPivotIdx next
to a trend direction in outTrend, so the shift is now chosen per output: every
output of the *INDEX functions, as before, and any integer output whose C name
ends in Idx. The generated code of MAXINDEX, MININDEX and MINMAXINDEX is
unchanged.
… C 0.8.3

TA-Lib C 0.8.3 adds 36 functions (ALMA, ASI, BBW, CG, CHOP, CHOPTR, CKSP, CRSI,
CTI, DOSC, EMV, FISHER, FRAMA, IBS, ICHIMOKU, KST, KSTEXT, KURTOSIS, KVO, MCGD,
MEDIAN, PERCENTB, PSO, ROGERSSATCHELL, RVIR, SI, SQZMOM, STC, SWAK_2PHP, SWAK_BP,
SWAK_BUTTER, SWAK_GAUSS, SWAK_HP, VIDYA, WAVETREND, ZIGZAG), the moving averages
MA_Type.VIDYA and MA_Type.ALMA, and ten unstable-period ids. PERCENTILE's
default period is now 100.

- _ta_lib.pxd declares the new functions, ids and moving averages.
- MA_Type, the unstable-period table, the function groups, _ta_lib.pyi and the
  docs list them. docs/funcs.md now lists every function: it also gains the 43
  it was missing from earlier releases. The MINMAXINDEX stub returns int32.
- TA_LIB_C_REQUIRED is 0.8.3, which the bindings now need.
- _func.pxi, _stream.pxi, abstract.pyi and stream.pyi are regenerated.
- Tests: the new unstable ids move their own function; under 'ALL' a function
  built on another unstable one (STC on EMA) grows by both; MA dispatches to
  VIDYA and ALMA; ZIGZAG's pivot index counts from the caller's first bar.
TA-Lib C 0.8.3's Auto-Stabilization takes an Auto level in place of a count:
talib.set_unstable_period('ALL', talib.UNSTABLE_AUTO_PREC_4) discards each
function's leading output until its first 4 significant digits no longer depend
on where the data starts (UNSTABLE_AUTO_PREC_8: 8). get_unstable_period()
returns the level. See https://ta-lib.org/api/unstable-period/#auto
…ses vForce

On Apple Silicon macOS, TA-Lib C 0.8.3 computes the batch call of the twelve
transcendental Math Transform functions (ACOS, ASIN, ATAN, COS, COSH, EXP, LN,
LOG10, SIN, SINH, TAN, TANH) with Apple's vForce, while a stream's update keeps
libm, so the two may differ in the last bits. test_stream.py failed 21 tests
there, which the macOS arm64 wheel build runs.

For those twelve, and only when TA_GetRuntimeInfo('vmath.transcendental')
reports a vector math library, the update-vs-batch comparison now allows equal
values or up to 8 ulps of the same sign, as TA-Lib C's own tests do. Every other
function and tier stays bit-exact. stream.py and the README say so.
Within a tolerance, so a change in how TA-Lib C computes them is caught by
every wheel job. Refs TA-Lib/ta-lib#516
Without it TA-Lib C falls back to its scalar loop and every test still
passes. Refs TA-Lib/ta-lib#516
TA-Lib C 0.8.3 is released. Source builds and the wheels now download and
verify ta-lib-0.8.3-src.tar.gz, and the README's C install instructions and
the build scripts' defaults name 0.8.3.
A real parameter now takes any real number, an int or a numpy integer or
float included, and an integer parameter any integer, a numpy integer
included, as talib.func does: abstract.BBANDS(d, 20, 2, 2) raised
"expected float, got int". A value of a newly accepted kind is stored
converted to float or int; a value accepted before is stored as given. A
value of another kind, a float for an integer parameter included, still
raises TypeError.

Closes #430
@mrjbq7
mrjbq7 merged commit 77135c2 into master Oct 28, 2026
28 checks passed
Sign up for free to 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.

2 participants