In [1]:
import tia.analysis.ta as ta
import tia.analysis.model as model
In [2]:
secs = model.load_yahoo_stock(['MSFT', 'INTC'], start='1/1/2000')
In [3]:
pxs = secs.frame
pxs.head()
Out[3]:
In [4]:
close = pxs.swaplevel(1, 0, axis=1).close
close.head()
Out[4]:
In [5]:
# moving average calculation
ta.SMA(close, 10).tail()
Out[5]:
In [6]:
# macd
ta.MACD(close).tail()
Out[6]:
In [7]:
# rsi
ta.RSI(close, n=14).tail()
Out[7]:
In [8]:
# determine when 50 crosses the 200
cross = ta.cross_signal(ta.sma(close.MSFT, 50), ta.sma(close.MSFT, 200))
cross.tail()
Out[8]:
In [9]:
import tia.analysis.talib_wrapper as talib
In [10]:
talib.MACD(close).tail()
Out[10]:
In [11]:
# average true range
talib.ATR(pxs).tail()
Out[11]:
In [12]:
talib.RSI(close).tail()
Out[12]: