Nexo-S commited on
Commit
3a52629
·
verified ·
1 Parent(s): eb90617

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -452,8 +452,19 @@ async def dream_simulation_loop():
452
  except: pass
453
  await asyncio.sleep(60)
454
 
455
- # --- ⚖️ JUDGE API ---
456
- # --- ⚖️ JUDGE API ---
 
 
 
 
 
 
 
 
 
 
 
457
  # --- ⚖️ JUDGE API ---
458
  def run_judge_api(live_prices_json="{}"):
459
  try:
@@ -518,10 +529,11 @@ def run_judge_api(live_prices_json="{}"):
518
  current_price = float(live_prices[epic])
519
 
520
  # Fallback sur KuCoin
 
521
  if current_price is None:
522
- f_sym = sym_db if "/USDT" in sym_db else sym_db.replace("/USD", "/USDT")
523
- if "/" not in f_sym: f_sym += "/USDT"
524
- current_price = exchange_sync.fetch_ticker(f_sym)['last']
525
 
526
  sl_dyn, peak = t['sl'], t['peak_price']
527
  new_peak = max(peak, current_price) if t['direction'] == 'HAUSSIER' else min(peak, current_price)
 
452
  except: pass
453
  await asyncio.sleep(60)
454
 
455
+ def should_send_signal(symbol, timeframe, proba):
456
+ key = (symbol, timeframe)
457
+ now = time.time()
458
+
459
+ if key in last_signals_sent:
460
+ last_proba, last_time = last_signals_sent[key]
461
+ # 1. Filtre de similitude (LaTeX pour la précision)
462
+ # On ignore si la proba a bougé de moins de 2%
463
+ if abs(last_proba - proba) < 0.02 and (now - last_time) < 600: # 10 min de cooldown
464
+ return False
465
+
466
+ last_signals_sent[key] = (proba, now)
467
+ return True
468
  # --- ⚖️ JUDGE API ---
469
  def run_judge_api(live_prices_json="{}"):
470
  try:
 
529
  current_price = float(live_prices[epic])
530
 
531
  # Fallback sur KuCoin
532
+ # ✅ ON REMPLACE PAR :
533
  if current_price is None:
534
+
535
+ print(f"⚠️ [SYNC WAIT] Prix Exness manquant pour {epic}. Juge en attente...")
536
+ continue
537
 
538
  sl_dyn, peak = t['sl'], t['peak_price']
539
  new_peak = max(peak, current_price) if t['direction'] == 'HAUSSIER' else min(peak, current_price)