Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# app.py (V11.1 -
|
| 2 |
import os
|
| 3 |
import traceback
|
| 4 |
import signal
|
|
@@ -157,6 +157,8 @@ async def run_explorer_cycle():
|
|
| 157 |
# ج. التحليل العميق المتوازي (Layer 1.2 & 1.3)
|
| 158 |
print(f"🔬 [Explorer] تحليل عميق لـ {len(candidates_l1)} عملة...")
|
| 159 |
analyzed_candidates = []
|
|
|
|
|
|
|
| 160 |
data_queue = asyncio.Queue(maxsize=5) # طابور صغير لتوفير الذاكرة
|
| 161 |
|
| 162 |
# تشغيل المنتج (جلب البيانات) والمستهلك (التحليل) بالتوازي
|
|
@@ -174,8 +176,11 @@ async def run_explorer_cycle():
|
|
| 174 |
|
| 175 |
for res in results:
|
| 176 |
if res and isinstance(res, dict):
|
|
|
|
|
|
|
|
|
|
| 177 |
# شرط التأهل للقرار النهائي: درجة >= 60%
|
| 178 |
-
if
|
| 179 |
analyzed_candidates.append(res)
|
| 180 |
|
| 181 |
data_queue.task_done()
|
|
@@ -206,7 +211,19 @@ async def run_explorer_cycle():
|
|
| 206 |
# تحديث قائمة الحارس
|
| 207 |
await trade_manager_global.update_sentry_watchlist(watchlist)
|
| 208 |
else:
|
| 209 |
-
print("📉 [Explorer] لا يوجد مرشحين مؤهلين بعد التحليل العميق.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
await trade_manager_global.update_sentry_watchlist([])
|
| 211 |
|
| 212 |
except Exception as e:
|
|
@@ -299,4 +316,5 @@ async def startup_event():
|
|
| 299 |
|
| 300 |
if __name__ == "__main__":
|
| 301 |
# تشغيل الخادم
|
| 302 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
|
|
| 1 |
+
# app.py (V11.1.1 - With Diagnostic Prints)
|
| 2 |
import os
|
| 3 |
import traceback
|
| 4 |
import signal
|
|
|
|
| 157 |
# ج. التحليل العميق المتوازي (Layer 1.2 & 1.3)
|
| 158 |
print(f"🔬 [Explorer] تحليل عميق لـ {len(candidates_l1)} عملة...")
|
| 159 |
analyzed_candidates = []
|
| 160 |
+
all_results_debug = [] # (V11.1.1) لتخزين كل النتائج لأغراض التشخيص
|
| 161 |
+
|
| 162 |
data_queue = asyncio.Queue(maxsize=5) # طابور صغير لتوفير الذاكرة
|
| 163 |
|
| 164 |
# تشغيل المنتج (جلب البيانات) والمستهلك (التحليل) بالتوازي
|
|
|
|
| 176 |
|
| 177 |
for res in results:
|
| 178 |
if res and isinstance(res, dict):
|
| 179 |
+
score = res.get('enhanced_final_score', 0)
|
| 180 |
+
all_results_debug.append(res) # تخزين للتشخيص
|
| 181 |
+
|
| 182 |
# شرط التأهل للقرار النهائي: درجة >= 60%
|
| 183 |
+
if score >= 0.60:
|
| 184 |
analyzed_candidates.append(res)
|
| 185 |
|
| 186 |
data_queue.task_done()
|
|
|
|
| 211 |
# تحديث قائمة الحارس
|
| 212 |
await trade_manager_global.update_sentry_watchlist(watchlist)
|
| 213 |
else:
|
| 214 |
+
print("📉 [Explorer] لا يوجد مرشحين مؤهلين (Score >= 0.60) بعد التحليل العميق.")
|
| 215 |
+
|
| 216 |
+
# (V11.1.1) طباعة تشخيصية لأفضل الفاشلين
|
| 217 |
+
if all_results_debug:
|
| 218 |
+
print("\n🔍 [Debug Explorer] أفضل 10 عملات مرفوضة:")
|
| 219 |
+
all_results_debug.sort(key=lambda x: x.get('enhanced_final_score', 0), reverse=True)
|
| 220 |
+
for i, fail in enumerate(all_results_debug[:10]):
|
| 221 |
+
sc = fail.get('enhanced_final_score', 0)
|
| 222 |
+
pat = fail.get('pattern_analysis', {}).get('pattern_confidence', 0)
|
| 223 |
+
mc = fail.get('monte_carlo_distribution', {}).get('probability_of_gain', 0)
|
| 224 |
+
print(f" #{i+1} {fail['symbol']}: {sc:.2f} [Patterns: {pat:.2f} | MC_Prob: {mc:.2f}]")
|
| 225 |
+
print("")
|
| 226 |
+
|
| 227 |
await trade_manager_global.update_sentry_watchlist([])
|
| 228 |
|
| 229 |
except Exception as e:
|
|
|
|
| 316 |
|
| 317 |
if __name__ == "__main__":
|
| 318 |
# تشغيل الخادم
|
| 319 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 320 |
+
}
|