redstreet/beancount_reds_importers

ETrade Unknown entity type

Opened this issue · 1 comments

I received an OFX file from E*Trade that contains an unexpected entity, and this breaks the beancount_reds_importers code like so:

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

FWIW, I just added 'jrnlsec' to the list of entities on line 146 of investments.py

The line appeared in my OFX after an incoming ACATS transfer and it looks like this:
<JRNLSEC> <INVTRAN> <FITID>230614_JRL_0 <DTTRADE>20230614170000.000 <MEMO>Journalling security holdings for VTEB </INVTRAN> <SECID> <UNIQUEID>922907746 <UNIQUEIDTYPE>CUSIP </SECID> <SUBACCTTO>CASH <SUBACCTFROM>MARGIN <UNITS>100 </JRNLSEC>

Good to know, thanks for reporting this!

The etrade impiorter is yet to have an ofx unit test. I'll leave this ticket open until that's put in, and the line above you posted can become a part of the unit test.