🔨 Refactor code-generation#77
Open
serkor1 wants to merge 8 commits into
Open
Conversation
* The code-generator currently only works for the TA-Lib (C-side) indicators and uses the TA-Lib functions list to identify all indicators with their respective signatures wrapped in X-Macros. The goal is to be independent from BASH and use an algorithmic approach so input arguments that has default values are not silently dropped. Furthermore it is expected that ALL TA-Lib indicators will be generated using X-Macros.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #77 +/- ##
==========================================
- 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. 🚀 New features to boost your workflow:
|
* The X-Macros will be using TA_* prefixes for readable preprocessing. So DBL --> TA_DOUBLE for doubles.
* The codegen/ now also parses the TA_<indicator>_Lookback signatures which is the optional inputs for all the functions. * The original C_MACRO has been renamed to BATCH to distinguish between streaming (Upcoming) and batch API for later TA-Lib versions.
* The identifiers follows a simple if-else statement for identifying candlesticks based on the indicator name 'CDL'. With this implementation it is now possible to implement candlestick-specific logic on the C preprocessing side without having to rewrite the logic downstream.
* All lookback related functions have been removed to accomodate the new codegen that uses the exact signature of the TA_<indicato>_lookback funtions.
## 📚 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)
* fmt target now also runs cargo fmt on the crate * gen-code target now includes cargo run * Deleted old script runners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📚 What?
The library is currently standing at +300k line additions and 230k line removals. TA-Lib indicators are at 12k lines alone, and the code-generators alone are in a ballpark that is beyond what is maintainable in the long run. Furthermore, the transition from manually coding everything to migrating to BASH for auto-generating the code has introduced a wide variety of bugs (See, example, Issue #39).
To mitigate this I have opened Issue #75, but the {boilerplate.rs} did not really solve the complexity of the code-generation as the
config.toml-file itself varied between 700-1200 lines of code (And this is even with the help AI). This PR introduces the following changes:📋 TODO
Important
We need to implement Candlestick indicators so it candlestick specific logic can be implemented
in the core logic.
Footnotes
The bugs, errors and slow compilation time is obviously my own fault. And the rewrite is mainly driven by me wanting to learn new stuff and having a maintainable repository. ↩ ↩2