Last active
April 20, 2022 18:46
-
-
Save silgon/65b4932c007aca40dd5a0a79242be05c to your computer and use it in GitHub Desktop.
peak_indicator
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
import pandas_datareader as pdr | |
import matplotlib.pyplot as plt | |
from statsmodels.tsa.arima_model import ARIMA | |
from scipy.signal import find_peaks | |
data = pdr.get_data_yahoo("FR.PA") | |
data_ = data[data.index>"2017"] | |
# find_peaks(data_["Volume"]) | |
peaks = find_peaks(data_["Volume"],threshold=10**6)[0] | |
plt.clf() | |
plt.subplot(211) | |
plt.plot(data_.index, data_["Close"], linewidth=1) | |
plt.ylabel("Price (€)") | |
for peak in data_.index[peaks]: | |
plt.axvline(x=peak, color='gray', linestyle='--', linewidth=1, alpha=0.5) | |
plt.subplot(212) | |
plt.plot(data_.index, data_["Volume"], linewidth=1) | |
for peak in data_.index[peaks]: | |
plt.axvline(x=peak, color='gray', linestyle='--', linewidth=1, alpha=0.5) | |
plt.ylabel("Volume") | |
plt.xlabel("Date") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment