fix: price portfolio realized P&L from DEX hub marks #1090

Merged
PlasticDigits merged 2 commits from fix/560-hub-pnl-usd into main 2026-08-19 02:02:32 +00:00
PlasticDigits commented 2026-08-19 01:06:05 +00:00 (Migrated from gitlab.com)

Summary

  • Header Total realized P&L on /portfolio and /trader/:addr now converts via GET /api/v1/hub-prices (same source as the Protocol DEX card). UST1 is no longer $1; USTR is no longer 2.5 × USTC. Unpriced hubs are omitted, not $0. CEX /oracle/price/ustr is still unused (400).
  • Best / Worst header is — (PnlValue), not N/A (P551-5).
  • Positions whose pair exists but an asset row is missing stay in GET /api/v1/traders/{addr}/positions (symbol —, decimals omitted) so the UI can render — instead of dropping the row.
  • Invariants P560-1–P560-6, skill skills/AGENTS_FRONTEND_HUB_PNL.md, make verify-issue-560.

Implements the code follow-up on #560. Does not close the issue: Coolify rebuild, Android #554 device QA, live #559 Add, and hub backfill_swap_volume_usd remain ops/manual.

Test plan

  • make verify-issue-560 (docs + source guards + indexer mapper + get_trader_positions_returns_rows + frontend Vitest) — 5/5, retested
  • make verify-issue-551 still green (human-scale rows unchanged)
  • Coolify frontend rebuild (npm ci) after merge so production header matches hub UST1 (~$0.976), not $1
  • Production smoke: public trader with UST1 P&L (e.g. terra12z8v…) — header USD ≈ hub UST1 × human P&L, not $38 for +38.29 UST1
  • /protocol DEX hub card still loads; GET /api/v1/oracle/price/ustr still 400
  • Best / Worst on /trader is —, not N/A
## Summary - Header **Total realized P&L** on `/portfolio` and `/trader/:addr` now converts via `GET /api/v1/hub-prices` (same source as the Protocol DEX card). UST1 is no longer `$1`; USTR is no longer `2.5 ×` USTC. Unpriced hubs are omitted, not `$0`. CEX `/oracle/price/ustr` is still unused (400). - Best / Worst header is **—** (`PnlValue`), not `N/A` (P551-5). - Positions whose pair exists but an asset row is missing stay in `GET /api/v1/traders/{addr}/positions` (symbol **—**, decimals omitted) so the UI can render **—** instead of dropping the row. - Invariants **P560-1–P560-6**, skill [`skills/AGENTS_FRONTEND_HUB_PNL.md`](skills/AGENTS_FRONTEND_HUB_PNL.md), `make verify-issue-560`. Implements the **code follow-up** on [#560](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/560). Does **not** close the issue: Coolify rebuild, Android #554 device QA, live #559 Add, and hub `backfill_swap_volume_usd` remain ops/manual. ## Test plan - [x] `make verify-issue-560` (docs + source guards + indexer mapper + `get_trader_positions_returns_rows` + frontend Vitest) — 5/5, retested - [x] `make verify-issue-551` still green (human-scale rows unchanged) - [ ] Coolify frontend rebuild (`npm ci`) after merge so production header matches hub UST1 (~$0.976), not `$1` - [ ] Production smoke: public trader with UST1 P&L (e.g. `terra12z8v…`) — header USD ≈ hub UST1 × human P&L, not `$38` for `+38.29 UST1` - [ ] `/protocol` DEX hub card still loads; `GET /api/v1/oracle/price/ustr` still 400 - [ ] Best / Worst on `/trader` is **—**, not `N/A`
PlasticDigits commented 2026-08-19 01:06:13 +00:00 (Migrated from gitlab.com)

Implements the code follow-up for #560 (hub P&L USD, Best/Worst em dash, missing-asset position rows). Ops/manual AC remains open.

Implements the code follow-up for #560 (hub P&L USD, Best/Worst em dash, missing-asset position rows). Ops/manual AC remains open.
PlasticDigits commented 2026-08-19 01:06:29 +00:00 (Migrated from gitlab.com)

mentioned in issue #560

mentioned in issue #560
PlasticDigits commented 2026-08-19 02:02:30 +00:00 (Migrated from gitlab.com)

added 8 commits

  • 037eb8d3...d89a8c7a - 7 commits from branch main
  • dc93f760 - Merge origin/main into fix/560-hub-pnl-usd.

Compare with previous version

added 8 commits <ul><li>037eb8d3...d89a8c7a - 7 commits from branch <code>main</code></li><li>dc93f760 - Merge origin/main into fix/560-hub-pnl-usd.</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/372/diffs?diff_id=1969756167&start_sha=037eb8d3863dd4e6af3e88b6872245341346c6b1)
PlasticDigits commented 2026-08-19 02:02:32 +00:00 (Migrated from gitlab.com)

mentioned in commit a6f44c1881

mentioned in commit a6f44c1881aa54578b210e637f40f1c9ddd57988
PlasticDigits (Migrated from gitlab.com) merged commit a6f44c1881 into main 2026-08-19 02:02:32 +00:00
PlasticDigits commented 2026-08-19 02:28:47 +00:00 (Migrated from gitlab.com)

mentioned in issue #573

mentioned in issue #573
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1090
No description provided.