Skip to content

Commit

Permalink
Recalculate unitprice if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Stin committed Apr 11, 2020
1 parent 800521f commit 7302ad8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions beancount_import/source/ofx.py
Expand Up @@ -902,8 +902,8 @@ def get_subaccount_cash(inv401ksource: Optional[str] = None) -> str:
if quantity_round_digits is not None:
units = round(units, quantity_round_digits)

if raw.unitprice==ZERO:
# Assume Zero unitprice is a bug, recalculate.
if raw.unitprice==ZERO or raw.unitprice is None:
# Assume Zero or missing unitprice is a bug, recalculate.
unitprice = abs(raw.total/raw.units)
else:
unitprice = raw.unitprice
Expand Down

0 comments on commit 7302ad8

Please sign in to comment.