Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_ppo():
"""test TA.PPO"""
ppo = TA.PPO(ohlc)
assert isinstance(ppo["PPO"], series.Series)
assert isinstance(ppo["SIGNAL"], series.Series)
assert isinstance(ppo["HISTO"], series.Series)
assert ppo["PPO"].values[-1] == -5.85551658018139331574047901085578
assert ppo["SIGNAL"].values[-1] == -5.05947256175217674467603501398116
assert ppo["HISTO"].values[-1] == -0.79604401842921657106444399687462
def calc_ta(self):
ta = [
TA.ER(self.ohlc),
TA.PPO(self.ohlc)["HISTO"],
TA.STOCHRSI(self.ohlc),
TA.ADX(self.ohlc),
TA.RSI(self.ohlc),
TA.COPP(self.ohlc),
TA.CCI(self.ohlc),
TA.CHAIKIN(self.ohlc),
TA.FISH(self.ohlc)
]
ta = np.array(ta).transpose()
ta[np.isnan(ta)] = 0
ta[np.isinf(ta)] = 0
# scale them to the same range
self.scaler = StandardScaler()
self.scaler.fit(ta)