MCPcopy
hub / github.com/tradytics/surpriver / calculate_slope

Method calculate_slope

feature_generator.py:27–34  ·  view source on GitHub ↗

Calculate slope, p value, and r^2 value given some data

(self, data)

Source from the content-addressed store, hash-verified

25 self.HISTORY_TO_USE = history_to_use
26
27 def calculate_slope(self, data):
28 """
29 Calculate slope, p value, and r^2 value given some data
30 """
31 x_axis = np.arange(len(data))
32 regression_model = linregress(x_axis, data)
33 slope, r_value, p_value = round(regression_model.slope, 3), round(abs(regression_model.rvalue), 3), round(regression_model.pvalue, 4)
34 return slope, r_value, p_value
35
36 def get_technical_indicators(self, price_data):
37 """

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected