feat(charts): pair-scoped 24h stats and leaderboard (#666) #1176

Merged
PlasticDigits merged 2 commits from feat/666-charts-pair-scoped into main 2026-08-26 09:28:52 +00:00
PlasticDigits commented 2026-08-26 07:42:23 +00:00 (Migrated from gitlab.com)

Summary

  • /charts is pair-contextual: Find pair → pair 24h Stats → PriceChart → TWAP → trades → leaderboard. DEX census (Pairs / Tokens / USTC / global vol) stays on /protocol.
  • Pair leaderboard is GET /api/v1/traders/leaderboard?pair=. Volume/trades come from swap_events for that pair; Most Profit / Most Loss from trader_positions.realized_pnl. Best Trade is hidden; pair= + sort=best_trade_pnl is 400. Unknown pair is 404 (not cached as empty). Unscoped leaderboard and GET /overview are unchanged.
  • Invariants CS-1–CS-15 in skills/AGENTS_FRONTEND_CHARTS_PAIR_SCOPED.md. Regression: make verify-issue-666.

Closes #666

Test plan

  • make verify-issue-666 (Vitest + chrome nesting + indexer api_traders / security)
  • /charts: no charts-overview-* tiles; pair 24h Stats immediately below Find pair
  • Switch pair: stats and leaderboard args change together; empty copy is “No traders on this pair yet”
  • Leaderboard tabs are Volume (USD) / Most Profit / Most Loss only (no Best Trade)
  • /charts/:unknownTerra1 shows unknown-pair notice; no stats/leaderboard fetch for that string
  • /protocol still shows global USD census from GET /overview
  • Optional: Playwright e2e/price-chart-smoke.spec.ts Charts layout when LocalTerra + indexer are up (PLAYWRIGHT_SKIP_CHAIN unset)
## Summary - `/charts` is pair-contextual: Find pair → pair 24h Stats → PriceChart → TWAP → trades → leaderboard. DEX census (Pairs / Tokens / USTC / global vol) stays on `/protocol`. - Pair leaderboard is `GET /api/v1/traders/leaderboard?pair=`. Volume/trades come from `swap_events` for that pair; Most Profit / Most Loss from `trader_positions.realized_pnl`. Best Trade is hidden; `pair=` + `sort=best_trade_pnl` is **400**. Unknown pair is **404** (not cached as empty). Unscoped leaderboard and `GET /overview` are unchanged. - Invariants **CS-1–CS-15** in [`skills/AGENTS_FRONTEND_CHARTS_PAIR_SCOPED.md`](skills/AGENTS_FRONTEND_CHARTS_PAIR_SCOPED.md). Regression: `make verify-issue-666`. Closes #666 ## Test plan - [ ] `make verify-issue-666` (Vitest + chrome nesting + indexer `api_traders` / `security`) - [ ] `/charts`: no `charts-overview-*` tiles; pair 24h Stats immediately below Find pair - [ ] Switch pair: stats and leaderboard args change together; empty copy is “No traders on this pair yet” - [ ] Leaderboard tabs are Volume (USD) / Most Profit / Most Loss only (no Best Trade) - [ ] `/charts/:unknownTerra1` shows unknown-pair notice; no stats/leaderboard fetch for that string - [ ] `/protocol` still shows global USD census from `GET /overview` - [ ] Optional: Playwright `e2e/price-chart-smoke.spec.ts` Charts layout when LocalTerra + indexer are up (`PLAYWRIGHT_SKIP_CHAIN` unset)
PlasticDigits commented 2026-08-26 09:28:46 +00:00 (Migrated from gitlab.com)

mentioned in commit 8a13728c2f

mentioned in commit 8a13728c2fa1fe2b49e2ddaef737f6a4349d9b2a
PlasticDigits commented 2026-08-26 09:28:47 +00:00 (Migrated from gitlab.com)

added 53 commits

  • 0ba36876...29ed0bda - 52 commits from branch main
  • 8a13728c - Merge origin/main into branch for !1176

Compare with previous version

added 53 commits <ul><li>0ba36876...29ed0bda - 52 commits from branch <code>main</code></li><li>8a13728c - Merge origin/main into branch for !1176</li></ul> [Compare with previous version](/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/458/diffs?diff_id=1984629443&start_sha=0ba36876ec26e0afdfe34334c3930c354fed8c6b)
PlasticDigits commented 2026-08-26 09:28:53 +00:00 (Migrated from gitlab.com)

mentioned in commit 8af5563c69

mentioned in commit 8af5563c6933f4d9487b3c5af796f80ffcd453e8
PlasticDigits (Migrated from gitlab.com) merged commit 8af5563c69 into main 2026-08-26 09:28:53 +00:00
PlasticDigits commented 2026-08-26 09:31:00 +00:00 (Migrated from gitlab.com)

mentioned in issue #657

mentioned in issue #657
PlasticDigits commented 2026-08-26 09:31:04 +00:00 (Migrated from gitlab.com)

mentioned in issue #656

mentioned in issue #656
PlasticDigits commented 2026-08-26 09:31:10 +00:00 (Migrated from gitlab.com)

mentioned in issue #666

mentioned in issue #666
PlasticDigits commented 2026-08-26 09:31:36 +00:00 (Migrated from gitlab.com)

mentioned in issue #673

mentioned in issue #673
PlasticDigits commented 2026-08-26 11:11:04 +00:00 (Migrated from gitlab.com)

mentioned in commit 72fd8cd889

mentioned in commit 72fd8cd889a664c54ed857a031b5bb299b223849
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!1176
No description provided.