Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,12 +103,17 @@ coins = {
|
|
| 103 |
"Stellar": "stellar"
|
| 104 |
}
|
| 105 |
|
| 106 |
-
#
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
# Affichage des graphiques
|
| 110 |
-
st.title("Analyse et Prédictions
|
| 111 |
-
|
|
|
|
| 112 |
if price_data:
|
| 113 |
df = pd.DataFrame(price_data, columns=["timestamp", "price"])
|
| 114 |
df["timestamp"] = pd.to_datetime(df["timestamp"], unit="ms")
|
|
@@ -123,7 +128,7 @@ for coin, price_data in crypto_prices.items():
|
|
| 123 |
green_prediction = generate_dynamic_prediction(df, initial_prediction, future_hours=24)
|
| 124 |
|
| 125 |
# Affichage des résultats
|
| 126 |
-
st.write(f"#### {
|
| 127 |
fig, ax = plt.subplots(figsize=(12, 6))
|
| 128 |
ax.plot(df["timestamp"], df["price"], label="Prix réel", color="blue")
|
| 129 |
|
|
@@ -133,8 +138,8 @@ for coin, price_data in crypto_prices.items():
|
|
| 133 |
# Courbe de prédiction dynamique (verte)
|
| 134 |
ax.plot(future_timestamps, green_prediction, label="Prédiction dynamique (verte)", linestyle="--", color="green")
|
| 135 |
|
| 136 |
-
ax.set_title(f"{
|
| 137 |
ax.set_xlabel("Date")
|
| 138 |
ax.set_ylabel("Prix (USD)")
|
| 139 |
ax.legend()
|
| 140 |
-
st.pyplot(fig)
|
|
|
|
| 103 |
"Stellar": "stellar"
|
| 104 |
}
|
| 105 |
|
| 106 |
+
# Sélectionner la crypto avec Streamlit
|
| 107 |
+
selected_coin = st.selectbox("Sélectionnez une crypto", list(coins.keys()))
|
| 108 |
+
|
| 109 |
+
# Récupération des prix pour la crypto sélectionnée
|
| 110 |
+
coin_id = coins[selected_coin]
|
| 111 |
+
crypto_prices = get_crypto_prices({selected_coin: coin_id}, start_time, end_time)
|
| 112 |
|
| 113 |
# Affichage des graphiques
|
| 114 |
+
st.title(f"Analyse et Prédictions pour {selected_coin} avec Patterns")
|
| 115 |
+
if selected_coin in crypto_prices:
|
| 116 |
+
price_data = crypto_prices[selected_coin]
|
| 117 |
if price_data:
|
| 118 |
df = pd.DataFrame(price_data, columns=["timestamp", "price"])
|
| 119 |
df["timestamp"] = pd.to_datetime(df["timestamp"], unit="ms")
|
|
|
|
| 128 |
green_prediction = generate_dynamic_prediction(df, initial_prediction, future_hours=24)
|
| 129 |
|
| 130 |
# Affichage des résultats
|
| 131 |
+
st.write(f"#### {selected_coin} - Prix et Prédictions")
|
| 132 |
fig, ax = plt.subplots(figsize=(12, 6))
|
| 133 |
ax.plot(df["timestamp"], df["price"], label="Prix réel", color="blue")
|
| 134 |
|
|
|
|
| 138 |
# Courbe de prédiction dynamique (verte)
|
| 139 |
ax.plot(future_timestamps, green_prediction, label="Prédiction dynamique (verte)", linestyle="--", color="green")
|
| 140 |
|
| 141 |
+
ax.set_title(f"{selected_coin} - Prix (7 derniers jours + 24h prévus)")
|
| 142 |
ax.set_xlabel("Date")
|
| 143 |
ax.set_ylabel("Prix (USD)")
|
| 144 |
ax.legend()
|
| 145 |
+
st.pyplot(fig)
|