Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Help Needed: TA-Lib

Can I use the TA-Lib library on my own data i.e. data accumultated upto a certain point in a backtest? I was thinking that TA-Lib would use a DataFrame as input and in my algo I accumulate closing price data in this form:

print context.df_close.head()

                            2          24  
2013-01-02 00:00:00+00:00 8.9700 548.7100  
2013-01-03 00:00:00+00:00 9.0700 542.3800  
2013-01-04 00:00:00+00:00 9.2500 527.0100  
2013-01-07 00:00:00+00:00 9.1000 523.9701  
2013-01-08 00:00:00+00:00 9.0988 525.1900  

but does it actually need a DataPanel?

P.

2 responses

To answer my own question in part it seems I can use TA-Lib by importing zipline i.e.

import zipline  
.
.
a = zipline.transforms.ta.talib.MA(context.df_close[context.stock[0]], timeperiod=timeperiod)  

I can't work out how to import just the part of zipline I need.

(I'm not sure what my goal is here but it involves indicators in multiple timeframes. Initially I want to use daily indicators in a minutely backtest. The attached algo has got as far as generating a TA-Lib indicator from data I have accumulated in the backtest.)

P.

Re. the zipline import this is as succint as I can get. Any suggestions are welcome:

import zipline.transforms.ta as ztt  
.
.
    a = ztt.talib.MA(context.df_close[context.stock[0]], timeperiod=timeperiod)  

P.