redstreet / beancount_reds_importers

Simple ingesting tools for Beancount (plain text, double entry accounting software). More importantly, a framework to allow you to easily write your own importers.
GNU General Public License v3.0
114 stars 38 forks source link

Statement' object has no attribute 'balance. (example) #13

Closed gety9 closed 3 years ago

gety9 commented 3 years ago

When extracting example files OfxDownload.qfx works fine: bean-extract my.import -f my.beancount OfxDownload.qfx

result:

;; -*- mode: beancount -*-
**** K:\red\OfxDownload.qfx

2019-02-27 * "Sell mutual fund" "[VGTEST] Vanguard Test Fund"
  Assets:Investments:TradIRA:VGTEST   400.1234 VGTEST {200.00 USD}
  Assets:Investments:TradIRA:USD     -80024.68 USD

2019-02-28 * "Sell mutual fund" "[VGTEST] Vanguard Test Fund"
  todo: "TODO: this entry is incomplete until lots are selected (bean-doctor context <filename> <lineno>)"
  Assets:Investments:TradIRA:VGTEST  -12.1234 VGTEST {} @ 200.00 USD
  Income:Capital-Gains:TradIRA
  Assets:Investments:TradIRA:USD      2424.68 USD

2019-03-01 balance Assets:Investments:TradIRA:VGTEST               388.00 VGTEST

2019-03-01 balance Assets:Investments:TradIRA:USD                  6543.21 USD

2019-03-31 price VGTEST                             200.00 USD

but transactions.qfx fails: bean-extract my-smart.import -f my.beancount transactions.qfx

result:

ERROR:root:Importer beancount_reds_importers.ally.Importer.extract() raised an unexpected error: 'Statement' object has no attribute 'balance'
ERROR:root:Traceback: Traceback (most recent call last):
  File "c:\users\btycoon\appdata\local\programs\python\python38\lib\site-packages\beancount\ingest\extract.py", line 186, in extract
    new_entries = extract_from_file(
  File "c:\users\btycoon\appdata\local\programs\python\python38\lib\site-packages\beancount\ingest\extract.py", line 69, in extract_from_file
    new_entries = importer.extract(file, **kwargs)
  File "c:\users\btycoon\appdata\local\programs\python\python38\lib\site-packages\smart_importer\hooks.py", line 41, in patched_extract_method
    imported_entries = unpatched_extract(file, existing_entries)
  File "c:\users\btycoon\appdata\local\programs\python\python38\lib\site-packages\beancount_reds_importers\libtransactionbuilder\banking.py", line 97, in extract
    new_entries += self.extract_balance(file, counter)
  File "c:\users\btycoon\appdata\local\programs\python\python38\lib\site-packages\beancount_reds_importers\libtransactionbuilder\banking.py", line 60, in extract_balance
    for bal in self.get_balance_statement():
  File "c:\users\btycoon\appdata\local\programs\python\python38\lib\site-packages\beancount_reds_importers\libreader\ofxreader.py", line 52, in get_balance_statement
    yield Balance(date, self.ofx_account.statement.balance)
AttributeError: 'Statement' object has no attribute 'balance'

;; -*- mode: beancount -*-

(i am using master, bean-extract works for both files)

redstreet commented 3 years ago

Similar to #10. Works fine for me in master. Cutting a release from master see: https://github.com/redstreet/beancount_reds_importers/releases/tag/v0.4.1