Phase 3: Real-time enhancements

P3-1: Scan optimization — only BG↔HL (50+ pair combos → 2)
P3-2: Real-time spread chart — spreadHistory ring buffer +
      /api/spread-history endpoint + Chart.js spread chart
P3-3: Live position PnL — positions SSE now includes
      estimated current profit/loss + current spread
P3-4: Real-time trade events — trader.OnTradeEvent callback
      fires SSE 'trade_open' / 'trade_close' immediately
P3-5: Connection status monitoring — tracks last update time
      per exchange, broadcast via stats.connections + /api/connections

Frontend: spread chart card, PnL column in positions,
          connection status dots in stats bar,
          green/red border flash on trade events
This commit is contained in:
jackyu66git
2026-05-03 18:05:19 +08:00
parent da561325d7
commit beb3611778
7 changed files with 528 additions and 316 deletions
+5
View File
@@ -91,6 +91,11 @@ header h1 { font-size: 18px; font-weight: 600; }
.pct-yellow { color: var(--yellow); }
.pct-blue { color: var(--blue); }
/* Connection status dots */
#conn-details { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#conn-detail { font-size: 11px; white-space: nowrap; }
#conn-detail span { margin-right: 4px; font-size: 10px; }
/* Tables */
.table-wrap {
overflow-x: auto;