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.
Context: Issue 135 adds TVL history with auto-bucketing. This issue makes the bucket strategy explicit and configurable.
Requirements:
bucketquery param toGET /api/v1/vaults/:contractId/tvl-history:"hour"|"day"|"week".vault_tvl_snapshotsby the chosen bucket usingdate_trunc.{ bucket: string; avgTotalAssets; maxTotalAssets; minTotalAssets }per entry.Acceptance criteria:
?bucket=dayreturns one entry per calendar day in the range.avgTotalAssetsis the mean of all snapshot values within each bucket.