Nexo-S commited on
Commit
c8cf459
·
verified ·
1 Parent(s): a73aac1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -1
app.py CHANGED
@@ -157,6 +157,17 @@ async def prepare_all_features(symbol, timeframe='1h'):
157
  df['VOL_RATIO'] = df['vol'] / df['vol'].rolling(20).mean()
158
  df['vol_lag1'] = df['vol'].shift(1)
159
  df["RSI_Macro"] = df["RSI"]
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  return df.dropna().copy()
162
 
@@ -212,6 +223,20 @@ async def predict_signal(symbol, timeframe="1h"):
212
 
213
  final_p = (time_prob * wt) + (ml_prob * wm) + (lstm_prob * wl) + (p_sent * ws)
214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  # 4. CALCUL DU SCORE & RISK (INSTITUTIONAL GRADE)
216
  strength = abs(final_p - 0.5) * 2
217
  conf_val = max(0, min(1, 1 - np.std([time_prob, ml_prob, lstm_prob, p_sent])))
@@ -266,7 +291,8 @@ async def predict_signal(symbol, timeframe="1h"):
266
  "final_score": round(final_p, 4),
267
  "score": int(composite_score),
268
  "risk_percent": round(risk_pct, 2),
269
- "estimated_profit": round(gain_estime_usd, 2),
 
270
  "price": prix,
271
  "tp": round(tp, 6),
272
  "sl": round(sl, 6),
 
157
  df['VOL_RATIO'] = df['vol'] / df['vol'].rolling(20).mean()
158
  df['vol_lag1'] = df['vol'].shift(1)
159
  df["RSI_Macro"] = df["RSI"]
160
+
161
+ # --- 🐋 SMART MONEY CONCEPTS (LIQUIDITY SWEEPS) ---
162
+ # On repère les anciens plus bas / plus hauts majeurs
163
+ prev_low = df["low"].rolling(24).min().shift(1)
164
+ prev_high = df["high"].rolling(24).max().shift(1)
165
+
166
+ # Piège Vendeur (Sweep Low) : La mèche casse le support, mais le prix remonte clôturer au-dessus
167
+ df["Sweep_Low"] = ((df["low"] < prev_low) & (df["close"] > prev_low)).astype(int)
168
+
169
+ # Piège Acheteur (Sweep High) : La mèche casse la résistance, mais le prix retombe clôturer en dessous
170
+ df["Sweep_High"] = ((df["high"] > prev_high) & (df["close"] < prev_high)).astype(int)
171
 
172
  return df.dropna().copy()
173
 
 
223
 
224
  final_p = (time_prob * wt) + (ml_prob * wm) + (lstm_prob * wl) + (p_sent * ws)
225
 
226
+ # --- 🐋 BOOST SMART MONEY (CHASSE AUX BALEINES) ---
227
+ sweep_low = int(last_row["Sweep_Low"].iloc[0])
228
+ sweep_high = int(last_row["Sweep_High"].iloc[0])
229
+ smc_status = "AUCUN"
230
+
231
+ if sweep_low == 1:
232
+ # Les baleines ont piégé les vendeurs, le marché va exploser à la hausse
233
+ final_p = min(0.95, final_p + 0.20)
234
+ smc_status = "LONG SWEEP DETECTED 🐋"
235
+ elif sweep_high == 1:
236
+ # Les baleines ont piégé les acheteurs, le marché va s'effondrer
237
+ final_p = max(0.05, final_p - 0.20)
238
+ smc_status = "SHORT SWEEP DETECTED 🐋"
239
+
240
  # 4. CALCUL DU SCORE & RISK (INSTITUTIONAL GRADE)
241
  strength = abs(final_p - 0.5) * 2
242
  conf_val = max(0, min(1, 1 - np.std([time_prob, ml_prob, lstm_prob, p_sent])))
 
291
  "final_score": round(final_p, 4),
292
  "score": int(composite_score),
293
  "risk_percent": round(risk_pct, 2),
294
+ "estimated_profit": round(gain_estime_usd, 2),
295
+ "smart_money": smc_status,
296
  "price": prix,
297
  "tp": round(tp, 6),
298
  "sl": round(sl, 6),