Scripts calcul hyperopt multiple

This commit is contained in:
Jérôme Delacotte
2025-10-26 16:20:33 +01:00
parent 04c7d190b1
commit f6951fd56f
6 changed files with 219 additions and 21 deletions

View File

@@ -0,0 +1,27 @@
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import make_interp_spline
from scipy.signal import savgol_filter
np.random.seed(42)
# Générer 100 valeurs simulant un prix réel avec fluctuations
t = np.arange(100)
trend = np.sin(t/10) * 2 # tendance ondulante
noise = np.random.randn(100) * 0.5 # bruit
prices = 50 + trend + noise # prix centré autour de 50
df = pd.DataFrame({"price": prices})
df["ema5"] = df["price"].ewm(span=5, adjust=False).mean()
# ATTENTION cela regarde dans le futur
df["ema5_savgol"] = savgol_filter(df["ema5"], window_length=21, polyorder=3)
# Plot
# fenetre=21 points, poly order 3
plt.plot(df["price"], alpha=0.5, label="Prix")
plt.plot(df["ema5_savgol"], label="EMA5 lissée Savitzky-Golay", color="red")
plt.legend()
plt.show()