Comments (3)
I was a little conflicted -- the old way allocated only as much space as was needed to store the results from TA-Lib, which should be fast and exact. On the other hand, the new way makes it easy to integrate TA-Lib with pandas
if all arrays share a common index (i.e., are the same length and the lookback period in the beginning is padded with nan
), for example:
d = {}
d['MACD'] = talib.MACD(...)
d['EMA'] = talib.EMA(...)
d['RSI'] = talib.RSI(...)
columns = d.keys()
data = np.column_stack([d[key] for key in columns])
df = pandas.DataFrame(data, columns=columns)
If you've got API suggestions, I'm all for it. I could even generate both API's easily enough if there is interest...
from ta-lib-python.
Also, I forgot the mention:
To get the "lookback" value that was previously returned, you can just find the index of the first non-nan value.
rsi = talib.RSI(...)
lookback = np.where(~np.isnan(rsi))[0][0]
from ta-lib-python.
Thanks. In hindsight, I was too quick too submit the question and think you
probably made the right decision. I am only doing some basic plotting with
matplotlib, but after I got the code changed for the new API I actually liked it
better. Thanks for the work to create this - it was very helpful to get ta-lib
easily integrated in Python.
From: John Benediktsson
[email protected]
To: wilki2021 [email protected]
Sent: Sun, July 1, 2012 8:07:08 PM
Subject: Re: [ta-lib] API change rationale? (#3)
I was a little conflicted -- the old way allocated only as much space as was
needed to store the results from TA-Lib, which should be fast and exact. On the
other hand, the new way makes it easy to integrate TA-Lib with pandas
if all
arrays share a common index (i.e., are the same length and the lookback period
in the beginning is padded with nan
), for example:
d = {}
d['MACD'] = talib.MACD(...)
d['EMA'] = talib.EMA(...)
d['RSI'] = talib.RSI(...)
columns = d.keys()
data = np.column_stack([d[key] for key in columns])
df = pandas.DataFrame(data, columns=columns)
If you've got API suggestions, I'm all for it. I could even generate both API's
easily enough if there is interest...
Reply to this email directly or view it on GitHub:
#3 (comment)
from ta-lib-python.
Related Issues (20)
- can not install pybinding keep giving my this error HOT 1
- please upgrade HOT 1
- Details on talib.BBAND "mattype" parameter. HOT 1
- hello please help me HOT 2
- Help, keep looping a future warning when running all strategies on script! HOT 5
- urgently needed HOT 3
- Re: EMA indicator calculation
- Not being able to install wheel file using pip HOT 1
- Request indicator: Detrended Price Oscillator
- symbol not found in flat namespace '_TA_ACOS' on MAC M1. HOT 3
- Anaconda Installation Error HOT 4
- RSI calculation bug? HOT 3
- Installation Error HOT 7
- Instalation error Win11 system HOT 3
- Windows Installation Sources not Found HOT 2
- install problem - outdated config.guess and config.sub HOT 2
- Issue installing TA-Lib on windows HOT 10
- Building wheel for ta-lib (pyproject.toml) did not run successfully. (Ta-lib C dependency is already installed) HOT 5
- Feature Request: conda release for python 3.11 or later HOT 1
- ISSUE WITH INSTALL ta-lib on MAC Studio HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ta-lib-python.