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

Allow specifying both start and end date for transaction downloads #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DylanDonkersgoed
Copy link

@DylanDonkersgoed DylanDonkersgoed commented Jan 28, 2019

Allow specifying both start and end date for transaction downloads, making it possible to collect transactions between Y days before X and X.


I'm not super familiar with GitHub (I usually develop for Drupal) and I think this is my first PR, so I hope I'm following the correct procecure. This is related to Allow specifying both start and end date for transaction downloads.

The way I've solved this is by adding an additional end date argument to Account::transactions() and various methods it calls. The API is a little weird (since you specify the days before followed by the end date rather than start and end date) but it should be backwards compatible with old code.

I'm not sure if this is 100% ready to be merged in or if the tests should be updated first. Haven't figured out how to run them yet (not super familiar with Python either).

I've been running this fix since I think October of 2018 and it works for my purposes at least. Code looks something like this:

def retrieve_transactions(month_start: datetime, month_end: datetime, last_month_start: datetime, next_month_start: datetime):
    tangerine_cc = OfxConfig().account('OMITTED')
    tangerine_cc_trans_1 = tangerine_cc.transactions(30, last_month_start)
    tangerine_cc_trans_2 = tangerine_cc.transactions(30, month_start)
    tangerine_cc_trans_3 = tangerine_cc.transactions(30, next_month_start)

    tangerine_cc_trans = tangerine_cc_trans_1 + tangerine_cc_trans_2 + tangerine_cc_trans_3
    tangerine_cc_trans = list(filter(
        lambda x: month_start < x.date < month_end,
        tangerine_cc_trans
    ))
    tangerine_cc_trans.sort(key=lambda x: x.date)
    return tangerine_cc_trans

…ions, making it possible to collect transactions between Y days before X and X
@enricozb
Copy link

enricozb commented Mar 4, 2020

Is this still working? If so why hasn't this been merged? I think this should also change the cli for those who use it.

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