summaryrefslogtreecommitdiff
path: root/finance/flow.py
AgeCommit message (Collapse)Author
2024-09-08Split flow.py to simulate.py and model.pyxengineering
model.py should be a file containing only dataclasses to model finance. simulate.py should take care of the simulation of that finance data to create a financial forecast.
2024-09-08Use list[tuple[datetime, Decimal]] consistentlyxengineering
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.
2024-09-08Move display() to finance.visualize.pyxengineering
2024-09-08Fix type annotation for finance.flow.simulate()xengineering
2024-09-08Implement finance.flow.display()xengineering
2024-09-08Implement finance.flow.simulate()xengineering
2024-09-08Implement Flow.since and Flow.untilxengineering
That way a flow can be limited to a certain time frame.
2024-09-08Refactor Flow.integrate()xengineering
This refactoring introduces a generator function supporting the integration. It creates datetime candidates where it can be checked if they are in the time interval given to the integration method. Furthermore a numerical improvement was made. The Flow.integrate() function now checks candidates from the helper function and sums the matching candidates up as an integer. After checking all candidates the integer is converted to a decimal and multiplied by Flow.amount. This is more accurate because in Python decimal calculation not numbers or calculations are rounded, just the result of a calculation. Looping over the candidates and adding amount each time thus involves a rounding operation per candidate. The new algorithm has exactly one rounding operation.
2024-09-08Rename income to flowxengineering
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.