summaryrefslogtreecommitdiff
path: root/finance
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-09-04 20:56:03 +0200
committerxengineering <me@xengineering.eu>2024-09-08 17:21:32 +0200
commit877b50ef8802f8b59d81ccabcab22fe185e898d7 (patch)
treefa322ebc22f146805ac085e82d5f2b575a5230d7 /finance
parentb85de39cd765164d5a31836cb7ca106ad6e328a7 (diff)
downloadfinance-py-877b50ef8802f8b59d81ccabcab22fe185e898d7.tar
finance-py-877b50ef8802f8b59d81ccabcab22fe185e898d7.tar.zst
finance-py-877b50ef8802f8b59d81ccabcab22fe185e898d7.zip
Rename income to flow
Modeling income and expenses separately does not make sense since the only difference is the sign of the amount. Separate definitions would lead to a lot of duplicated code.
Diffstat (limited to 'finance')
-rw-r--r--finance/flow.py (renamed from finance/income.py)6
-rw-r--r--finance/test_flow.py (renamed from finance/test_income.py)4
2 files changed, 5 insertions, 5 deletions
diff --git a/finance/income.py b/finance/flow.py
index 8d775cb..fb28228 100644
--- a/finance/income.py
+++ b/finance/flow.py
@@ -4,13 +4,13 @@ from decimal import Decimal
@dataclasses.dataclass(kw_only=True, frozen=True)
-class Income:
- """Income models financial income paid on the first day of a month"""
+class Flow:
+ """Time-discrete flow of money paid on the first day of a month"""
amount: Decimal
def integrate(self, start: datetime, end: datetime) -> Decimal:
- """Integrate the income from a start to an end date"""
+ """Integrate the flow between two dates to an amount of money"""
retval = Decimal(0.0)
diff --git a/finance/test_income.py b/finance/test_flow.py
index fc75bef..aad4e74 100644
--- a/finance/test_income.py
+++ b/finance/test_flow.py
@@ -1,11 +1,11 @@
from datetime import datetime
from decimal import Decimal
-from finance import income
+from finance import flow
def test_income_integration() -> None:
- inc = income.Income(amount=Decimal(3000.0))
+ inc = flow.Flow(amount=Decimal(3000.0))
tests = (
(datetime(2024, 3, 12), datetime(2024, 4, 2), Decimal(3000.0)),