Adding inflation rate to numpy NPV calc#788
Draft
johnjasa wants to merge 2 commits into
Draft
Conversation
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.
Allow user to provide inflation rate to NumPy Financial NPV model
Resolves #339.
inflation_rateinput toNumpyFinancialNPVFinanceConfig. Defaults to0.0, validator-constrained to[0, 1].discount_ratevia the Fisher equation(1 + r_eff) = (1 + discount_rate) * (1 + inflation_rate)to match how ProFAST combines its real discount rate andgeneral_inflationinputs, keeping the two finance backends consistent.inflation_rate=0the effective rate reduces todiscount_rate, so existing configs and tests don't change.Section 1: Type of Contribution
Section 2: Draft PR Checklist
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
(1 + r_eff) = (1 + discount_rate) * (1 + inflation_rate)because it's the exact relationship between real and nominal rates and is what ProFAST uses internally.Implementation feedback:
inflation_rateis validated withrange_val(0, 1)to mirrordiscount_rate. Let me know if a different range (e.g. negative inflation) should be allowed.Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.md"A complete thought. PR XYZ", where
XYZshould be replaced with the actual number.Section 4: Related Issues
Fully resolves #339.
Section 5: Impacted Areas of the Software
Section 5.1: New Files
Section 5.2: Modified Files
h2integrate/finances/numpy_financial_npv.pyh2integrate/finances/test/test_numpy_financial_npv.pySection 6: Additional Supporting Information
N/A
For typical project finance rates (real 5%, inflation 4%), the multiplicative form gives
r_eff = 0.092vs. the additive0.09results in a 0.2 pp difference.Section 7: Test Results, if applicable
Ruff lint + format clean on the two modified files.
Section 8 (Optional): New Model Checklist
N/A