Boulder-Investment-Technologies / lppls

Library for fitting the LPPLS model to data.
MIT License
345 stars 107 forks source link

add future days forecast for the fitted lines #97

Open GXY2017 opened 11 months ago

GXY2017 commented 11 months ago

I tried to extend the fitted line into future days. It would be useful to update the lppls_model.plot_fit() function.

#  extend
new_dates = pd.date_range(start=data.index[-1] + pd.Timedelta(days=1), periods=500)
t = [pd.Timestamp.toordinal(timestamp) for timestamp in new_dates]
y = a + np.power(tc - t, m) * (b + ((c1 * np.cos(w * np.log(tc - t))) + (c2 * np.sin(w * np.log(tc - t)))))

plt.plot(new_dates, y)
plt.show()

image

Joshwani commented 4 months ago

yes, this would be very nice to have indeed.