Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ofx: try actual specified lower bound before binary searching to find earliest available start date #57

Merged
merged 1 commit into from
Jan 30, 2022

Conversation

jktomer
Copy link
Contributor

@jktomer jktomer commented Jan 16, 2022

The ofx source tries to guess when data for an account begins. It has the user
specify a minimum start date as an anchor, and then uses binary search to find
the earliest date since then which generates a nonempty response from the
institution.

If the institution actually has data from the minimum start date, this results
in a rather silly search—and, in fact, the binary search as implemented never
tries the lower bound of the range at all (the interval being searched is open
at both ends), so if a user specifies the actual first day for which they have
data as min_start_date, finance-dl would always miss that first day. Given
that the user knowing when their data starts is at least a plausible case, we
should try it before resorting to cleverness; this change makes us do so.

… earliest available start date

The ofx source tries to guess when data for an account begins. It has the user
specify a minimum start date as an anchor, and then uses binary search to find
the earliest date since then which generates a nonempty response from the
institution.

If the institution actually has data from the minimum start date, this results
in a rather silly search—and, in fact, the binary search as implemented never
tries the lower bound of the range at all (the interval being searched is open
at both ends), so if a user specifies the actual first day for which they have
data as min_start_date, finance-dl would always miss that first day. Given
that the user knowing when their data starts is at least a plausible case, we
should try it before resorting to cleverness; this change makes us do so.
Copy link
Collaborator

@Zburatorul Zburatorul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it out. Looks good.

@Zburatorul Zburatorul merged commit c748c0f into jbms:master Jan 30, 2022
@jktomer jktomer deleted the ofx-try-the-door branch September 2, 2022 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants