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

Vanguard unknown entity type error when dealing with CDs #75

Open
kklipsch opened this issue Jul 10, 2023 · 5 comments
Open

Vanguard unknown entity type error when dealing with CDs #75

kklipsch opened this issue Jul 10, 2023 · 5 comments

Comments

@kklipsch
Copy link

When running an import on a vanguard ofx document that has CDs in it I get

ERROR:root:Importer beancount_reds_importers.vanguard.Importer.extract() raised an unexpected error: Unknown entry type
Traceback (most recent call last):
File "/Users/kaseyklipsch/pf/.venv/lib/python3.11/site-packages/beancount/ingest/extract.py", line 182, in extract
new_entries = extract_from_file(
^^^^^^^^^^^^^^^^^^
File "/Users/kaseyklipsch/pf/.venv/lib/python3.11/site-packages/beancount/ingest/extract.py", line 67, in extract_from_file
new_entries = importer.extract(file, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kaseyklipsch/pf/.venv/lib/python3.11/site-packages/beancount_reds_importers/libtransactionbuilder/investments.py", line 423, in extract
new_entries += self.extract_transactions(file, counter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kaseyklipsch/pf/.venv/lib/python3.11/site-packages/beancount_reds_importers/libtransactionbuilder/investments.py", line 351, in extract_transactions
raise Exception('Unknown entry type')

An example line:
20688946420230613160000.000[-5:EST]20230615160000.000[-5:EST]BUY02007GP98CUSIP20000.0100.0-20000.0CASHCASH0.0

@redstreet
Copy link
Owner

Hi, thanks for filling!

This should be an easy fix, likely just adding the type to the right place in the importer, and adding the unit test.

Would you be up for taking a stab at a fix? Do let me know. Thanks!

@kklipsch
Copy link
Author

I can take a shot. I'm not a python programmer so some of the idioms are not clear to me. It seems like entities are hard coded at least 2 places: https://github.com/redstreet/beancount_reds_importers/blob/main/beancount_reds_importers/libtransactionbuilder/investments.py#L366-L379 and https://github.com/redstreet/beancount_reds_importers/blob/main/beancount_reds_importers/libtransactionbuilder/investments.py#L102-L126

So it doesn't seem like its just a vanguard importer issue. The tests though are defined at the financial institution level it seems?

So i guess do I just add the new entity type to the transaction builder library and then test it at the vanguard level?

@redstreet
Copy link
Owner

redstreet commented Jul 12, 2023

All of that is exactly right :). If you'd like to do this, I'd recommend starting with testing by copying the set of files here to a set with a new name, replacing the ofx with your test case, and running pytest in that directory.

Alternatively, you're also welcome to simply send me an anonymized, valid .ofx file with the case that fails, and the expected output (the Beancount transaction), and I'll fix it. This might be the easier route than learning a hundred python things at once :).

@kklipsch
Copy link
Author

Sorry I haven't gotten to this. I tried a few times to figure out how to get going on the code base. I think I'm close but probably won't get back to this issue for a few months.

@redstreet
Copy link
Owner

redstreet commented Aug 21, 2023

No worries, thanks for the note! I can fix it. From above:

you're welcome to simply send me an anonymized, valid .ofx file with the case that fails, and the expected output (the Beancount transaction), and I'll fix 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

No branches or pull requests

2 participants