Riy777 commited on
Commit
c57dd8f
·
verified ·
1 Parent(s): b271aec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -8
app.py CHANGED
@@ -1,5 +1,5 @@
1
  # ==============================================================================
2
- # 🚀 app.py (V61.0 - GEM-Architect: Type Stats UI)
3
  # ==============================================================================
4
 
5
  import os
@@ -182,7 +182,7 @@ async def auto_pilot_loop():
182
  async def lifespan(app: FastAPI):
183
  global r2, data_manager, ml_processor, adaptive_hub, trade_manager, whale_monitor, news_fetcher, senti_analyzer, sys_state, scheduler
184
 
185
- logger.info("\n🚀 [System] Startup Sequence (Titan V61.0 - Dual Classification)...")
186
  try:
187
  r2 = R2Service()
188
  data_manager = DataManager(contracts_db={}, whale_monitor=None, r2_service=r2)
@@ -349,18 +349,30 @@ async def run_unified_cycle():
349
  except Exception: pass
350
 
351
  final_score = l2_score + whale_points + news_points + mc_a_points
 
 
 
 
352
  sig['final_total_score'] = final_score
353
  final_candidates.append(sig)
354
 
355
  final_candidates.sort(key=lambda x: x['final_total_score'], reverse=True)
356
 
357
  approved_signals = []
358
- log_and_print("-" * 110)
359
- log_and_print(f"{'SYM':<9} | {'TYPE':<12} | {'FINAL':<6} | {'ORACLE':<6} | {'STATUS'}")
 
 
 
 
 
 
360
 
361
  for sig in final_candidates:
362
  symbol = sig['symbol']
 
363
  decision = await ml_processor.consult_oracle(sig)
 
364
  action = decision.get('action', 'WAIT')
365
  oracle_conf = decision.get('confidence', 0.0)
366
  target_class = decision.get('target_class', '')
@@ -371,10 +383,30 @@ async def run_unified_cycle():
371
  sig.update(decision)
372
  approved_signals.append(sig)
373
 
374
- log_and_print(f"{symbol:<9} | {sig.get('strategy_type','N/A'):<12} | {sig.get('final_total_score',0):.2f} | {oracle_conf:.2f} | {status_str}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
 
376
  if approved_signals:
377
- log_and_print("-" * 110)
378
  log_and_print(f" [4/5] 🎯 L4 Sniper -> 🏛️ Governance -> 💰 Portfolio ({len(approved_signals)} candidates)...")
379
  tm_log_buffer = StringIO()
380
 
@@ -712,10 +744,10 @@ async def check_live_pnl_and_status(selected_view="Dual-Core (Hybrid)"):
712
  def create_gradio_ui():
713
  custom_css = ".gradio-container {background:#0b0f19} .dataframe {background:#1a1a1a!important} .html-box {min-height:180px}"
714
 
715
- with gr.Blocks(title="Titan V61.0 (Dual-Type Dashboard)") as demo:
716
  gr.HTML(f"<style>{custom_css}</style>")
717
 
718
- gr.Markdown("# 🚀 Titan V61.0 (Cybernetic: Dual-Type Engine)")
719
 
720
  with gr.Row():
721
  with gr.Column(scale=3):
 
1
  # ==============================================================================
2
+ # 🚀 app.py (V61.2 - GEM-Architect: Full Diagnostics Restored)
3
  # ==============================================================================
4
 
5
  import os
 
182
  async def lifespan(app: FastAPI):
183
  global r2, data_manager, ml_processor, adaptive_hub, trade_manager, whale_monitor, news_fetcher, senti_analyzer, sys_state, scheduler
184
 
185
+ logger.info("\n🚀 [System] Startup Sequence (Titan V61.2 - Full Diagnostics)...")
186
  try:
187
  r2 = R2Service()
188
  data_manager = DataManager(contracts_db={}, whale_monitor=None, r2_service=r2)
 
349
  except Exception: pass
350
 
351
  final_score = l2_score + whale_points + news_points + mc_a_points
352
+
353
+ sig['whale_score'] = whale_points
354
+ sig['news_score'] = news_points
355
+ sig['mc_advanced_score'] = mc_a_points
356
  sig['final_total_score'] = final_score
357
  final_candidates.append(sig)
358
 
359
  final_candidates.sort(key=lambda x: x['final_total_score'], reverse=True)
360
 
361
  approved_signals = []
362
+
363
+ # FIX: إعادة عرض الجدول التفصيلي كاملاً مع إضافة العمود الجديد (TYPE)
364
+ header = (f"{'SYM':<9} | {'TYPE':<10} | {'L2':<5} | {'TITAN':<5} | {'PATT':<5} | "
365
+ f"{'WHALE':<6} | {'MC(A)':<6} | {'FINAL':<6} | {'ORACLE':<6} | {'STATUS'}")
366
+
367
+ log_and_print("-" * 115)
368
+ log_and_print(header)
369
+ log_and_print("-" * 115)
370
 
371
  for sig in final_candidates:
372
  symbol = sig['symbol']
373
+
374
  decision = await ml_processor.consult_oracle(sig)
375
+
376
  action = decision.get('action', 'WAIT')
377
  oracle_conf = decision.get('confidence', 0.0)
378
  target_class = decision.get('target_class', '')
 
383
  sig.update(decision)
384
  approved_signals.append(sig)
385
 
386
+ # استخراج القيم التفصيلية للعرض
387
+ l2_hybrid = sig.get('enhanced_final_score', 0.0)
388
+ titan_d = sig.get('titan_score', 0.0)
389
+ patt_d = sig.get('patterns_score', 0.0)
390
+ whale_d = sig.get('whale_score', 0.0)
391
+ mca_d = sig.get('mc_advanced_score', 0.0)
392
+ final_d = sig.get('final_total_score', 0.0)
393
+ strat_type = sig.get('strategy_type', 'N/A')
394
+
395
+ log_and_print(
396
+ f"{symbol:<9} | "
397
+ f"{strat_type:<10} | "
398
+ f"{l2_hybrid:.2f} | "
399
+ f"{titan_d:.2f} | "
400
+ f"{patt_d:.2f} | "
401
+ f"{whale_d:+.2f} | "
402
+ f"{mca_d:+.2f} | "
403
+ f"{final_d:.2f} | "
404
+ f"{oracle_conf:.2f} | "
405
+ f"{status_str}"
406
+ )
407
 
408
  if approved_signals:
409
+ log_and_print("-" * 115)
410
  log_and_print(f" [4/5] 🎯 L4 Sniper -> 🏛️ Governance -> 💰 Portfolio ({len(approved_signals)} candidates)...")
411
  tm_log_buffer = StringIO()
412
 
 
744
  def create_gradio_ui():
745
  custom_css = ".gradio-container {background:#0b0f19} .dataframe {background:#1a1a1a!important} .html-box {min-height:180px}"
746
 
747
+ with gr.Blocks(title="Titan V61.2 (Dual-Type Dashboard)") as demo:
748
  gr.HTML(f"<style>{custom_css}</style>")
749
 
750
+ gr.Markdown("# 🚀 Titan V61.2 (Cybernetic: Dual-Type Engine)")
751
 
752
  with gr.Row():
753
  with gr.Column(scale=3):