-
-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Financials #5585
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
Financials #5585
Changes from 1 commit
ed89816
ff0cde7
e00a875
1e5cc30
522dcbf
5234d8d
980f40d
3de2457
110da41
c3dd88b
c1fb8d0
4807cac
bc6304e
d953fa3
f6e7408
d551e4e
787a9b5
34a2b72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,5 @@ | ||
| ## About math calculations | ||
|
|
||
| ### Interest | ||
|
|
||
| * Compound Interest: "Compound interest is calculated by multiplying the initial principal amount by one plus the annual interest rate raised to the number of compound periods minus one." [Compound Interest](https://www.investopedia.com/) | ||
| * Simple Interest: "Simple interest paid or received over a certain period is a fixed percentage of the principal amount that was borrowed or lent. " [Simple Interest](https://www.investopedia.com/) | ||
| * | ||
|
|
||
| ### Average | ||
|
|
||
| //todo | ||
|
|
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,23 @@ | ||
| def simple_interest(principle, daily_interest_rate, number_of_days_between_payment): | ||
| from __future__ import annotations | ||
|
|
||
| def simple_interest(principle, daily_interest_rate, number_of_days_between_payment) -> float: | ||
| """ | ||
| >>> simple_interest(18000,0.06,3) | ||
| 3240.0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add tests dealing with zero principle, negative principle, zero interest rate, negative interest rate, zero days, negative days, etc.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cclauss done |
||
| """ | ||
| result = principle * daily_interest_rate * number_of_days_between_payment | ||
| return result | ||
|
|
||
| def compound_interest(principle, nominal_annual_interest_rate_percentage , number_of_compounding_periods): | ||
| def compound_interest(principle, nominal_annual_interest_rate_percentage , number_of_compounding_periods)-> float: | ||
|
tarcisiobruni marked this conversation as resolved.
Outdated
|
||
| """ | ||
| >>> compound_interest(10000,0.05,3) | ||
| 1576.2500000000014 | ||
| """ | ||
| result = principle * ((1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods - 1) | ||
|
tarcisiobruni marked this conversation as resolved.
Outdated
|
||
| return result | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| import doctest | ||
|
|
||
| doctest.testmod() | ||
|
tarcisiobruni marked this conversation as resolved.
Outdated
|
||
Uh oh!
There was an error while loading. Please reload this page.