WIP: Draft: feat(charts): pair-scoped 24h stats and leaderboard (#666) #1174

Closed
PlasticDigits wants to merge 0 commits from 666-feat-charts-pair-scoped-24h-stats-leaderboard-drop-global-overview- into main
PlasticDigits commented 2026-08-26 07:40:57 +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.

Related to #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)

Closes #666

## 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`. Related to #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) Closes #666
PlasticDigits (Migrated from gitlab.com) closed this pull request 2026-08-26 07:42:50 +00:00
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

Pull request closed

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!1174
No description provided.