Skip to content

Add helper for computing a creator's 24h trading volume from the trade history table #620

Description

@Chucks1093

Summary

The 24h trading volume for a creator is computed inline in the creator detail and trending endpoints independently, each with slightly different time window logic. A shared helper should centralise this calculation so the result is consistent across all surfaces.

Scope

  • Add compute24hVolume(creatorId: string, db: Database): Promise<bigint> helper
  • Sum the price field of all trade records for the creator within the last 24 hours
  • Time window is rolling — based on current time minus 24 hours, not calendar day boundaries
  • Add unit tests: trades all within window included, trades outside window excluded, no trades returns 0

Acceptance Criteria

  • All trades within the rolling 24h window summed
  • Trades outside the window excluded
  • No trades returns 0
  • Both creator detail and trending endpoints use the helper

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions