Created
November 22, 2020 22:03
-
-
Save alexrios22/e4a25acd725efe7d460030d173431c4f to your computer and use it in GitHub Desktop.
Trend.ibpynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window = 253 | |
# detrend tome series by MA | |
ratesM = data['Adj Close'].rolling(window).mean().dropna() | |
ratesD = data['Adj Close'].reindex(ratesM.index).sub(ratesM) | |
fig, axs = plt.subplots(2, figsize=(16, 8), sharex=True) | |
data['Adj Close'].plot(ax=axs[0], title="Trend") | |
ratesM.plot(ax=axs[0]) | |
ratesD.plot(ax=axs[1], c="g", title="Residuals"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment