From 7521277860b377e3e9ec7b6d5a62c4c2c14d694f Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 8 Sep 2024 12:46:20 +0200 Subject: Use list[tuple[datetime, Decimal]] consistently This type is useful for finance-py in general. It is often required to handle money in datetime context. Using this type consistently makes the code easier to read and maintain. --- finance/flow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'finance/flow.py') diff --git a/finance/flow.py b/finance/flow.py index 4cf68db..c6b28c0 100644 --- a/finance/flow.py +++ b/finance/flow.py @@ -46,7 +46,7 @@ def monthly_candidates(start: datetime) -> Generator[datetime, None, None]: def simulate( start: datetime, end: datetime, flows: tuple[Flow, ...] -) -> tuple[list[datetime], list[Decimal]]: +) -> list[tuple[datetime, Decimal]]: dates: list[datetime] = [] values: list[Decimal] = [] @@ -63,4 +63,4 @@ def simulate( value += flow.integrate(start, date) values.append(value) - return (dates, values) + return [(date, values[index]) for index, date in enumerate(dates)] -- cgit v1.2.3-70-g09d2