Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Error with talib

Dear Community,

my first post :) I am new to python, and I am stuck on an error from the usage of TALIB. I am trying to aggregate the minutely data specifically the open price at 5 minutes level with the following statement:

opens = data.history(context.stocks, "open", 5000, '1m').groupby(lambda d: d.date()).resample('5min',how='first')  

then I wish to take the moving average of the aggregated data with the following:
ema_result = talib.SMA(opens, timeperiod=12)

however I get the following error:
AssertionError: real has wrong dimensions

I checked the data in opens, it has the date and time in 5 minutes chunks and the correct first open price of the first 5 minutes. But I guess it is not in the right format for TALIB. How can I format my set of open prices to have the right dimension for TALIB?

1 response

hello I am also having issues with my talib as well, i converted the price series to a np.asmatrix to a real, then from there I am unable to run any talib functions..
keeps giving me the same error.

UPDATE: i think i got it

try

ema_result = talib.SMA(opens.as_matrix(), timeperiod=12)

or

ema_result = talib.SMA(context.stocks['open']..as_matrix(), timeperiod=12)