Advertisement
Guest User

Untitled

a guest
Aug 11th, 2021
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. index 4ac7a3f..6449af1 100644
  2. --- a/feature_generator.py
  3. +++ b/feature_generator.py
  4. @@ -42,14 +42,14 @@ class TAEngine:
  5. # RSI
  6. rsi_history = [5, 10, 15]
  7. for history in rsi_history:
  8. - rsi = ta.momentum.RSIIndicator(price_data['Close'], n = history, fillna = True).rsi().values.tolist()
  9. + rsi = ta.momentum.RSIIndicator(price_data['Close'], window=history, fillna=True).rsi().values.tolist()
  10. slope_rsi, r_value_rsi, p_value_rsi = self.calculate_slope(rsi[-self.HISTORY_TO_USE:])
  11. technical_indicators_dictionary["rsi-" + str(history)] = rsi[-self.HISTORY_TO_USE:] + [slope_rsi, r_value_rsi, p_value_rsi]
  12.  
  13. # Stochastics
  14. stochastic_history = [5, 10, 15]
  15. for history in stochastic_history:
  16. - 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()
  17. + 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()
  18. slope_stoch, r_value_stoch, p_value_stoch = self.calculate_slope(stochs[-self.HISTORY_TO_USE:])
  19. technical_indicators_dictionary["stochs-" + str(history)] = stochs[-self.HISTORY_TO_USE:] + [slope_stoch, r_value_stoch, p_value_stoch]
  20.  
  21. @@ -62,14 +62,14 @@ class TAEngine:
  22. # Ease of movement
  23. eom_history = [5, 10, 20]
  24. for history in eom_history:
  25. - eom = ta.volume.ease_of_movement(price_data['High'], price_data['Low'], price_data['Volume'], n=history, fillna=True).values.tolist()
  26. + eom = ta.volume.ease_of_movement(price_data['High'], price_data['Low'], price_data['Volume'], window=history, fillna=True).values.tolist()
  27. slope_eom, r_value_eom, p_value_eom = self.calculate_slope(eom[-self.HISTORY_TO_USE:])
  28. technical_indicators_dictionary["eom-" + str(history)] = [slope_eom, r_value_eom, p_value_eom]
  29.  
  30. # CCI
  31. cci_history = [5, 10, 20]
  32. for history in cci_history:
  33. - cci = ta.trend.cci(price_data['High'], price_data['Low'], price_data['Close'], n=history, c=0.015, fillna=True).values.tolist()
  34. + cci = ta.trend.cci(price_data['High'], price_data['Low'], price_data['Close'], window=history, constant=0.015, fillna=True).values.tolist()
  35. slope_cci, r_value_cci, p_value_cci = self.calculate_slope(cci[-self.HISTORY_TO_USE:])
  36. technical_indicators_dictionary["cci-" + str(history)] = cci[-self.HISTORY_TO_USE:] + [slope_cci, r_value_cci, p_value_cci]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement