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

Entries with 0 unitprice #54

Open
stin7 opened this issue Apr 11, 2020 · 1 comment
Open

Entries with 0 unitprice #54

stin7 opened this issue Apr 11, 2020 · 1 comment

Comments

@stin7
Copy link

stin7 commented Apr 11, 2020

A Vanguard OFX I'd like to import has entries where the UNITPRICE is 0 (which seems like a bug on their part):

<REINVEST>
    <INVTRAN>
        <FITID>XXX</FITID>
        <DTTRADE>20190614160000.000[-5:EST]</DTTRADE>
        <DTSETTLE>20190614160000.000[-5:EST]</DTSETTLE>
        <MEMO>DIVIDEND REINVEST</MEMO>
    </INVTRAN>
    <SECID>
        <UNIQUEID>XXX</UNIQUEID>
        <UNIQUEIDTYPE>CUSIP</UNIQUEIDTYPE>
    </SECID>
    <INCOMETYPE>DIV</INCOMETYPE>
    <TOTAL>-543.95</TOTAL>
    <SUBACCTSEC>CASH</SUBACCTSEC>
    <UNITS>7.599</UNITS>
    <UNITPRICE>0.0</UNITPRICE>
</REINVEST>

Which results in errors like this:

Traceback (most recent call last):
  File "miniconda3/lib/python3.6/site-packages/beancount_import/webserver.py", line 493, in _handle_reconciler_loaded
    loaded_reconciler = loaded_future.result()
  File "miniconda3/lib/python3.6/concurrent/futures/_base.py", line 398, in result
    return self.__get_result()
  File "miniconda3/lib/python3.6/concurrent/futures/_base.py", line 357, in __get_result
    raise self._exception
  File "miniconda3/lib/python3.6/site-packages/beancount_import/thread_helpers.py", line 13, in wrapper
    f.set_result(fn(*args, **kwargs))
  File "miniconda3/lib/python3.6/site-packages/beancount_import/reconcile.py", line 396, in __init__
    all_source_results = self._prepare_sources()
  File "miniconda3/lib/python3.6/site-packages/beancount_import/reconcile.py", line 515, in _prepare_sources
    source.prepare(self.editor, source_results)
  File "miniconda3/lib/python3.6/site-packages/beancount_import/source/ofx.py", line 1394, in prepare
    state.get_accounts_and_entries()
  File "miniconda3/lib/python3.6/site-packages/beancount_import/source/ofx.py", line 1249, in get_accounts_and_entries
    statement.get_entries(self)
  File "miniconda3/lib/python3.6/site-packages/beancount_import/source/ofx.py", line 1043, in get_entries
    total + fee_total + (units * unitprice))
AssertionError: 543.950

Should I use ignore_transaction_regexp to skip these? Fix the entries by hand? Or should the importer solve for UNITPRICE when it is zero? In this case, UNITPRICE should be 71.5817871

@stin7 stin7 mentioned this issue Apr 11, 2020
@stin7
Copy link
Author

stin7 commented Apr 11, 2020

FYI I created a simple PR to show a possible workaround (it's working for my files, but I don't know if it's breaking any core assumptions)

#55

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

1 participant