Spaces:
Running
Running
Update hub_dashboard_service.py
Browse files- hub_dashboard_service.py +10 -15
hub_dashboard_service.py
CHANGED
|
@@ -4,15 +4,16 @@
|
|
| 4 |
β K1RL QUASAR β HUB DASHBOARD SERVICE (with Trade Log Parser) β FIXED v2.4 β
|
| 5 |
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 6 |
β Architecture role: READ-ONLY subscriber β serves dashboard UI β
|
| 7 |
-
β VERSION: v2.4 (
|
| 8 |
β β
|
| 9 |
-
β FIXES APPLIED:
|
| 10 |
-
β β
FIX v2.4: All /api/ranker/logs/* routes
|
| 11 |
-
β β
FIX v2.4:
|
| 12 |
-
β β
FIX
|
| 13 |
-
β β
FIX #
|
| 14 |
-
β β
FIX #
|
| 15 |
-
β
|
|
|
|
| 16 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 17 |
"""
|
| 18 |
|
|
@@ -431,11 +432,6 @@ class FileBasedLoggerAdapter:
|
|
| 431 |
def __init__(self, log_dir: str = _LOG_DIR):
|
| 432 |
self._log_dir = log_dir
|
| 433 |
self._lock = threading.RLock()
|
| 434 |
-
# FIX v2.4 Bug#3: Auto-create log directory so ranker can start writing without a manual mkdir
|
| 435 |
-
try:
|
| 436 |
-
Path(self._log_dir).mkdir(parents=True, exist_ok=True)
|
| 437 |
-
except OSError as _mkdir_err:
|
| 438 |
-
logger.warning(f"[FileBasedLoggerAdapter] Could not create log dir {self._log_dir}: {_mkdir_err}")
|
| 439 |
|
| 440 |
# ββ Internal helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 441 |
|
|
@@ -492,8 +488,7 @@ class FileBasedLoggerAdapter:
|
|
| 492 |
e = self._line_to_entry(line)
|
| 493 |
if e is None:
|
| 494 |
continue
|
| 495 |
-
|
| 496 |
-
if category and e.get("category", "").upper() != category.upper():
|
| 497 |
continue
|
| 498 |
entries.append(e)
|
| 499 |
if len(entries) >= n:
|
|
|
|
| 4 |
β K1RL QUASAR β HUB DASHBOARD SERVICE (with Trade Log Parser) β FIXED v2.4 β
|
| 5 |
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
| 6 |
β Architecture role: READ-ONLY subscriber β serves dashboard UI β
|
| 7 |
+
β VERSION: v2.4 (ROUTES INLINE) | 2026-04-04 β
|
| 8 |
β β
|
| 9 |
+
β FIXES APPLIED: β
|
| 10 |
+
β β
FIX v2.4: All /api/ranker/logs/* routes inline β no Blueprint dependency β
|
| 11 |
+
β β
FIX v2.4: Training KPI enrichment (_enrich_training) applied on /recent β
|
| 12 |
+
β β
FIX #1: Include rotated log files (*.log, *.log.1, *.log.2, etc.) β
|
| 13 |
+
β β
FIX #2: Improved regex to catch all trade close formats β
|
| 14 |
+
β β
FIX #3: Added unrealized P&L tracking for open positions β
|
| 15 |
+
β β
|
| 16 |
+
β DEPLOYMENT: Just restart the service β routes are already inline in this file. β
|
| 17 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 18 |
"""
|
| 19 |
|
|
|
|
| 432 |
def __init__(self, log_dir: str = _LOG_DIR):
|
| 433 |
self._log_dir = log_dir
|
| 434 |
self._lock = threading.RLock()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
|
| 436 |
# ββ Internal helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 437 |
|
|
|
|
| 488 |
e = self._line_to_entry(line)
|
| 489 |
if e is None:
|
| 490 |
continue
|
| 491 |
+
if category and category.upper() not in line.upper():
|
|
|
|
| 492 |
continue
|
| 493 |
entries.append(e)
|
| 494 |
if len(entries) >= n:
|