summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-09-15tools: Rename check_source.sh to check.shHEADmainxengineering
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-08Refactor finance.visualize.pyxengineering
This introduces the plot() helper function to plot the default data format list[tuple[datetime, Decimal]] with matplotlib.
2024-09-08Do not rotate dates in visualizationxengineering
2024-09-08Rename demo -> demo.pyxengineering
This makes sure this script is also detected by the tools used in tools/check_source.sh. In general it is not a bad idea to use a file name extension to indicate the file type. This improves compatibility with other tools in general. The downside is that command line tools usually should not have a file name extension. This can be worked around by using symlinks or an install step. Both can remove the file name extension.
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-08Add measured valuesxengineering
2024-09-08Move display() to finance.visualize.pyxengineering
2024-09-08Fix type annotation for finance.flow.simulate()xengineering
2024-09-08Add second flow to demoxengineering
This makes the output less trivial.
2024-09-08Add demo scriptxengineering
2024-09-08Implement finance.flow.display()xengineering
2024-09-08Implement finance.flow.simulate()xengineering
2024-09-08Fix old usage of name "income"xengineering
This was renamed to "flow".
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.
2024-09-08Switch to decimal.Decimal for moneyxengineering
Floating point data types are not suitable to represent money since rounding issues will sum up.
2024-09-08finance: Use datetime for Income.integrate()xengineering
Time-based Integration in general is done between two time stamps. For the financial context it makes sense to use Python's datetime.datetime class for this purpose. This commit implements integrating an income between two datetime.datetime time stamps.
2024-09-08finance: Add income.pyxengineering
This is the minimal starting point to model financial income.
2024-09-08tools: Add check_source.shxengineering
This script checks for common programming errors in the Python code of this repository. It might be symlinked by `.git/hooks/pre-commit` to make sure those errors do not end up in the Git history.
2024-09-08finance: Add empty Python packagexengineering
This package should contain the primary content of this repository.
2024-09-08Add Apache License 2.0 as LICENSE.txtxengineering
2024-09-03Add README.mdxengineering