ofxclient
ofxclient copied to clipboard
Allow specifying both start and end date for transaction downloads
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
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.