From 8bfe0176a00b11b09365925eb57e383d024a63ec Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 8 Sep 2024 12:56:05 +0200 Subject: Rename demo -> demo.py 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. --- demo | 47 ----------------------------------------------- demo.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 47 deletions(-) delete mode 100755 demo create mode 100755 demo.py diff --git a/demo b/demo deleted file mode 100755 index bb9cb98..0000000 --- a/demo +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/python3 - - -import argparse - -from datetime import datetime -from decimal import Decimal - -from finance.flow import Flow, simulate -from finance.visualize import display - - -DESCRIPTION = "Demo application plotting financial data with finance-py" - - -def main() -> None: - argparse.ArgumentParser(description=DESCRIPTION).parse_args() - - measured = [ - (datetime(2024, 1, 1), Decimal(105.0)), - (datetime(2024, 2, 1), Decimal(207.0)), - (datetime(2024, 3, 1), Decimal(334.0)), - ] - - flows = ( - Flow(amount=Decimal(100.0), since=None, until=None), - Flow( - amount=Decimal(200.0), - since=datetime(2026, 1, 1), - until=datetime(2027, 1, 1), - ), - ) - - simulated = simulate( - start=datetime(2024, 1, 1), - end=datetime(2030, 1, 1), - flows=flows, - ) - - display( - simulated=simulated, - measured=measured, - ) - - -if __name__ == "__main__": - main() diff --git a/demo.py b/demo.py new file mode 100755 index 0000000..bb9cb98 --- /dev/null +++ b/demo.py @@ -0,0 +1,47 @@ +#!/usr/bin/python3 + + +import argparse + +from datetime import datetime +from decimal import Decimal + +from finance.flow import Flow, simulate +from finance.visualize import display + + +DESCRIPTION = "Demo application plotting financial data with finance-py" + + +def main() -> None: + argparse.ArgumentParser(description=DESCRIPTION).parse_args() + + measured = [ + (datetime(2024, 1, 1), Decimal(105.0)), + (datetime(2024, 2, 1), Decimal(207.0)), + (datetime(2024, 3, 1), Decimal(334.0)), + ] + + flows = ( + Flow(amount=Decimal(100.0), since=None, until=None), + Flow( + amount=Decimal(200.0), + since=datetime(2026, 1, 1), + until=datetime(2027, 1, 1), + ), + ) + + simulated = simulate( + start=datetime(2024, 1, 1), + end=datetime(2030, 1, 1), + flows=flows, + ) + + display( + simulated=simulated, + measured=measured, + ) + + +if __name__ == "__main__": + main() -- cgit v1.2.3-70-g09d2