Skip to content

feat(savings): add product performance metrics API (#470)#511

Merged
Devsol-01 merged 3 commits intoDevsol-01:mainfrom
Sendi0011:feat/savings-product-performance-metrics
Mar 30, 2026
Merged

feat(savings): add product performance metrics API (#470)#511
Devsol-01 merged 3 commits intoDevsol-01:mainfrom
Sendi0011:feat/savings-product-performance-metrics

Conversation

@Sendi0011
Copy link
Copy Markdown
Contributor


feat(savings): Add Savings Product Performance Metrics API (#470)

Summary

Implements GET /savings/products/:id/metrics — a comprehensive performance metrics endpoint for savings products, closing issue #470.

What's changed

  • ProductApySnapshot entity + migration (1795000000000) — stores daily APY, TVL, and subscriber count snapshots per product for historical trend data
  • ProductMetricsDto / ProductMetricsQueryDto / RiskMetricsDto — typed response and query DTOs with full Swagger annotations
  • SavingsService.getProductMetrics() — computes all metrics, groups snapshots by granularity, calculates Sharpe ratio and APY volatility, queries similar products by risk level
  • Controller endpoint wired with CacheInterceptor + CacheTTL(3600000) (1-hour TTL) and a manual cacheManager.set inside the service for the same key

Acceptance criteria coverage

Criteria Status
GET /savings/products/:id/metrics
Historical APY chart data (daily/weekly/monthly) ✅ via ?granularity= query param
TVL growth over time
User retention rate ✅ active / total ever subscribed
Sharpe ratio & risk metrics ✅ volatility, min/max/avg APY
Comparison with similar products ✅ same riskLevel, up to 5
Cache with 1-hour TTL

Closes #470

Graceful fallback: when no snapshots exist yet (fresh product), the endpoint returns the current interestRate and tvlAmount as a single data point rather than an empty array, so the frontend always has something to render.

- GET /savings/products/:id/metrics endpoint
- Historical APY chart data with daily/weekly/monthly granularity
- TVL growth over time from APY snapshots
- User retention rate (active / total ever subscribed)
- Sharpe ratio, APY volatility, min/max/avg risk metrics
- Similar products comparison (same risk level)
- 1-hour cache TTL via CacheInterceptor + cacheManager.set
- ProductApySnapshot entity + migration 1795000000000
- ProductMetricsDto, ProductMetricsQueryDto, RiskMetricsDto DTOs
- Graceful fallback to current product data when no snapshots exist
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

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

Project Deployment Actions Updated (UTC)
nestera Ready Ready Preview, Comment Mar 30, 2026 9:05am

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@Sendi0011 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Devsol-01 Devsol-01 merged commit 60c4be2 into Devsol-01:main Mar 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Savings Product Performance Metrics API

2 participants