- improved slope of fitted curve at the end

git-svn-id: http://moon:8086/svn/projects/Stock@315 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-12-13 23:36:29 +00:00
parent 94291d38e0
commit 6281e6f239
+4 -3
View File
@@ -238,13 +238,14 @@ class Symbol(object):
_macd_curr = self.data_full['macd'][len(self.data_full)-1]
self._macd_data = self.data_full['macd'][len(self.data_full) - show_range_days:]
x_r = list(range(0, len(self._macd_data)))
x_r = list(range(0, len(self._macd_data)+1))
y_r = self._macd_data.to_numpy()
y_r = np.append(y_r, y_r[len(y_r)-1])
poly = np.polyfit(x_r, y_r, N_poly)
poly_d = np.polyder(poly)
yf = np.polyval(poly, x_r)
yf_d = np.polyval(poly_d, x_r)
yf = np.polyval(poly, x_r[:len(x_r)-1])
yf_d = np.polyval(poly_d, x_r[:len(x_r)-1])
self._macd_fitted = pd.DataFrame(np.transpose([yf,yf_d]), index=self._macd_data.index, columns=['macd_fitted', 'macd_fitted_d'])
_macd_f_curr = self._macd_fitted['macd_fitted'][len(self._macd_fitted)-1]