Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -452,8 +452,19 @@ async def dream_simulation_loop():
|
|
| 452 |
except: pass
|
| 453 |
await asyncio.sleep(60)
|
| 454 |
|
| 455 |
-
|
| 456 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 523 |
-
|
| 524 |
-
|
| 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)
|