Skip to content

B3: historical APY storage#164

Open
cyberdocs120 wants to merge 1 commit into
Dgetsylver:mainfrom
cyberdocs120:b3-historical-apy-storage
Open

B3: historical APY storage#164
cyberdocs120 wants to merge 1 commit into
Dgetsylver:mainfrom
cyberdocs120:b3-historical-apy-storage

Conversation

@cyberdocs120
Copy link
Copy Markdown

Summary

Closes #30.

  • Migration: rate_snapshots table added to schema.sql with columns
    (pool_id, asset_symbol, supply_rate, borrow_rate, util, blnd_eps, ts)
    and a composite index on (pool_id, asset_symbol, ts).
  • Cron: on every 15-min tick, inserts one snapshot row per pool/asset;
    prunes rows older than 365 days.
  • Endpoint: GET /rates?pool=<contractId>&asset=<symbol>&window=<hours>
    window accepts 1/6/24/168/720/8760 (default 24), returns rows oldest-first.

Apply migration

wrangler d1 execute turbolong-alerts --file=src/schema.sql

Files changed

  • alerts/src/schema.sql
  • alerts/src/stellar.ts
  • alerts/src/index.ts

- Add rate_snapshots table + index to schema.sql
- Cron writes (pool, asset, supply_rate, borrow_rate, util, blnd_eps) snapshot each 15-min tick
- Cron prunes snapshots older than 365 days
- Add GET /rates?pool=&asset=&window= public endpoint
- Expose util + blndEps fields on ReserveRates
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@cyberdocs120 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

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.

B3: Historical APY storage

1 participant