I am new to python and pandas and mainly learning it to diversify my programming skills as well as of the advantage of python as a general programme language. In this programme I am using it to fetch historical data's from yahoo and do some technical analysis using functions in talib
import pandas_datareader.data as web
import datetime
import talib as ta
start = datetime.datetime.strptime('12/1/2015', '%m/%d/%Y')
end = datetime.datetime.strptime('2/20/2016', '%m/%d/%Y')
f = web.DataReader('GOOG', 'yahoo', start, end)
print 'Closing Prices'
print f['Close'].describe()
print f.Close
print ta.RSI(f.Close,2)
print ta.SMA(f.Close,2)
print ta.SMA(f.Volume,4)
print ta.ATR
print ta.ATR(f.High,f.Low,f.Close,3)
the above code works till print f.Close
but then it shows this error
print ta.RSI(f.Close,2)
TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got Series)
I have used R and its libraries for technical analysis of stocks and It have an inbuilt library called Quantmod
which makes technical analysis easier and with fewer codes.
library(quantmod)
symbol=getSymbols(AAPL)
SMA=SMA(Cl(Symbol),2)
is there any similar libraries available for Python?.
To install Ta-Lib, you will first install Anaconda and then open the Anaconda prompt. You would then write the code, “conda install -c conda-forge ta-lib”, and press the “Enter” key. After a few moments, the ta-lib package will be installed. That's all there is to it.
Pandas TA - A Technical Analysis Library in Python 3 Pandas Technical Analysis (Pandas TA) is an easy to use library that leverages the Pandas package with more than 130 Indicators and Utility functions and more than 60 TA Lib Candlestick Patterns.
Try with;
print ta.RSI(np.array(f.Close))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With