Context:
Users need to discover top-performing signal providers. Leaderboards drive engagement and help users identify trusted providers.
Problem:
Build a leaderboard system that ranks providers by performance metrics with daily, weekly, and all-time views.
What Done Looks Like:
- GET
/leaderboard/providers endpoint
- Ranking by win rate, total P&L, signal count
- Time-based filtering (daily, weekly, all-time)
- Cached results for performance
- Top 100 providers displayed
Folder Structure:
src/
├── leaderboard/
│ ├── leaderboard.service.ts
│ ├── leaderboard.controller.ts
│ ├── leaderboard.module.ts
│ └── dto/
│ └── leaderboard-query.dto.ts
Implementation Guidelines:
- Aggregate provider stats from signal performance
- Calculate composite score:
(winRate * 0.5) + (totalPnL * 0.3) + (signalCount * 0.2)
- Cache leaderboard in Redis (5 min TTL)
- Update rankings every 10 minutes via cron job
- Include provider metadata: name, avatar, bio
Response Format:
{
"leaderboard": [
{
"rank": 1,
"provider": "GABC...",
"winRate": 78.5,
"totalPnL": 245.3,
"signalCount": 42,
"score": 85.2
}
],
"period": "weekly"
}
Query Parameters:
period: "daily" | "weekly" | "all-time"
limit: number (default 100)
Validation:
- Rankings calculated correctly
- Cache improves response time
- Time-based filtering works
Context:
Users need to discover top-performing signal providers. Leaderboards drive engagement and help users identify trusted providers.
Problem:
Build a leaderboard system that ranks providers by performance metrics with daily, weekly, and all-time views.
What Done Looks Like:
/leaderboard/providersendpointFolder Structure:
Implementation Guidelines:
(winRate * 0.5) + (totalPnL * 0.3) + (signalCount * 0.2)Response Format:
{ "leaderboard": [ { "rank": 1, "provider": "GABC...", "winRate": 78.5, "totalPnL": 245.3, "signalCount": 42, "score": 85.2 } ], "period": "weekly" }Query Parameters:
period: "daily" | "weekly" | "all-time"limit: number (default 100)Validation: