Skip to content

Conversation

@LeonardoVieira1630
Copy link
Member

@LeonardoVieira1630 LeonardoVieira1630 commented Jan 16, 2026

Summary

This PR implements a new REST endpoint for token metrics with forward-fill logic, replacing the previous centralized forward-fill implementation with a dedicated token metrics service that handles daily metric buckets.

Key Changes

New Token Metrics Endpoint

  • New endpoint: GET /token-metrics - Returns token-related metrics with forward-fill support
  • Supports multiple metric types in a single request (e.g., ?type=CEX_SUPPLY&type=DEX_SUPPLY)
  • Implements cursor-based pagination with after, before, and limit parameters
  • Handles date range filtering with startDate and endDate

Code Organization

  • Refactored time-series utilities: Split time-series.ts into focused modules:
    • date-helpers.ts - Date manipulation utilities (truncate to midnight, normalize timestamps)
    • query-helpers.ts - Pagination and filtering utilities (cursor pagination, fallback logic)
    • time-series.ts - Core forward-fill and timeline generation
  • Removed old type: DaoMetricsDayBucket type removed in favor of new structure

Forward-Fill Strategy

The service implements forward-fill to handle sparse database data:

  • Database stores only value changes (not daily records), creating gaps between dates
  • Forward-fill carries forward the last known value for missing dates
  • Example: [Day1: 100] [Day5: 150][100, 100, 100, 100, 150]

Frontend Updates

  • Updated useTimeSeriesData hook to work with new endpoint structure
  • Updated chart components to use new data format

@LeonardoVieira1630 LeonardoVieira1630 self-assigned this Jan 16, 2026
@vercel
Copy link

vercel bot commented Jan 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
anticapture Ready Ready Preview, Comment Jan 22, 2026 2:23pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
anticapture-storybook Skipped Skipped Jan 22, 2026 2:23pm

Request Review

…plement_DAO_daily_metric_buckets' into refactor/DEV-199_implement_DAO_daily_metric_buckets
@vercel vercel bot temporarily deployed to Preview – anticapture-storybook January 21, 2026 16:25 Inactive
@vercel vercel bot temporarily deployed to Preview – anticapture-storybook January 22, 2026 14:21 Inactive
Copy link
Member

@pikonha pikonha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LFGTM, nice job 🔥

@pikonha pikonha merged commit 989a218 into dev Jan 22, 2026
3 of 4 checks passed
@pikonha pikonha deleted the refactor/DEV-199_implement_DAO_daily_metric_buckets branch January 22, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an already existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants