The DTEND tag in the OFX should be exclusive but is calculated inclusive
The OFX 2.2 specifications on page 87 mention this:
•<DTEND> is the date and time that, if used by the client as the next requested <DTSTART>, it would pick up exactly where the current response left off. It is the exclusive date and time in history where the server stopped looking for information, based on the request <DTEND> rules.
So DTEND is an exclusive date.
The code in ofx.py:
self.buildDate("DTEND", self.statement.end_date, False)
But in function recalculate_balance in statement.py the end_date is calculated inclusive:
stmt.end_date = max(sl.date for sl in stmt.lines)
The ofxstatement documentation is not clear about this and it will lead to balance inconsistencies as I have already experienced.
Hmm, I don't really understand the problem. What is the difference between "inclusive" and "exclusive" dates?
recalculate_balance attempts to calculate the account balance at the start and end of statement' period in case this information is not provided explicitly in the original data source. Can you given an example when it doesn't do what you would expect?