Skip to content

Commit

Permalink
Merge pull request #2 from amedeiros/revert-1-patch-20-21
Browse files Browse the repository at this point in the history
Revert "fix issues tradytics#20 tradytics#21 by update params for TA"
  • Loading branch information
amedeiros committed Sep 29, 2021
2 parents 1560d88 + 7dcdc10 commit a09e113
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions feature_generator.py
Expand Up @@ -42,14 +42,14 @@ def get_technical_indicators(self, price_data):
# RSI
rsi_history = [5, 10, 15]
for history in rsi_history:
rsi = ta.momentum.RSIIndicator(price_data['Close'], window=history, fillna=True).rsi().values.tolist()
rsi = ta.momentum.RSIIndicator(price_data['Close'], n = history, fillna = True).rsi().values.tolist()
slope_rsi, r_value_rsi, p_value_rsi = self.calculate_slope(rsi[-self.HISTORY_TO_USE:])
technical_indicators_dictionary["rsi-" + str(history)] = rsi[-self.HISTORY_TO_USE:] + [slope_rsi, r_value_rsi, p_value_rsi]

# Stochastics
stochastic_history = [5, 10, 15]
for history in stochastic_history:
stochs = ta.momentum.StochasticOscillator(price_data['High'], price_data['Low'], price_data['Close'], window=history, smooth_window=int(history/3), fillna=True).stoch().values.tolist()
stochs = ta.momentum.StochasticOscillator(price_data['High'], price_data['Low'], price_data['Close'], n = history, d_n = int(history/3), fillna = True).stoch().values.tolist()
slope_stoch, r_value_stoch, p_value_stoch = self.calculate_slope(stochs[-self.HISTORY_TO_USE:])
technical_indicators_dictionary["stochs-" + str(history)] = stochs[-self.HISTORY_TO_USE:] + [slope_stoch, r_value_stoch, p_value_stoch]

Expand All @@ -62,14 +62,14 @@ def get_technical_indicators(self, price_data):
# Ease of movement
eom_history = [5, 10, 20]
for history in eom_history:
eom = ta.volume.ease_of_movement(price_data['High'], price_data['Low'], price_data['Volume'], window=history, fillna=True).values.tolist()
eom = ta.volume.ease_of_movement(price_data['High'], price_data['Low'], price_data['Volume'], n=history, fillna=True).values.tolist()
slope_eom, r_value_eom, p_value_eom = self.calculate_slope(eom[-self.HISTORY_TO_USE:])
technical_indicators_dictionary["eom-" + str(history)] = [slope_eom, r_value_eom, p_value_eom]

# CCI
cci_history = [5, 10, 20]
for history in cci_history:
cci = ta.trend.cci(price_data['High'], price_data['Low'], price_data['Close'], window=history, constant=0.015, fillna=True).values.tolist()
cci = ta.trend.cci(price_data['High'], price_data['Low'], price_data['Close'], n=history, c=0.015, fillna=True).values.tolist()
slope_cci, r_value_cci, p_value_cci = self.calculate_slope(cci[-self.HISTORY_TO_USE:])
technical_indicators_dictionary["cci-" + str(history)] = cci[-self.HISTORY_TO_USE:] + [slope_cci, r_value_cci, p_value_cci]

Expand Down

0 comments on commit a09e113

Please sign in to comment.