Skip to content

🔨 X-Macros#78

Merged
serkor1 merged 36 commits into
refactor-codegenfrom
X-macros
Jul 14, 2026
Merged

🔨 X-Macros#78
serkor1 merged 36 commits into
refactor-codegenfrom
X-macros

Conversation

@serkor1

@serkor1 serkor1 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

📚 What?

This PR is a rewrite of the source code that binds TA-Lib to R. The overall goal is to reduce the amount of code, and simplify the C-wrappers. It has been implemented incrementally, so much of the original functionality as been deleted but is to be reintroduced in a similar fashion.

There has been no consideration for backwards compatibility which in this case means that a part of the R logic has to be re-written (This does not affect the signatures at all). All *_lookback functions, for example, now only accepts the relevant arguments in .Call() which breaks with the current R side logic. (This should be possible by only rewriting the templates, so the PR is mainly focused on the C-side)

📋

  • Implement ta_volume
  • [ ] Rework *_lookback()

@serkor1 serkor1 added enhancement New feature or request dependencies Pull requests that update a dependency file labels Jul 14, 2026
serkor1 added 28 commits July 14, 2026 15:07
* All lookback related functions have been removed to accomodate
  the new codegen that uses the exact signature of the TA_<indicato>_lookback
  funtions.
* It compiles and works.
* These are now deprecated in favor of the X-macros
  if there is any need in looking back it is always
  possible to back a few commits and read the code.
* This part is obsolete as well.
* TA-Lib.c includes all TA-Lib specific settings
  like candlestick settings.

* The old implementation of candlestick settings
  used two steps to generate C compatible types
  but it seems that direct casting with Rf_asTYPE
  does the trick aswell.
* Reintroduced shift_array
* Renamed and documented set_colnames
* TA_WRAPPER instead of whatever it was before
* This is mainly to look cool and save some Lines
* The implementation are made by Claude
* Mainly a checkpoint
* They now use shift_array directly
* THe names are for <matrix> and <data.frame>
* The amount of code per file is getting out of hand.
* The functions should always return a
  matrix.
* This is the old attributes just with Enums
* But it does ot use TA_LOOKBACK as of now.
serkor1 added 5 commits July 14, 2026 15:07
* The sizes of the original file were getting out
  of hand, and now it has been modularized and looks
  like the olde implementation.
* The addition is simple and straightforward.
  It follows the original implementation.
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.23353% with 223 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.02%. Comparing base (4b806bd) to head (e78212b).
⚠️ Report is 1 commits behind head on refactor-codegen.

Files with missing lines Patch % Lines
src/TA-Lib.h 0.00% 195 Missing ⚠️
src/TA-Lib.c 26.92% 19 Missing ⚠️
src/init.c 25.00% 3 Missing ⚠️
src/names.c 83.33% 3 Missing ⚠️
src/shift.c 88.88% 2 Missing ⚠️
src/attributes.c 92.30% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           refactor-codegen      #78      +/-   ##
====================================================
- Coverage             96.47%   95.02%   -1.46%     
====================================================
  Files                   281      153     -128     
  Lines                 23849    16890    -6959     
====================================================
- Hits                  23009    16049    -6960     
- Misses                  840      841       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

serkor1 added 3 commits July 14, 2026 19:03
* The function macro TA_WRAPPER has been cleaned up
  so its flow resembles the original implementation and
  is a tad more readable

* Spelling and consistency errors in headers and functions

* Renamed talib_map --> preprocessor.h as this name is more fitting
  for what it actually does.
* Moved all declarations to init.c to keep the dependency
  tree clean: preprocessor --> wrapper --> --> init.c

  This is (as far as I know) the canonical way.
@serkor1 serkor1 marked this pull request as ready for review July 14, 2026 20:59
@serkor1 serkor1 merged commit 4410628 into refactor-codegen Jul 14, 2026
2 of 4 checks passed
@serkor1 serkor1 deleted the X-macros branch July 14, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant