Nexo-S commited on
Commit
99c64e0
·
verified ·
1 Parent(s): 406c49f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -456,10 +456,15 @@ async def dream_simulation_loop():
456
  # --- ⚖️ JUDGE API ---
457
  def run_judge_api(live_prices_json="{}"):
458
  try:
 
459
  # --- LECTURE DES PRIX DU BRAS (EXNESS) ---
460
  import json
461
- try: live_prices = json.loads(live_prices_json) if isinstance(live_prices_json, str) else {}
462
- except: live_prices = {}
 
 
 
 
463
 
464
  with sqlite3.connect(DB_NAME, timeout=10) as conn:
465
  conn.row_factory, cursor = sqlite3.Row, conn.cursor()
@@ -499,15 +504,16 @@ def run_judge_api(live_prices_json="{}"):
499
  for t in trades:
500
  try:
501
  sym_db = t['symbol']
502
- epic = sym_db.replace("/", "").replace("USDT", "USD")
 
503
  if not epic.endswith("m"): epic += "m"
504
 
505
- # 🔥 PERFECT SYNC : On utilise d'abord le prix du broker (Exness) envoyé par le Bras !
506
  current_price = None
507
  if epic in live_prices:
508
  current_price = float(live_prices[epic])
509
 
510
- # Fallback sur KuCoin Spot si le bras n'a pas envoyé le prix
511
  if current_price is None:
512
  f_sym = sym_db if "/USDT" in sym_db else sym_db.replace("/USD", "/USDT")
513
  if "/" not in f_sym: f_sym += "/USDT"
 
456
  # --- ⚖️ JUDGE API ---
457
  def run_judge_api(live_prices_json="{}"):
458
  try:
459
+ try:
460
  # --- LECTURE DES PRIX DU BRAS (EXNESS) ---
461
  import json
462
+ try:
463
+ raw_prices = json.loads(live_prices_json) if isinstance(live_prices_json, str) else {}
464
+ # 🔥 CORRECTION : On force tous les symboles d'Exness en minuscules pour la lecture
465
+ live_prices = {k.lower(): v for k, v in raw_prices.items()}
466
+ except:
467
+ live_prices = {}
468
 
469
  with sqlite3.connect(DB_NAME, timeout=10) as conn:
470
  conn.row_factory, cursor = sqlite3.Row, conn.cursor()
 
504
  for t in trades:
505
  try:
506
  sym_db = t['symbol']
507
+ # 🔥 CORRECTION : On force le symbole de la DB en minuscules !
508
+ epic = sym_db.replace("/", "").replace("USDT", "USD").lower()
509
  if not epic.endswith("m"): epic += "m"
510
 
511
+ # 📡 PERFECT SYNC (Maintenant ça va marcher à 100%)
512
  current_price = None
513
  if epic in live_prices:
514
  current_price = float(live_prices[epic])
515
 
516
+ # Fallback sur KuCoin
517
  if current_price is None:
518
  f_sym = sym_db if "/USDT" in sym_db else sym_db.replace("/USD", "/USDT")
519
  if "/" not in f_sym: f_sym += "/USDT"