Skip to content

Make abstract API more flexible with int->double support - #780

Merged
mario4tier merged 3 commits into
devfrom
fix-430-numeric-params
Oct 26, 2026
Merged

mario4tier merged 3 commits into
devfrom
fix-430-numeric-params

Conversation

@mario4tier

@mario4tier mario4tier commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Closes #430. An abstract function now takes any number of a parameter's kind, as talib.func does: abstract.BBANDS(d, 20, 2, 2) (the example in docs/abstract.md) raised "expected float, got int", and abstract.SMA(d, timeperiod=np.int64(10)) raised "expected int, got int64". A real parameter takes any numbers.Real and an integer parameter any numbers.Integral; a value of a newly accepted kind is stored as a float or an int, and a value accepted before is stored as given. A float for an integer parameter, a str or a complex still raise TypeError.

The tests came first (first commit): both fail on dev with those two errors. The last commit regenerates _ta_lib.c (Cython 3.3.0). Rebased on dev after #781; against C dev 62021c1d1, built from the .pyx and again from the regenerated .c: 2033 passed, 1 skipped.

@mrjbq7 If this is OK with you, then I will integrate this on the dev branch for the next release.

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
@mario4tier
mario4tier force-pushed the fix-430-numeric-params branch from 3c746c6 to 8448b84 Compare October 25, 2026 19:08
@mario4tier mario4tier changed the title Accept any number of a parameter's kind in the abstract API Make abstract API more flexible with int->double support Oct 25, 2026
@mrjbq7

mrjbq7 commented Oct 25, 2026

Copy link
Copy Markdown
Member

Sounds great. When the dev branch is ready, lets merge it into main for the release against 0.8.3 C library

@mario4tier
mario4tier merged commit c728324 into dev Oct 26, 2026
7 checks passed
@mario4tier

Copy link
Copy Markdown
Member Author

This is now on dev-v0.8.3 which is ready for your review/merge to main.

@mario4tier
mario4tier deleted the fix-430-numeric-params branch October 26, 2026 05:16
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