-1

Let us just say I have a list of closing price data for an asset:

priceList = [3,1,2,1,2,1,2,1,2,1,2]

How do I get the RSI value for the last closing price of priceList? Currently, I am having this code:

import talib
import numpy

priceList = [1,2,1,2,1,2,1,2,1,2]
print(talib.RSI(priceList, timeperiod=10))

But, it's giving me this error:

TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got list)

Please help me solve! Thanks.

1 Answers1

1

I am pretty sure TA-Lib expects a numpy array, not a list as input. Try converting priceList to numpy array:

priceList = np.asarray(priceList, dtype='f8')   

Then pass it to TA-Lib.

Ilan Attar
  • 11
  • 1