-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Added NPV, Compound Interest and Payback Period #936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.37%. Comparing base (bd8418f) to head (5b64143).
Additional details and impacted files
@@ Coverage Diff @@ ## master #936 +/- ## ======================================= Coverage 95.37% 95.37% ======================================= Files 327 327 Lines 21153 21153 ======================================= Hits 20174 20174 Misses 979 979
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Hey @siriak ! Pinging for a review again for when you're free. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds three new financial calculation algorithms to the financial module: Net Present Value (NPV), Compound Interest, and Payback Period. These algorithms enable users to perform common financial computations such as evaluating investment profitability, calculating accumulated interest, and determining investment recovery timelines.
- Implements NPV algorithm to calculate present value of cash flows with discount rate
- Implements compound interest calculation using the formula A = P(1+r/n)^nt
- Implements payback period calculation to determine investment recovery time
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/financial/npv.rs | Adds NPV calculation function with test coverage for basic cases, zero rate, and empty inputs |
| src/financial/compound_interest.rs | Implements compound interest formula with quarterly compounding test case |
| src/financial/payback.rs | Adds payback period calculation with tests for successful and failed payback scenarios |
| src/financial/mod.rs | Exports the three new financial calculation functions |
| DIRECTORY.md | Documents the new financial algorithms in the project directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Check comments
should be fixed now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Pull Request Template
Description
Added 3 different algotrithms, namely:
Type of change
Please delete options that are not relevant.
Checklist:
cargo clippy --all -- -D warningsjust before my last commit and fixed any issue that was found.cargo fmtjust before my last commit.cargo testjust before my last commit and all tests passed.mod.rsfile within its own folder, and in any parent folder(s).DIRECTORY.mdwith the correct link.COUNTRIBUTING.mdand my code follows its guidelines.Please make sure that if there is a test that takes too long to run ( > 300ms), you
#[ignore]that ortry to optimize your code or make the test easier to run. We have this rule because we have hundreds of
tests to run; If each one of them took 300ms, we would have to wait for a long time.