feat: impl apy calc with comp freq support#599
Merged
vic-Gray merged 1 commit intoJun 26, 2026
Conversation
|
Someone is attempting to deploy a commit to the vic's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Ceejaytech25 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(vaults): implement APY calculation with compounding frequency support (#474)
Summary
What I changed
Vault strategy
Added a configurable
compoundingFrequencyfield to the vault strategy entity:Supported frequencies map to:
daily→n = 365weekly→n = 52monthly→n = 12APY calculation
Updated
calculateApy()inbackend/src/vaults/vaults.service.tsto compute APY using the standard compounding formula:Where:
APRis the annual percentage rate expressed as a decimalnis the number of compounding periods per yearAPR remains the nominal annual rate and APY represents the effective annual yield after compounding.
Vault detail response
Vault detail responses now include both yield metrics:
{ "apr": 0.10, "apy": 0.1047, "compoundingFrequency": "monthly" }Historical APY storage
Added support for storing daily APY snapshots in a new table:
Each snapshot records:
vault_idapyrecorded_atThis enables historical APY charting and trend analysis.
Acceptance Criteria Mapping
APY and APR are both returned in the vault detail response
Compounding frequency is a configurable field on the vault strategy
APY calculation follows the standard formula
Historical APY is stored daily for charting
vault_apy_historyNotes
monthlyto preserve backward compatibility.Testing
Run backend tests:
npm testRun linting:
Verify manually:
apr,apy, andcompoundingFrequencyare returned.vault_apy_history.Closes #474
Closes #476
Closes #475
Closes #318