Repository navigation
Conversation
This branch has not been deployed
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.
Add three vectorized helpers for common compounding calculations:
effective_annual_rate: convert a nominal annual rate to an effective annual rate.nominal_annual_rate: perform the inverse conversion.compound_value: compound a principal through a schedule of changing rates, with a selectable time axis.The implementation uses standard compounding formulas with
log1p/expm1, descriptive names and no new runtime dependencies. Zero and negative rates are supported when each growth factor remains positive. Compounding frequencies must be positive integers. Invalid inputs raiseValueError; calculations use floating-point precision.compound_valuepreserves the principal's sign and does not model intervening cash flows.This is a draft for discussion of the public API and validation conventions. It is not a claim of complete Excel compatibility. Includes API documentation, examples, installation wiring and tests.
Validation: 150 tests and three docstring examples pass. Tests include independent Decimal references, broadcasting, schedule recurrence and invalid inputs. Ruff, Pyright and Mypy pass.
Prepared with AI assistance.