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:
1 parent
f0d1c3f106
commit
80a2a0bde6
4 files changed
+101
-6
No files matched your search
@@ -132,6 +132,9 @@ class AlpacaPaperSync:
|
||||
"type": o.get("type"),
|
||||
"status": o.get("status"),
|
||||
"limit_price": o.get("limit_price"),
|
||||
# capture the stop trigger too — needed for the dashboard R bar /
|
||||
# spark stop-line / any stop-level read (only limit_price was kept).
|
||||
"stop_price": o.get("stop_price"),
|
||||
"filled_avg_price": o.get("filled_avg_price"),
|
||||
"submitted_at": o.get("submitted_at"),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user