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

Only reads one account from OFX file #32

Open
rnapier opened this issue Jun 27, 2017 · 12 comments · May be fixed by #63
Open

Only reads one account from OFX file #32

rnapier opened this issue Jun 27, 2017 · 12 comments · May be fixed by #63

Comments

@rnapier
Copy link

rnapier commented Jun 27, 2017

If I download an OFX file with several accounts in it, ledger-autosync only seems to import one of the accounts. If I let ledger-autosync manage the downloading, then it seems to get all the accounts.

My real goal is to modify the OFX file before letting ledger-autosync work on it. I want to clean up various known problems, like rewriting some of the memo and name fields so that transaction matching works correctly.

The underlying problem is that some ledger tools work on OFX files, some on CSV, and some on Journals, so it's hard to piece together the various bits (cleanup, de-duping, assigning to the correct accounts, etc.) My goal is to have a single script that will download a bunch of OFX and CSVs every day and dump out some mostly-correct (and non-duplicate) journal entries to review.

@egh
Copy link
Owner

egh commented Jul 12, 2017

I didn't know you could have an OFX file with multiple accounts. Do you think you could provide a sample? I know it's hard to anonymize the data, but it would be very helpful. Thanks.

@257
Copy link

257 commented Jul 28, 2017

tangerine Canada OFX respond
let me know if you need corresponding ofxclient.ini
and since we're at it please have a look at 'Category:'; seems like a good candidate for passing as sub-directive in account structures. something like Assets:Food.
this merits a different ticket... here

@egh
Copy link
Owner

egh commented Jul 29, 2017

@257 Thank you for the sample file!

@jpeterson1
Copy link

I just ran into this issue as well. It looks like my bank (USAA) does the same thing (multiple accounts in a single file).

@colindean
Copy link
Contributor

I'm hitting this, too. Vanguard allows mixing of accounts in exported qfx file. ledger-autosync only extracts the first one.

@fabrepe
Copy link

fabrepe commented Feb 4, 2019

I also hit the issue. This is because OfxParser expose account and accounts attributes, where the account attribute is equal to accounts[0]. However ledger-autosync use ofxparser.account and not ofxparser.accounts.

@egh
Copy link
Owner

egh commented Feb 4, 2019

@fabrepe Interesting! Thanks. I'll look into accounts

@fabrepe
Copy link

fabrepe commented Feb 5, 2019

Wow, what a quick reply 👍 @egh Thank your very much

I think we should loop over the ofxparser.accounts list in the cli.import_ofx function.
Nonethless defaults details for each accounts may be tricky to set. For example, the default accountname (UNKNOWN_BANK_ACCOUNT) has to be different for each bank account.

@gepandz
Copy link

gepandz commented Feb 27, 2019

I just ran into this issue as well. It looks like my bank (USAA) does the same thing (multiple accounts in a single file).

Same issue with the same bank. USAA FSB doesn't give you an option to download just one account -- you just download either your bank or your investment accounts, so it's not easy to get around without hand-editing the QFX or OFX files... Thanks!

@gepandz
Copy link

gepandz commented Feb 27, 2019

Looking at the ofx object returned by OfxParser, there's an accounts array, while the account object just points to the first element of that array. I simply wrapped for acct in ofx.accounts: around my transaction-read loop logic, and that pulled in all of my accounts in the OFX or QFX files I got from my bank. I haven't dug through your code, yet, but it should be fairly straightforward to loop through all accounts to get all of their transactions. If I get a chance to, I might either link the code that needs to change or submit a PR...

@egh
Copy link
Owner

egh commented Feb 28, 2019

@gepandz A pull request would definitely be welcome, thank you!

fabrepe added a commit to fabrepe/ledger-autosync that referenced this issue Feb 28, 2019
* Fix egh#32
* Allows specify format of account in case of multiple accounts when
  importing OFX
@fabrepe fabrepe linked a pull request Feb 28, 2019 that will close this issue
@fabrepe
Copy link

fabrepe commented Mar 1, 2019

My bad, this pull request will certainly break the cli.sync function. As the print_results function is also called by the sync function.

I cannot test the sync, but I will do another pull request with a fix. Sorry for the inconvenience.

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 a pull request may close this issue.

7 participants