Skip to content

Add configurable bucketing to TVL history endpoint #864

Description

@Jayy4rl

Context: Issue 135 adds TVL history with auto-bucketing. This issue makes the bucket strategy explicit and configurable.

Requirements:

  • Add bucket query param to GET /api/v1/vaults/:contractId/tvl-history: "hour" | "day" | "week".
  • Aggregate vault_tvl_snapshots by the chosen bucket using date_trunc.
  • Return { bucket: string; avgTotalAssets; maxTotalAssets; minTotalAssets } per entry.

Acceptance criteria:

  • ?bucket=day returns one entry per calendar day in the range.
  • avgTotalAssets is the mean of all snapshot values within each bucket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions