import numpy as npimport talib as taimport tulipy as tirsi = ta.RSI(data['Close'], timeperiod=14)rsinp = rsi.valuesrsinp = rsinp[np.logical_not(np.isnan(rsinp))]fastk, fastd = ti.stoch(rsinp, rsinp, rsinp, 14, 3, 3)data['fastk'] = np.concatenate([np.empty(31) * np.nan, fastk])data['fastd'] = np.concatenate([np.empty(31) * np.nan, fastd])
NOTE: ta.STOCHRSI issue.
The following produce quite similar result with minor differences.
rsi = ta.RSI(data['Close'])data['fastk'], data['fastd'] = ta.STOCH(rsi, rsi, rsi)
rsi = ta.RSI(data['Close'])rsinp = rsi.valuesrsinp = rsinp[np.logical_not(np.isnan(rsinp))]data['fastk'], data['fastd'] = ta.STOCH(rsinp , rsinp, rsinp)