diff --git a/CHANGELOG.md b/CHANGELOG.md index ac77a15..70b8cf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.6.0] - 2024-03-16 -- [When there are no money transactions for deGiro there should be no error message.](https://github.com/gpaulissen/ofxstatement-dutch/issues/6) +- [When there are no money transactions there should be no error message about start/end date/balance.](https://github.com/gpaulissen/ofxstatement-dutch/issues/6) ## [1.5.0] - 2024-02-18 diff --git a/src/ofxstatement/plugins/nl/asn.py b/src/ofxstatement/plugins/nl/asn.py index cd16f60..e86611f 100644 --- a/src/ofxstatement/plugins/nl/asn.py +++ b/src/ofxstatement/plugins/nl/asn.py @@ -191,13 +191,13 @@ def parse(self) -> Statement: # GJP 2020-03-03 # No need to (re)calculate the balance since there is no history. # But set the dates. - stmt.start_date = min(sl.date for sl in stmt.lines) - # end date is exclusive for OFX - stmt.end_date = max(sl.date for sl in stmt.lines) - stmt.end_date += datetime.timedelta(days=1) - - stmt.start_balance = Decimal(stmt.lines[0].start_balance) - stmt.end_balance = Decimal(stmt.lines[-1].start_balance) + stmt.lines[-1].amount + if stmt.lines: + stmt.start_date = min(sl.date for sl in stmt.lines) + # end date is exclusive for OFX + stmt.end_date = max(sl.date for sl in stmt.lines) + stmt.end_date += datetime.timedelta(days=1) + stmt.start_balance = Decimal(stmt.lines[0].start_balance) + stmt.end_balance = Decimal(stmt.lines[-1].start_balance) + stmt.lines[-1].amount return stmt diff --git a/src/ofxstatement/plugins/nl/statement.py b/src/ofxstatement/plugins/nl/statement.py index e393048..cbeae58 100644 --- a/src/ofxstatement/plugins/nl/statement.py +++ b/src/ofxstatement/plugins/nl/statement.py @@ -12,10 +12,10 @@ class Statement(BaseStatement): def assert_valid(self) -> None: try: super().assert_valid() - assert self.end_date, "The statement end date should be set" # An ING CSV may be a balance file resulting in 0 lines if len(self.lines) == 0: return + assert self.end_date, "The statement end date should be set" min_date = min(sl.date for sl in self.lines) max_date = max(sl.date for sl in self.lines) assert self.start_date <= min_date, \