KarlQuant commited on
Commit
7575d6f
Β·
verified Β·
1 Parent(s): b23d064

Update hub_dashboard_service.py

Browse files
Files changed (1) hide show
  1. 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 (SELF-CONTAINED β€” all /api/ranker/logs/* routes inline) β•‘
8
  β•‘ β•‘
9
- β•‘ FIXES APPLIED: β•‘
10
- β•‘ βœ… FIX v2.4: All /api/ranker/logs/* routes moved inline (Blueprint removed) β•‘
11
- β•‘ βœ… FIX v2.4: Category filter uses exact field match (not substring) β•‘
12
- β•‘ βœ… FIX v2.4: Log directory auto-created on startup if missing β•‘
13
- β•‘ βœ… FIX #1: Include rotated log files (*.log, *.log.1, *.log.2, etc.) β•‘
14
- β•‘ βœ… FIX #2: Improved regex to catch all trade close formats β•‘
15
- β•‘ βœ… FIX #3: Added unrealized P&L tracking for open positions β•‘
 
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
- # FIX v2.4 Bug#4: Use exact category field match, not substring search on raw line
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: