Dashboard: intraday equity sparkline + per-position R bars; sync stop_price

Two more visualizations + the bug building them exposed:
- Equity-curve sparkline in the P&L strip: query_equity_curve returns the day's
  total_equity series + prior-close baseline (dashed); rendered as an inline SVG
  (green/red vs baseline) so the day's P&L shape reads at a glance.
- Per-position R bar in Open Positions: shows current open profit/loss in R units
  (-1R = the stop, 0R = breakeven), green right / red left, with a per-row ⚠ when
  a position has no resting protective stop. Falls back to % when no stop known.
  Also fixed the P/L column to compute from entry/last (was reading a None field).
- BUG: sync_orders dropped stop_price (kept only limit_price), so the synced
  snapshot showed stop=None on real stop orders — breaking the R bar and spark
  stop-line. Now captured. (The naked alarm was unaffected — it counts qty
  coverage, not the level.)

Verified live: equity curve renders the -1,886 day (94,124 -> 92,238); R bars
render (fall back to % until the loop re-syncs stop_price). Tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
momentum devandClaude Opus 4.8 committed 2026-06-18 21:29:07 -04:00
1 parent f0d1c3f106
commit 80a2a0bde6
4 files changed
+101 -6

No files matched your search

+2
View File
@@ -37,6 +37,7 @@ from storage.projections import (
query_approval_queue,
query_fills_feed,
query_armed_triggers,
query_equity_curve,
query_order_lifecycle_snapshot,
query_ready_signals_snapshot,
query_risk_state,
@@ -89,6 +90,7 @@ class DashboardState:
"pnl": query_session_pnl(store),
"risk": query_risk_state(store),
"triggers": query_armed_triggers(store),
"equity_curve": query_equity_curve(store),
"approval_queue": query_approval_queue(store),
"ready_signals": query_ready_signals_snapshot(store),
"watch_states": query_watch_states_snapshot(store),