-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to modify this project, if i have add a new indicator in ta-lib project and get ta-lib.lib #703
Comments
Exciting!
I should probably write that up better, but as a start:
Using the abstract interface, I would think it would already be available.
When I built this wrapper, I used a script tools/generate_func.py and later tools/generate_stream.py to “auto generate” talib/_func.pxi and talib/_stream.pxi.
Those two are in turn converted into the _ta_lib.c file using cython to generate and store the C code so you can compile on platforms that don’t have Cython available.
So to answer your question:
1) I would consider using the generate scripts, but at the very least manually write your wrapper in _func.pxi.
2) use the “make generate” to rebuild the C file
https://github.com/TA-Lib/ta-lib-python/blob/3dd0531bdbe282ffe95d4c74bcabab21c596253e/Makefile#L15
3) use “make build” to build it locally then you can import the local built version for testing by either writing a test for your new indicator and doing “make test” or starting a Python shell and testing it manually.
I’m happy to help your work through this, since we haven’t had a lot of new indicators in awhile!
|
i get this error when run generate_func.py, how to fix it? |
I assume it's using the current ta-lib installation to inspect that function using the abstract interface. Is the current ta-lib not built against the new ta-lib with the new indicator? |
so i shoud uninstall the old ta-lib? |
Well, you can build it against your new ta-lib with the new indictor in C library, but without the new indicator in Python. And then add it using the generate script. Alternatively, add the function manually to And since someone contributed |
Alternatively, you can modify the diff --git a/tools/generate_func.py b/tools/generate_func.py
index 5a625ef0..5c00d400 100644
--- a/tools/generate_func.py
+++ b/tools/generate_func.py
@@ -213,8 +213,11 @@ for f in functions:
shortname = name[3:]
names.append(shortname)
- func_info = abstract.Function(shortname).info
- defaults, documentation = abstract._get_defaults_and_docs(func_info)
+ try:
+ func_info = abstract.Function(shortname).info
+ defaults, documentation = abstract._get_defaults_and_docs(func_info)
+ except:
+ defaults, documentation = {}, ""
print('@wraparound(False) # turn off relative indexing from end of lists')
print('@boundscheck(False) # turn off bounds-checking for entire function') |
i uninstall old ta-lib, and get this error, should i install old ta-lib again? |
Okay, I pushed a change to make it fine without abstract info. I mean the way I develop it, I use a a ta-lib-python checkout, and I build it locally and run it from the same build directory, so not installed in site-packages.
if you're on windows, i made an extra change to the generate scripts to support their new install locations. Running it, I notice this output
Are these new indicators in 0.6.x that I should support? Is that what you're trying to add? |
I added those 3 indicators, look at the last few patches, and try the latest commit? |
the indicator what i want to add is TD Sequential Indicator, i'm not familiar with the whole process of add a new indicator, |
This is basically all you need to add a new indicator:
Usually, you need a "second pass" that runs generate again but now that the abstract docs are available for them. You can see that in |
Sorry, it's not so easy, but I just ran through the steps for those 3 indicators and it works okay. |
The "Update the C file" step is only because I like this to be installable without cython available, it's not strictly needed for local development and testing. |
i have add new VPT indicator in talib/_ta_lib.pxd, and run generate_func.py, generate_stream.py, |
ta-lib-python>cython --directive emit_code_comments=False talib/_ta_lib.pyx Error compiling Cython file:...
|
Are you working from latest git master?
I added those functions to _ta_lib.pxd
|
F:\ta-lib-python>tools\generate_func.py > talib/_func.pxi F:\ta-lib-python>tools\generate_stream.py > talib/_stream.pxi F:\ta-lib-python>cython --directive emit_code_comments=False talib/_ta_lib.pyx |
yeah, it seems that my code was outdate, when i pull remote code from latest git master, it conflict with my local file |
it's ok, thanks if i want to push my new indicator to ta-lib and ta-lib-python, what shoud i do? |
You can use GitHub to fork the repositories.
And then put your code in a branch.
And then make a pull request!
I’m happy to help!
|
i have add a new indicator in ta-lib and get ta-lib.lib.
what shoud i do about this python wrapper?
ta-lib-python\talib.c seems generated code, how to modify it?
The text was updated successfully, but these errors were encountered: