Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix calculate_implied_rate to return an annualized rate and scale tol…
…erance up with implied_rate (#112) # Description `calculate_implied_rate` was meant to return an annualized rate, but it was returning an HPR instead. This fixes it to return an annualized rate, and adds helper functions for turning annualized rates into HPR. This also makes the test tolerance for `calculate_implied_rate` scale with the total implied rate, to ensure the tests don't fail while the error is still within reasonable bounds for larger results. Adds `calculate_hpr_given_apr` and `calculate_hpr_given_apy` functions. # Review Checklists Please check each item **before approving** the pull request. While going through the checklist, it is recommended to leave comments on items that are referenced in the checklist to make sure that they are reviewed. - [ ] **Testing** - [ ] Are there new or updated unit or integration tests? - [ ] Do the tests cover the happy paths? - [ ] Do the tests cover the unhappy paths? - [ ] Are there an adequate number of fuzz tests to ensure that we are covering the full input space? - [ ] If matching Solidity behavior, are there differential fuzz tests that ensure that Rust matches Solidity?
- Loading branch information