egh / ledger-autosync Goto Github PK
View Code? Open in Web Editor NEWSynchronize your ledger-cli files with your bank.
License: GNU General Public License v3.0
Synchronize your ledger-cli files with your bank.
License: GNU General Public License v3.0
Hello @egh
ledger-autosync
is unfortunately not working for me.
Executing ledger-autosync transactions.ofx
outputs:
|13:32:56|cdr35@Prometheus:[VFCU]> ledger-autosync transactions.ofx
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ledger-autosync", line 11, in <module>
sys.exit(run())
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ledgerautosync/cli.py", line 182, in run
ledger_file = find_ledger_file()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ledgerautosync/cli.py", line 50, in find_ledger_file
re.match(r".*--file\s+([^\s]+).*", ledgerrc).group(1)))
AttributeError: 'NoneType' object has no attribute 'group'
|13:33:08|cdr35@Prometheus:[VFCU]>
Executing ledger-autosync transactions.ofx -l ./journal.dat
outputs:
|13:30:22|cdr35@Prometheus:[VFCU]> ledger-autosync transactions.ofx -l ./journal.dat
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ledger-autosync", line 11, in <module>
sys.exit(run())
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ledgerautosync/cli.py", line 222, in run
import_ofx(ledger, args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ledgerautosync/cli.py", line 107, in import_ofx
(ofx, txns) = sync.parse_file(args.PATH)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ledgerautosync/sync.py", line 35, in parse_file
ofx = OfxParser.parse(file(path))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ofxparse/ofxparse.py", line 386, in parse
ofx_file = OfxPreprocessedFile(file_handle)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ofxparse/ofxparse.py", line 150, in __init__
super(OfxPreprocessedFile, self).__init__(fh)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ofxparse/ofxparse.py", line 80, in __init__
self.read_headers()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ofxparse/ofxparse.py", line 93, in read_headers
header, value = line.split(six.b(":"))
ValueError: need more than 1 value to unpack
|13:31:53|cdr35@Prometheus:[VFCU]>
It also seems that ledger-autosync
is not properly parsing LEDGER_FILE
, though I am unsure.
Thanks for your attention.
Hi,
the latest release is more than one year old and uses Python 2 syntax. What about releasing a new version?
Shalom
Could ledger-autosync -- instead of dying -- prompt for a custom institution name? Or, better yet, make a suggestion from list of institutions from ledger files?
It seems that ledger-autosync follows includes -- is that accurate?
This should be implemented as an option. That is, if the end-user triggers the missing institution exception, they could then choose to execute ledger-autosync with this option turned on.
What do you think?
If I download an OFX file with several accounts in it, ledger-autosync only seems to import one of the accounts. If I let ledger-autosync manage the downloading, then it seems to get all the accounts.
My real goal is to modify the OFX file before letting ledger-autosync work on it. I want to clean up various known problems, like rewriting some of the memo and name fields so that transaction matching works correctly.
The underlying problem is that some ledger tools work on OFX files, some on CSV, and some on Journals, so it's hard to piece together the various bits (cleanup, de-duping, assigning to the correct accounts, etc.) My goal is to have a single script that will download a bunch of OFX and CSVs every day and dump out some mostly-correct (and non-duplicate) journal entries to review.
Hello,
So, ledger-autosync can crosscheck journal files with OFX/QFX to prevent generating output for transactions that already exist in said journal files.
Can not this be further leveraged to add transactions to an existent journal file?
Currently, one can do something like this:
ledger-autosync 2015.06.01โ2017.06.04_c.QFX >> c/tsac.journal
The problem with this is that there is no accounting for whether or not the transactions written into this journal file are already present. Hence, it would be awesome or there were some option to intelligently append transactions.
Thanks. Let me know if that's unclear.
I'd like to request the ability to import my Coinbase history using ledger-autosync
. You can download your Coinbase history as a CSV file here.
What follows is a description of the format of the CSV.
At the top is an extra header section that looks like this:
Transactions
User,[email protected],0xsomehex
Account,BTC Wallet,0xsomehex
The email address is the one tied to your Coinbase user, and the last line represents which Account you have exported the history for.
Next is the header line, which I've split into one column per line for readability:
Timestamp
Balance
Amount
Currency
To
Notes
Instantly Exchanged
Transfer Total
Transfer Total Currency
Transfer Fee
Transfer Fee Currency
Transfer Payment Method
Transfer ID
Order Price
Order Currency
Order BTC
Order Tracking Code
Order Custom Parameter
Order Paid Out
Recurring Payment ID
Coinbase ID (visit https://www.coinbase.com/transactions/[ID] in your browser)
Bitcoin Hash (visit https://www.coinbase.com/tx/[HASH] in your browser for more info)
Following that are the transactions. I'll give three examples.
First is a time I purchased BTC with a linked bank account.
2017-01-01 12:00:00 -0700,0.1,0.1,BTC,[email protected],Paid for with $20.00 from Acme Bank - Bank xxxxxxxx1234.,false,20.00,USD,0.30,USD,Acme Bank - Bank ********1234,0xsomehex,"","","","","","","",0xsomehex,0xsomehex
The next two are similar but I'm not sure what the difference in cause was. It could be the first was me manually sending BTC to an address and the second was using the Coinbase integration from a third-party site.
2017-02-01 09:00:00 -0700,0.25,-0.03,BTC,SomeBTCAddress,"",false,"","","","","","",5.0,USD,0.04,ABC123,AABBCC112233,true,"",0xsomehex,0xsomehex
2017-03-01 18:00:00 -0700,0.4,-0.1,BTC,SomeBTCAddress,Merchant Order ABC123,false,"","","","","","",10.0,USD,0.1,ABC123,AABBCC112233,true,"",0xsomehex,""
So the full CSV would look like this:
Transactions
User,[email protected],0xsomehex
Account,BTC Wallet,0xsomehex
Timestamp,Balance,Amount,Currency,To,Notes,Instantly Exchanged,Transfer Total,Transfer Total Currency,Transfer Fee,Transfer Fee Currency,Transfer Payment Method,Transfer ID,Order Price,Order Currency,Order BTC,Order Tracking Code,Order Custom Parameter,Order Paid Out,Recurring Payment ID,Coinbase ID (visit https://www.coinbase.com/transactions/[ID] in your browser),Bitcoin Hash (visit https://www.coinbase.com/tx/[HASH] in your browser for more info)
2017-01-01 12:00:00 -0700,0.1,0.1,BTC,[email protected],Paid for with $20.00 from Acme Bank - Bank xxxxxxxx1234.,false,20.00,USD,0.30,USD,Acme Bank - Bank ********1234,0xsomehex,"","","","","","","",0xsomehex,0xsomehex
2017-02-01 09:00:00 -0700,0.25,-0.03,BTC,SomeBTCAddress,"",false,"","","","","","",5.0,USD,0.04,ABC123,AABBCC112233,true,"",0xsomehex,0xsomehex
2017-03-01 18:00:00 -0700,0.4,-0.1,BTC,SomeBTCAddress,Merchant Order ABC123,false,"","","","","","",10.0,USD,0.1,ABC123,AABBCC112233,true,"",0xsomehex,""
For completeness, this is what I would expect ledger-autosync
to output:
2017/01/01 Coinbase
Assets:Acme Bank xxxxxxxx1234 $-20.00
Expenses:Transfer Fees $0.30
Assets:Coinbase:BTC Wallet 0.1BTC @ $197.00
;; csvid: someid
2017/02/01 Unknown
Assets:Coinbase:BTC Wallet -0.03BTC @ $166.67
;; csvid: someid
Expenses:Unknown $5.00
2017/03/01 Unknown
Assets:Coinbase:BTC Wallet -0.1BTC @ $100.00
;; csvid: someid
Expenses:Unknown $10.00
Of course, the account names could be slightly different, or if possible we could detect them based on previous Ledger entries.
As a bonus, maybe we could include the Bitcoin Hash
and the destination address (above SomeBTCAddress
) as tags on the relevant transactions.
Thanks to the Balance
column, it should also be possible to include balance assertions if requested.
A transaction output by ledger-autosync
looks something like this:
2017/02/28 Some Merchant
; ofxid: someid.123456789.etc
Assets:Checking -$20.00
Expenses:Misc $20.00
Based on my understanding of the ledger file format, the above ofxid
tag is scoped to the entire transaction, rather than just to the posting of Assets:Checking
. In this example it is still clear enough which posting it applies to, but I often have transactions that transfer money from one bank account to another, and I run ledger-autosync
on both. In such a case, I might have a transaction like this:
2017/02/28 Transfer
Assets:Checking -$20.00
Assets:Savings $20.00
If I run ledger-autosync
for both accounts, I will have 2 ofxid
s, which should obviously not both be applied to the same transaction, but to their separate postings, like so:
2017/02/28 Transfer
Assets:Checking -$20.00
; ofxid: someid.123456789.etc
Assets:Savings $20.00
; ofxid: someid.987654321.etc
To make this case easier to support, and to better structure the ledger file, can the ofxid
tags be applied with posting scope rather than transaction scope?
The LICENSE
file and the license
field of setup.py
Line 21 in d2c0e40
Line 26 in 6923f26
A minor issue, but an issue for those of us trying to package ledger-autosync (for NixOS, in my case: NixOS/nixpkgs#53261 (comment))
The way ledger-autosync decides which account to use doesn't suit my needs. This is because of automated transactions.
Here is my ledger file (also available as attachement):
= /Expenses/
[Assets:Budget:Unbudgeted] -1.0
[Equity:Budget] 1.0
= /Expenses:Something/
[Assets:Budget:Something] -1.0
[Assets:Budget:Unbudgeted] 1.0
2018/08/06 Some guy
Assets:Current:Damien -10.00 EUR
Expenses:Something 10.00 EUR
If you import an ofx file referencing "Some guy", you will get:
2018/07/30 Some guy
Assets:Current -20.00 EUR
[Assets:Budget:Unbudgeted] 20.00 EUR
Here, I don't want [Assets:Budget:Unbudgeted]
(which is an implementation detail) but Expenses:Something
(which is what I already wrote in the existing ledger file).
Reproduce this with these attachments:
and this command line:
> ledger-autosync --ledger foo.ledger --payee-format "{payee}" --account Assets:Current --fid 000 foo.ofx
I have noticed for a while that the transaction dates produced by ledger-autosync
are occasionally off by one as compared to what is shown online or in my bank statements.
At the top of an OFX file I downloaded at 10:30 this morning, I found this:
<DTSERVER>20170905173000.000
Since I am currently in the PDT zone, I believe this means that the downloaded transaction files are always given in UTC (at least for this bank).
Unfortunately I don't see any reference to time zone in the file itself, so the only way to get the offset is to compare DTSERVER
with the local date.
Could ledger-autosync
add an argument to specify the time offset from DTSERVER
, and adjust output times accordingly?
After upgrading to 0.3.2, I'm getting this error:
Traceback (most recent call last):
File "/usr/local/bin/ledger-autosync", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python2.7/dist-packages/ledgerautosync/cli.py", line 190, in run
ledger = mk_ledger(ledger_file)
File "/usr/local/lib/python2.7/dist-packages/ledgerautosync/ledgerwrap.py", line 85, in mk_ledger
if ((distutils.spawn.find_executable('ledger') is not None) and
AttributeError: 'module' object has no attribute 'spawn'
72f9a18 seems relevant. Perhaps that introduced a new dependence that's not set up?
Briefly, ledger-autosync does not handle dividend income, at least from Fidelity, correctly. Instead of pulling from the "total" field, it treats all OFX investment transactions as buy/sell stock/mf and tries to use qty commodity @ $price
, even though this is not appropriate for dividend income.
Before:
2016/09/12 DIVIDEND RECEIVED
; ofxid: ofxid_redacted
fidelity.com:acctnum_redacted 0 "cusip_redacted" @ $0
Income:Dividends -$0.00
...others likewise
P 2016/10/08 07:30:08 cusip_redacted price_redacted
...others likewise
I did fix this and will issue a pull request shortly, but I do have a question (see bottom).
After:
>>> import sys
>>> sys.argv = ['','-a','Assets:Fido','/Users/james/Documents/ledger/test.ofx']
>>> from ledgerautosync.cli import run
>>> run()
2016/09/30 DIVIDEND RECEIVED
; ofxid: redacted
Assets:Fido $3.87
Income:Dividends -$3.87
...others likewise
P 2016/10/08 07:30:08 cusip_redacted price_redacted
...others likewise
Now, in my correctly-formatted dividend income postings, there is no link to the CUSIP/security/fund generating the dividend. I could list this as (1) metadata or (2) in the payee/description field (e.g., "DIVIDEND RECEIVED -- IBM")
If other maintainers will weigh in on this, I'll tidy this loose end and make a pull request.
Maybe I'm doing something wrong. In a QFX file, the following OFX transaction:
<INCOME>
<INVTRAN>
<FITID>CD-10-5WF36378-1-USD-06/20/2016-1
<DTTRADE>20160620070000.000[-5:CDT]
</INVTRAN>
<SECID>
<UNIQUEID>921943858
<UNIQUEIDTYPE>CUSIP
</SECID>
<INCOMETYPE>DIV
<TOTAL>1.45
<SUBACCTSEC>CASH
<SUBACCTFUND>CASH
</INCOME>
is translated into the following hledger transaction:
2016/06/20 Assets:WealthFront: income
; ofxid: 10780.10-5WF36378.CD-10-5WF36378-1-USD-06_20_2016-1
Assets:WealthFront 0 "921943858" @ $0
Assets:WealthFront -$0.00
I set the accounts using parameters, so ignore those. But the amount got changed from 1.45 to 0, and the fact that it is a dividend was lost. Note the transaction ID matches, so that is the same transaction.
Also, the end of the created hledger file has lines of the format:
P 2016/10/06 12:00:00 78468R721 49.71
CHANGELOG.md lists 0.3.0 but GitHub has 0.3.5. It would be good to either update or delete the changelog.
What is the proper way to contribute patches to this project? A CONTRIBUTING
file or section in the Readme would help new people jump in quicker, with less concern that they're stepping on someone else's work
Currently ledger-autosync
can guess the unknown account based on previous transactions with the same payee. However, the payee output by ledger-autosync
isn't usually in the format that I want for my ledger file, so I rewrite it as needed. (Example: ledger-autosync
gives Debit Card Purchase - STARBUCKS
as the payee for one transaction. I don't care about the first part, and the second part is shouty, so I change the payee to Starbucks
.) Unfortunately, this breaks the account guessing, which causes me to additionally need to rewrite the unknown account.
I have a couple ideas of how to fix this. The first is: would it be possible to save the payee that ledger-autosync
outputs to e.g. a tag, and match on that? (I assume I could add a Payee:
directive, but that would probably also affect any ledger output.)
Second idea: Ledger recognizes a payee
sub-directive to the account
directive, as follows (from the Ledger docs):
account Expenses:Food payee ^(KFC|Popeyes)$
...
The
payee
sub-directive, which can occur multiple times, provides regexes that identify the account if that payee is encountered and an account within its transaction ends in the name "Unknown". Example:2012-02-27 KFC Expenses:Unknown $10.00 ; Read now as "Expenses:Food" Assets:Cash
Could ledger-autosync
apply these regexes to find the matching account to use? I realize I could add the payee
sub-directives and use a generic unknown account, but I'd rather have the correct account in my ledger file, so it's clear without searching through the headers for the payee directive.
When I use ledger-autosync
on my most recent PayPal CSV export, the output doesn't use the currency that I want it to.
For an input line of:
"12/1/2017","15:03:52","PST","John Smith","General Payment","Completed","USD","-10.00","","0.00"
I get this output:
2017/12/01 John Smith: General Payment
Assets:PayPal -10.00 USD
;; csvid: abc123
Expenses:Misc 10.00 USD
The USD
is pulled directly from the CSV file, but I want it to display as e.g. $10.00
instead. I couldn't find anything built-in to Ledger to handle this; it appears the alias
directive only applies to accounts and payees (though I don't get an error when I put one under a commodity). If I replace "USD"
with "$"
in the CSV file, it works as expected, but I'd rather not modify the original file if possible.
Is this something ledger-autosync
could handle?
I'm seeing this in both the pip-downloaded version and when I install from a clone of the github repo. Here's what the error looks like:
geodeโ ~/Nextcloud/ledger/personal/unprocessed๐
ledger-autosync \
-a 'Assets:Liquid:PayPal' \
-l main.ledger \
/Users/me/Nextcloud/ledger/personal/unprocessed/bom-test.csv \
Traceback (most recent call last):
File "/usr/local/bin/ledger-autosync", line 11, in <module>
load_entry_point('ledger-autosync==1.0.1', 'console_scripts', 'ledger-autosync')()
File "/usr/local/lib/python3.7/site-packages/ledger_autosync-1.0.1-py3.7.egg/ledgerautosync/cli.py", line 353, in run
File "/usr/local/lib/python3.7/site-packages/ledger_autosync-1.0.1-py3.7.egg/ledgerautosync/cli.py", line 187, in import_csv
File "/usr/local/lib/python3.7/site-packages/ledger_autosync-1.0.1-py3.7.egg/ledgerautosync/sync.py", line 203, in parse_file
File "/usr/local/lib/python3.7/site-packages/ledger_autosync-1.0.1-py3.7.egg/ledgerautosync/converter.py", line 524, in make_converter
Exception: Cannot determine CSV type
geodeโ ~/Nextcloud/ledger/personal/unprocessed๐
And here's what a friend added to my Makefile to fix it:
BOM := $(shell bash -c "echo -e '\xEF\xBB\xBF'")
$(INPUTDIR)/%-nobom.csv: $(INPUTDIR)/%.csv
sed '1s/^$(BOM)//' < $< \
| grep -v '"Order",".*",".*","","","0.00"' \
> $@
(Sorry, that's a bit messy, the extra stuff is in there for completion, so there's context if anyone wants to duplicate it.) The sed statement is the important part -- it searches for the BOM on line one of the file and replaces it with nothing. INPUTDIR is the path to my downloaded, unprocessed files, and we're making a cleaned up paypal-nobom.csv file that is dependent on the downloaded paypal.csv file. The grep line is to deal with another problem where ledger-autosync would choke whenever it encountered one of the numerous lines with no value in the amount field (why, paypal??), so we've added that as part of the BOM-removal process.
Hello!
In the QFX format, I believe <name>
corresponds to "payee".
Here is an example real world transaction:
<STMTTRN><TRNTYPE>DEBIT<DTPOSTED>20170529235959<TRNAMT>-000000003.38<FITID>0529170148 000000003.38WG00Debit Card 542800<NAME>WILLISTON LIQUIDATI WILLISTON VT<MEMO>Debit Card W/D: Debit Card</STMTTRN>
ledger-autosync produces this:
166 โ 2017/05/29 WILLISTON LIQUIDATI WILLISTON VT Debit Card W/D: Debit Card
167 โ ; ofxid: 11809.0000751001392362.0529170148_000000003.38WG00Debit_Card______542800
168 โ Northeast Credit Union -$3.38
169 โ Expenses:Misc $3.38
Now, it seems to me that ledger-autosync ought to end up with 'WILLISTON LIQUIDATI WILLISTON VT' as the payee as opposed to 'WILLISTON LIQUIDATI WILLISTON VT Debit Card W/D: Debit Card'.
What do you think @egh ?
The following is not easy to decipher:
Traceback (most recent call last):
File "/usr/bin/hledger-autosync", line 11, in
load_entry_point('ledger-autosync==0.2.5', 'console_scripts', 'hledger-autosync')()
File "/usr/lib/python2.7/site-packages/ledgerautosync/cli.py", line 199, in run
import_csv(ledger, args)
File "/usr/lib/python2.7/site-packages/ledgerautosync/cli.py", line 109, in import_csv
for txn in sync.parse_file(args.PATH, accountname=args.account):
File "/usr/lib/python2.7/site-packages/ledgerautosync/sync.py", line 132, in parse_file
"csvid", converter.get_csv_id(row)))]
File "/usr/lib/python2.7/site-packages/ledgerautosync/ledgerwrap.py", line 227, in check_transaction_by_id
return self.run(cmd) != ''
File "/usr/lib/python2.7/site-packages/ledgerautosync/ledgerwrap.py", line 223, in run
return subprocess.check_output(cmd)
File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
process = Popen(stdout=PIPE, _popenargs, *_kwargs)
File "/usr/lib/python2.7/subprocess.py", line 711, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Hello,
Sorry but with the whole python 3 fiasco, it might be nice to have something in the readme that indicates which version of python to install.
Thanks!
Frequently, "extra comments" on a transaction will appear in the OFX stream as extra $0 transactions following the transaction to which they refer.
<STMTTRN>
<TRNTYPE>CREDIT
<DTPOSTED>20161027160000.000
<TRNAMT>123.45
<FITID>FITID20161027123.45ABCDE
<NAME>AMAZON MKTPLACE PMTS AMZN.COM/BI
</STMTTRN>
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20161027160000.000
<TRNAMT>-0
<FITID>FITID20161027-0.0ABCDE
<NAME>XXXEXTRASTUFFXXX
</STMTTRN>
Most financial software handles this transparently, using the second "transaction" as a comment on the first one. The ledger transactions produced by ledger-autosync include them as-is, however.
I've attempted to implement this functionality on my end, but ran into the problem that it makes ledger-autosync's deduping not work, as if there's more than one ofxid in the notes, it uses only the last one, so either the main transaction or the extra comment transaction will fail to be deduped.
Ideally, ledger-autosync would abstract away this annoyance of the OFX/financial system and do the merging automatically. As a fallback, recognizing more than one ofxid would allow me to solve it on my end. Were that to also not be feasible, ledger-autosync stopping once it first encountered a transaction already in the ledger would at least bound the damage to {0,1} extra transactions per import, instead of the potentially dozens currently.
PayPal bizarrely encodes its amounts as strings, and unfortunately includes comma separators. Removing the commas in PaypalConverter
isn't hard, but it's not clear how this will behave for European users and whether the locale is required. (This impacts hledger, but may not impact ledger.)
Related: Is there a way to override the PayPalConverter? I don't like how it writes the payee name and mk_dynamic_account is working fine for me so I want to add it back.
My bank gives me OFX / QFX files encoded as latin1
, with the following lines in the header:
ENCODING:USASCII
CHARSET:8859-1
When I try to use them, I get the following error:
LookupError: unknown encoding: cp8859-1
I managed to make it work by changing CHARSET
to 819
, and transactions print fine to STDOUT, but whenever I try to output it in a file (e.g ledger-autosync --account Assets:Checking releve.qfx >> main.ledger
), I get the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 32: ordinal not in range(128)
I do have some accented letters in my transaction descriptions, as my main language is French. It looks like ledger-autosync has a hard time with text encodings.
something akin to Assets:{%category}
example ofx response with category: tangerine Canada OFX respond
When using ledger-autosync to read an existing ofx file, I don't expect ledger-autosync to access my keyring and ask me to unlock it. This annoys me because I don't use Gnome keyring and I don't want any application to use it and ask me to unlock it.
Using master, the following command:
ledger-autosync -l test.ledger
Where test.ledger contains any transactions, e.g.:
2016/01/02 Transfer
Assets:Checquing:T:J CAD400.00
Assets:Savings:T:T:J -CAD400.00
Yields the following error if there were downloaded transactions that need to be processed:
Caught exception processing Assets:Checquing:T:JTraceback (most recent call last):
File "/home/phil/ledger-autosync/ledgerautosync/cli.py", line 97, in sync
print_results(converter, ofx, ledger, txns, args)
File "/home/phil/ledger-autosync/ledgerautosync/cli.py", line 73, in print_results
print converter.convert(txn).format(args.indent)
File "/home/phil/ledger-autosync/ledgerautosync/converter.py", line 310, in convert
self.mk_dynamic_account(self.format_payee(txn), exclude=self.name),
File "/home/phil/ledger-autosync/ledgerautosync/converter.py", line 183, in mk_dynamic_account
account = self.lgr.get_account_by_payee(payee, exclude)
File "/home/phil/ledger-autosync/ledgerautosync/ledgerwrap.py", line 81, in get_account_by_payee
self.load_payees()
File "/home/phil/ledger-autosync/ledgerautosync/ledgerwrap.py", line 210, in load_payees
self.add_payee(xact.payee, xact.account)
AttributeError: 'Transaction' object has no attribute 'account'
My bank recently dropped support for plain OFX files for transaction downloads. Thankfully, they offer files in the QFX format ("for Quicken"), which appear to be an XML-compliant version of the OFX standard. However, they've made some changes in how they format the data in the files.
Here is an example transaction (whitespace for readability, original file is entirely on one line):
<STMTTRN>
<TRNTYPE>DEBIT</TRNTYPE>
<DTPOSTED>20190331000000.000</DTPOSTED>
<TRNAMT>1.23</TRNAMT>
<FITID>201903311234</FITID>
<MEMO>Monthly Interest Paid</MEMO>
</STMTTRN>
You may spot a couple other issues here, but the one I care about in this issue is the payee/memo fields.
In the previous OFX files, they used the <NAME>
field and had no <MEMO>
, but this QFX file reverses that, which has broken syncing for me. It doesn't appear that they've changed the content at all; the <MEMO>
field in the QFX file looks just like the <NAME>
field in the OFX file did. (I guess this change actually makes sense given the contents of the field, I just wish they would put a useful payee in the <NAME>
field.) My main concern is using my new payee-matching functionality (#62) to get a useful payee for my Ledger file.
I see a couple possible solutions:
payee
is blank and memo
is not, copy memo
to payee
. get_autosync_payee
will be called after that, so payee
will potentially be changed, while memo
would be left alone. That could be an issue, so maybe we should also clear memo
? What about valid reasons to have a blank payee
with a memo
? (Are there any?)payee
is blank and memo
is not, run get_autosync_payee
on memo
instead of payee
. Could then use payee_format
of {memo}
to set the Ledger payee correctly.sed
and replace <MEMO>
with <NAME>
before passing to ledger-autosync.I have the first solution working locally (and I use a payee_format
of {payee}
anyway, so I don't care what happens to memo
), but I wanted to get your input before I submit a PR.
I noticed ledger-autosync doesn't work with Python 3. Since Python 2 will be EOL in 2020, any plans to support Python 3?
Please let me know if this is not the right place for this question.
I would like to import a csv file using ledger-autosync, but I am having trouble to adjust my file to the accepted formats. Could someone post an example csv file that can be imported so I can use as a base to generate my csv? I am not able to create a plugin, so I would like to follow an existing format.
Hi,
I use dd/mm/yyyy format in my ledger file. I saw this pull which introduced date formatting for output string.
My problem occurs before and the output looks like ...
While parsing file "***/personal.ledger", line 39:
While parsing transaction:
> 26/02/2020 ***
Error: Year is out of valid range: 1400..10000
...
While parsing file "***/personal.ledger", line 84:
While parsing transaction:
> 03/03/2020 ***
Error: Invalid date: 03/03/2020
...
Traceback (most recent call last):
File "***/.pyenv/versions/3.6.9/bin/ledger-autosync", line 11, in <module>
load_entry_point('ledger-autosync==1.0.1', 'console_scripts', 'ledger-autosync')()
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/cli.py", line 363, in run
import_ofx(ledger, args)
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/cli.py", line 160, in import_ofx
ofx.account.account_id)
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/sync.py", line 95, in filter
retval = [txn for txn in sorted_txns
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/sync.py", line 96, in <listcomp>
if not(self.is_txn_synced(acctid, txn))]
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/sync.py", line 59, in is_txn_synced
return self.lgr.check_transaction_by_id("ofxid", ofxid)
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/ledgerwrap.py", line 166, in check_transaction_by_id
next(self.run(q))
File "***/.pyenv/versions/3.6.9/lib/python3.6/site-packages/ledgerautosync/ledgerwrap.py", line 160, in run
universal_newlines=True).splitlines(),
File "***/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 356, in check_output
**kwargs).stdout
File "***/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ledger', '--args-only', '-f', '***/personal.ledger', 'csv', '-E', 'meta', 'ofxid=1506983S037.P4QYNELGXF']' returned non-zero exit status 20.
I installed dev source to have output date format handling.
I use ฬ--input-date-format %d/%m/%Y` option in ledger, but this does not exists for ledger-autosync.
Do you have an idea for me ? Is there something I misunderstood ?
Another payee processing error.
GOOGLE *PROJECT FI G.CO/PAYHELP#
results in
Error: code operator not followed by argument ERROR:root:Error checking --real payee for GOOGLE \\*PROJECT FI G.CO\/PAYHELP#
Hi, I don't know if this is reproduceable or not, but when setting up ofxclient, I seemed to have an error. That will be shown below. However, it apparently did not stop the setup from creating the correct ~/ofxclient.ini file. So it must have been some kind of warning. I am willing to try to remove my ofxclient.ini and try to reproduce it if you like.
I am on debian jessie 8.8.0 with all latest patches applied. I got my copy of ledger-autosync via pip as of today.
Here is the output:
$ ofxclient
+----------------------------------
Main
Edit /home/jeff/ofxclient.ini to
change descriptions or ofx options
+----------------------------------
(A) Add an account
(Q) Quit
choice> A
+----------------------------------
Add account
+----------------------------------
------
Notice
------
You are about to search for bank connection information
on a third party website. This means you are trusting
http://ofxhome.com and their security policies.
You will be sending your bank name to this website.
------
bank name eg. "express" (enter to exit)> xxxxxx
(0) XXXXXX
choice> 0
------
Notice
------
You are about to test to make sure your username and password
are correct. This means you will be sending it to the URL below.
If the URL does not appear to belong to your bank then you should
exit this program by hitting CTRL-C.
bank name: XXXXXX
bank url: https://xxx.xxxxxx.xxx
------
username> xxxxxxxxxx
password>
password>
authentication failed: User or Member password invalid
username> xxxxxxxxxx
password>
+----------------------------------
Main
Edit /home/jeff/ofxclient.ini to
change descriptions or ofx options
+----------------------------------
Traceback (most recent call last):
File "/usr/local/bin/ofxclient", line 11, in <module>
load_entry_point('ofxclient==2.0.3', 'console_scripts', 'ofxclient')()
File "/usr/local/lib/python2.7/dist-packages/ofxclient/cli.py", line 63, in run
main_menu(args)
File "/usr/local/lib/python2.7/dist-packages/ofxclient/cli.py", line 71, in main_menu
accounts = GlobalConfig.accounts()
File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 216, in accounts
for s in self.parser.sections()]
File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 301, in _section_to_account
section_items = dict(self.parser.items(section))
File "/usr/local/lib/python2.7/dist-packages/ofxclient/config.py", line 100, in items
for k, v in ConfigParser.items(self, section):
File "/usr/lib/python2.7/ConfigParser.py", line 655, in items
for option in options]
File "/usr/lib/python2.7/ConfigParser.py", line 663, in _interpolate
if value and "%(" in value:
TypeError: argument of type 'int' is not iterable
$ _
Let me know if you need me to supply any additional information.
The transactions in my downloaded PayPal transaction CSV files are listed in reverse-chronological order, with the newest first. It appears that ledger-autosync
processes the transactions one at a time and doesn't adjust the order, because it also prints the newest transaction first. (Due to #26, I don't know if this affects either the original converter or the original file format.)
Since ledger files have their transactions in (approximate) chronological order, could this output be reversed?
Obviously I can reorder them myself in the meantime, so this isn't a high priority.
I've got a QFX file from Vanguard. It's denoted in USD, but ledger-autosync outputs transactions with a $
for USD amounts. I'd prefer if I could have it output USD to conform to the rest of my records. I don't see a way to do that presently.
When passing --initial
, I expect an initial balance transaction whose date is the date of the first transaction. Currently, the date is the one of yesterday.
I tried to import a CSV file downloaded from my PayPal account (from this page), and I got this error:
Traceback (most recent call last):
File "/usr/local/bin/ledger-autosync", line 11, in <module>
load_entry_point('ledger-autosync==0.3.4', 'console_scripts', 'ledger-autosync')()
File "build/bdist.linux-x86_64/egg/ledgerautosync/cli.py", line 239, in run
File "build/bdist.linux-x86_64/egg/ledgerautosync/cli.py", line 133, in import_csv
File "build/bdist.linux-x86_64/egg/ledgerautosync/sync.py", line 151, in parse_file
File "build/bdist.linux-x86_64/egg/ledgerautosync/converter.py", line 407, in make_converter
Exception: Cannot determine CSV type
I looked at the CSV file, and this is the first line:
Date, Time, Time Zone, Name, Type, Status, Amount, Receipt ID, Balance,
which I notice is different from this line in the codebase, so maybe PayPal changed their CSV format?
Hi @egh !
I'm very keen on getting ledger-autosync working; however, I've run into some issues.
So, I decided to try out your tests. Unfortunately, they seem to be failing.
Would you mind helping me to decipher why this fails?
Thank you.
EDIT: To clarify, I am running MacOS Sierra.
EDIT2: OK, two issues. The test was choking on a wrapper I had written for ledger -- that one's on me.
However, I think I've isolated the rest of the problem. The tests were also choking on my configuration file, which had included the pedantic checking.
After commenting everything out, tests passed with flying colors.
Maybe the tests should ignore user config files?
E.............While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 1:
While parsing transaction:
> 2011/03/31 DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
Error: Unknown payee 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 6:
While parsing transaction:
> 2011/04/05 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 11:
While parsing transaction:
> 2011/04/07 RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
Error: Unknown payee 'RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 16:
While parsing transaction:
> 2011/04/07 Empty
Error: Unknown payee 'Empty'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 21:
While parsing transaction:
> 2011/03/31 TEST SLASH
Error: Unknown payee 'TEST SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 26:
While parsing transaction:
> 2011/03/31 PAYEE TEST:COLON
Error: Unknown payee 'PAYEE TEST:COLON'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 30:
While parsing transaction:
> 2011/03/31 PAYEE TEST/SLASH
Error: Unknown payee 'PAYEE TEST/SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 34:
While parsing transaction:
> 2011/03/31 PAYEE TEST,COMMA
Error: Unknown payee 'PAYEE TEST,COMMA'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 38:
While parsing transaction:
> 2011/03/31 PAYEE TEST.PERIOD
Error: Unknown payee 'PAYEE TEST.PERIOD'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 42:
While parsing transaction:
> 2011/03/31 PAYEE TEST*STAR
Error: Unknown payee 'PAYEE TEST*STAR'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 46:
While parsing transaction:
> 2011/03/31 PAYEE TEST#HASH
Error: Unknown payee 'PAYEE TEST#HASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 50:
While parsing transaction:
> 2011/03/31 PAYEE TEST"QUOTE
Error: Unknown payee 'PAYEE TEST"QUOTE'
EWhile parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 1:
While parsing transaction:
> 2011/03/31 DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
Error: Unknown payee 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 6:
While parsing transaction:
> 2011/04/05 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 11:
While parsing transaction:
> 2011/04/07 RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
Error: Unknown payee 'RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 16:
While parsing transaction:
> 2011/04/07 Empty
Error: Unknown payee 'Empty'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 21:
While parsing transaction:
> 2011/03/31 TEST SLASH
Error: Unknown payee 'TEST SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 26:
While parsing transaction:
> 2011/03/31 PAYEE TEST:COLON
Error: Unknown payee 'PAYEE TEST:COLON'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 30:
While parsing transaction:
> 2011/03/31 PAYEE TEST/SLASH
Error: Unknown payee 'PAYEE TEST/SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 34:
While parsing transaction:
> 2011/03/31 PAYEE TEST,COMMA
Error: Unknown payee 'PAYEE TEST,COMMA'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 38:
While parsing transaction:
> 2011/03/31 PAYEE TEST.PERIOD
Error: Unknown payee 'PAYEE TEST.PERIOD'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 42:
While parsing transaction:
> 2011/03/31 PAYEE TEST*STAR
Error: Unknown payee 'PAYEE TEST*STAR'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 46:
While parsing transaction:
> 2011/03/31 PAYEE TEST#HASH
Error: Unknown payee 'PAYEE TEST#HASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 50:
While parsing transaction:
> 2011/03/31 PAYEE TEST"QUOTE
Error: Unknown payee 'PAYEE TEST"QUOTE'
EWhile parsing file "/private/tmp/ledger-autosync/fixtures/checking-dynamic-account.lgr", line 1:
While parsing transaction:
> 2011/01/01 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking-dynamic-account.lgr", line 5:
While parsing transaction:
> 2011/01/02 Generic
Error: Unknown payee 'Generic'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking-dynamic-account.lgr", line 9:
While parsing transaction:
> 2011/02/02 Generic
Error: Unknown payee 'Generic'
EWhile parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 1:
While parsing transaction:
> 2011/03/31 DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
Error: Unknown payee 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 6:
While parsing transaction:
> 2011/04/05 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 11:
While parsing transaction:
> 2011/04/07 RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
Error: Unknown payee 'RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 16:
While parsing transaction:
> 2011/04/07 Empty
Error: Unknown payee 'Empty'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 21:
While parsing transaction:
> 2011/03/31 TEST SLASH
Error: Unknown payee 'TEST SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 26:
While parsing transaction:
> 2011/03/31 PAYEE TEST:COLON
Error: Unknown payee 'PAYEE TEST:COLON'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 30:
While parsing transaction:
> 2011/03/31 PAYEE TEST/SLASH
Error: Unknown payee 'PAYEE TEST/SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 34:
While parsing transaction:
> 2011/03/31 PAYEE TEST,COMMA
Error: Unknown payee 'PAYEE TEST,COMMA'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 38:
While parsing transaction:
> 2011/03/31 PAYEE TEST.PERIOD
Error: Unknown payee 'PAYEE TEST.PERIOD'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 42:
While parsing transaction:
> 2011/03/31 PAYEE TEST*STAR
Error: Unknown payee 'PAYEE TEST*STAR'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 46:
While parsing transaction:
> 2011/03/31 PAYEE TEST#HASH
Error: Unknown payee 'PAYEE TEST#HASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 50:
While parsing transaction:
> 2011/03/31 PAYEE TEST"QUOTE
Error: Unknown payee 'PAYEE TEST"QUOTE'
EWhile parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 1:
While parsing transaction:
> 2011/03/31 DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
Error: Unknown payee 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 6:
While parsing transaction:
> 2011/04/05 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 11:
While parsing transaction:
> 2011/04/07 RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
Error: Unknown payee 'RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 16:
While parsing transaction:
> 2011/04/07 Empty
Error: Unknown payee 'Empty'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 21:
While parsing transaction:
> 2011/03/31 TEST SLASH
Error: Unknown payee 'TEST SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 26:
While parsing transaction:
> 2011/03/31 PAYEE TEST:COLON
Error: Unknown payee 'PAYEE TEST:COLON'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 30:
While parsing transaction:
> 2011/03/31 PAYEE TEST/SLASH
Error: Unknown payee 'PAYEE TEST/SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 34:
While parsing transaction:
> 2011/03/31 PAYEE TEST,COMMA
Error: Unknown payee 'PAYEE TEST,COMMA'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 38:
While parsing transaction:
> 2011/03/31 PAYEE TEST.PERIOD
Error: Unknown payee 'PAYEE TEST.PERIOD'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 42:
While parsing transaction:
> 2011/03/31 PAYEE TEST*STAR
Error: Unknown payee 'PAYEE TEST*STAR'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 46:
While parsing transaction:
> 2011/03/31 PAYEE TEST#HASH
Error: Unknown payee 'PAYEE TEST#HASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 50:
While parsing transaction:
> 2011/03/31 PAYEE TEST"QUOTE
Error: Unknown payee 'PAYEE TEST"QUOTE'
EWhile parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 1:
While parsing transaction:
> 2011/03/31 DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
Error: Unknown payee 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 6:
While parsing transaction:
> 2011/04/05 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 11:
While parsing transaction:
> 2011/04/07 RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
Error: Unknown payee 'RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 16:
While parsing transaction:
> 2011/04/07 Empty
Error: Unknown payee 'Empty'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 21:
While parsing transaction:
> 2011/03/31 TEST SLASH
Error: Unknown payee 'TEST SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 26:
While parsing transaction:
> 2011/03/31 PAYEE TEST:COLON
Error: Unknown payee 'PAYEE TEST:COLON'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 30:
While parsing transaction:
> 2011/03/31 PAYEE TEST/SLASH
Error: Unknown payee 'PAYEE TEST/SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 34:
While parsing transaction:
> 2011/03/31 PAYEE TEST,COMMA
Error: Unknown payee 'PAYEE TEST,COMMA'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 38:
While parsing transaction:
> 2011/03/31 PAYEE TEST.PERIOD
Error: Unknown payee 'PAYEE TEST.PERIOD'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 42:
While parsing transaction:
> 2011/03/31 PAYEE TEST*STAR
Error: Unknown payee 'PAYEE TEST*STAR'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 46:
While parsing transaction:
> 2011/03/31 PAYEE TEST#HASH
Error: Unknown payee 'PAYEE TEST#HASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 50:
While parsing transaction:
> 2011/03/31 PAYEE TEST"QUOTE
Error: Unknown payee 'PAYEE TEST"QUOTE'
EWhile parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 1:
While parsing transaction:
> 2011/03/31 DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%
Error: Unknown payee 'DIVIDEND EARNED FOR PERIOD OF 03/01/2011 THROUGH 03/31/2011 ANNUAL PERCENTAGE YIELD EARNED IS 0.05%'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 6:
While parsing transaction:
> 2011/04/05 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 11:
While parsing transaction:
> 2011/04/07 RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11
Error: Unknown payee 'RETURNED CHECK FEE, CHECK # 319 FOR $45.33 ON 04/07/11'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 16:
While parsing transaction:
> 2011/04/07 Empty
Error: Unknown payee 'Empty'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 21:
While parsing transaction:
> 2011/03/31 TEST SLASH
Error: Unknown payee 'TEST SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 26:
While parsing transaction:
> 2011/03/31 PAYEE TEST:COLON
Error: Unknown payee 'PAYEE TEST:COLON'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 30:
While parsing transaction:
> 2011/03/31 PAYEE TEST/SLASH
Error: Unknown payee 'PAYEE TEST/SLASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 34:
While parsing transaction:
> 2011/03/31 PAYEE TEST,COMMA
Error: Unknown payee 'PAYEE TEST,COMMA'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 38:
While parsing transaction:
> 2011/03/31 PAYEE TEST.PERIOD
Error: Unknown payee 'PAYEE TEST.PERIOD'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 42:
While parsing transaction:
> 2011/03/31 PAYEE TEST*STAR
Error: Unknown payee 'PAYEE TEST*STAR'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 46:
While parsing transaction:
> 2011/03/31 PAYEE TEST#HASH
Error: Unknown payee 'PAYEE TEST#HASH'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking.lgr", line 50:
While parsing transaction:
> 2011/03/31 PAYEE TEST"QUOTE
Error: Unknown payee 'PAYEE TEST"QUOTE'
EEEEEEEE...While parsing file "/private/tmp/ledger-autosync/fixtures/checking-dynamic-account.lgr", line 1:
While parsing transaction:
> 2011/01/01 AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )
Error: Unknown payee 'AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking-dynamic-account.lgr", line 5:
While parsing transaction:
> 2011/01/02 Generic
Error: Unknown payee 'Generic'
While parsing file "/private/tmp/ledger-autosync/fixtures/checking-dynamic-account.lgr", line 9:
While parsing transaction:
> 2011/02/02 Generic
Error: Unknown payee 'Generic'
E.......E..........EEEEE
======================================================================
ERROR: Failure: ImportError (No module named mock)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/private/tmp/ledger-autosync/tests/test_cli.py", line 26, in <module>
from mock import Mock, call
ImportError: No module named mock
======================================================================
ERROR: test_empty_transaction (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 38, in test_empty_transaction
self.assertTrue(self.lgr.check_transaction_by_id("ofxid", "empty"))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 166, in check_transaction_by_id
self.run(q).next()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking.lgr', 'csv', '-E', 'meta', 'ofxid=empty']' returned non-zero exit status 12
======================================================================
ERROR: test_get_account_by_payee (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 41, in test_get_account_by_payee
account = self.lgr.get_account_by_payee("AUTOMATIC WITHDRAWAL, ELECTRIC BILL WEB(S )", exclude="Assets:Foo")
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 82, in get_account_by_payee
self.load_payees()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 174, in load_payees
r = self.run(["show"])
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking.lgr', 'csv', 'show']' returned non-zero exit status 12
======================================================================
ERROR: test_get_ambiguous_account_by_payee (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 45, in test_get_ambiguous_account_by_payee
account = self.dynamic_lgr.get_account_by_payee("Generic", exclude="Assets:Foo")
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 82, in get_account_by_payee
self.load_payees()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 174, in load_payees
r = self.run(["show"])
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking-dynamic-account.lgr', 'csv', 'show']' returned non-zero exit status 3
======================================================================
ERROR: test_load_payees (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 66, in test_load_payees
self.lgr.load_payees()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 174, in load_payees
r = self.run(["show"])
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking.lgr', 'csv', 'show']' returned non-zero exit status 12
======================================================================
ERROR: test_nonexistent_transaction (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 35, in test_nonexistent_transaction
self.assertFalse(self.lgr.check_transaction_by_id("ofxid", "FOO"))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 166, in check_transaction_by_id
self.run(q).next()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking.lgr', 'csv', '-E', 'meta', 'ofxid=FOO']' returned non-zero exit status 12
======================================================================
ERROR: test_ofx_id_quoting (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 62, in test_ofx_id_quoting
self.assertEqual(self.lgr.check_transaction_by_id("ofxid", "1/2"), True,
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 166, in check_transaction_by_id
self.run(q).next()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking.lgr', 'csv', '-E', 'meta', 'ofxid=1_2']' returned non-zero exit status 12
======================================================================
ERROR: test_ofx_payee_quoting (tests.test_ledger.TestLedger)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 58, in test_ofx_payee_quoting
self.assertNotEqual(self.lgr.get_account_by_payee(payee, ['Assets:Foo']), None,
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 82, in get_account_by_payee
self.load_payees()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 174, in load_payees
r = self.run(["show"])
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking.lgr', 'csv', 'show']' returned non-zero exit status 12
======================================================================
ERROR: test_empty_transaction (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_get_account_by_payee (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_get_ambiguous_account_by_payee (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_load_payees (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_nonexistent_transaction (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_ofx_id_quoting (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_ofx_payee_quoting (tests.test_ledger.TestLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ledger.py", line 85, in setUp
self.lgr = LedgerPython(self.ledger_path)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_dynamic_account (tests.test_ofx_formatter.TestOfxConverter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_ofx_formatter.py", line 88, in test_dynamic_account
self.assertEqualLedgerPosting(converter.convert(ofx.account.statement.transactions[1]).format(),
File "/private/tmp/ledger-autosync/ledgerautosync/converter.py", line 310, in convert
self.mk_dynamic_account(self.format_payee(txn), exclude=self.name),
File "/private/tmp/ledger-autosync/ledgerautosync/converter.py", line 183, in mk_dynamic_account
account = self.lgr.get_account_by_payee(payee, exclude)
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 82, in get_account_by_payee
self.load_payees()
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 174, in load_payees
r = self.run(["show"])
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 160, in run
return csv.reader(subprocess.check_output(cmd).splitlines(), dialect='ledger')
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 219, in check_output
raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['ledger', '-f', 'fixtures/checking-dynamic-account.lgr', 'csv', 'show']' returned non-zero exit status 3
======================================================================
ERROR: Failure: ImportError (No module named mock)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/private/tmp/ledger-autosync/tests/test_sync.py", line 28, in <module>
from mock import Mock
ImportError: No module named mock
======================================================================
ERROR: test_apostrophe (tests.test_weird_ofx.TestWeirdOfxLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_weird_ofx.py", line 75, in setUp
self.lgr = LedgerPython(os.path.join('fixtures', 'empty.lgr'))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_no_institution (tests.test_weird_ofx.TestWeirdOfxLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_weird_ofx.py", line 75, in setUp
self.lgr = LedgerPython(os.path.join('fixtures', 'empty.lgr'))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_no_institution_no_accountname (tests.test_weird_ofx.TestWeirdOfxLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_weird_ofx.py", line 75, in setUp
self.lgr = LedgerPython(os.path.join('fixtures', 'empty.lgr'))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_no_institution_no_fid (tests.test_weird_ofx.TestWeirdOfxLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_weird_ofx.py", line 75, in setUp
self.lgr = LedgerPython(os.path.join('fixtures', 'empty.lgr'))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
======================================================================
ERROR: test_one_settleDate (tests.test_weird_ofx.TestWeirdOfxLedgerPython)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/private/tmp/ledger-autosync/tests/test_weird_ofx.py", line 75, in setUp
self.lgr = LedgerPython(os.path.join('fixtures', 'empty.lgr'))
File "/private/tmp/ledger-autosync/ledgerautosync/ledgerwrap.py", line 193, in __init__
raise Exception("Ledger python interface not found!")
Exception: Ledger python interface not found!
----------------------------------------------------------------------
Ran 55 tests in 8.872s
FAILED (errors=22)
Importing a security from an InvestmentTransaction?
which doesn't have a TICKER tag in the security list leads to the following error.
Traceback (most recent call last):
File "ledgerautosync/cli.py", line 359, in <module>
run()
File "ledgerautosync/cli.py", line 355, in run
import_ofx(ledger, args)
File "ledgerautosync/cli.py", line 178, in import_ofx
print_results(converter, ofx, ledger, txns, args)
File "ledgerautosync/cli.py", line 74, in print_results
print(converter.convert(txn).format(args.indent))
File "/home/root/.local/lib/python3.8/site-packages/ledgerautosync/converter.py", line 138, in format
retval += posting.format(indent, assertions)
File "/home/root/.local/lib/python3.8/site-packages/ledgerautosync/converter.py", line 158, in format
len(self.account) - len(self.amount.format())
File "/home/root/.local/lib/python3.8/site-packages/ledgerautosync/converter.py", line 191, in format
if re.search(r'[\s0-9]', self.currency):
File "/usr/lib/python3.8/re.py", line 199, in search
return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object
In my case, an empty currency
argument here from self.maybe_get_ticker gets through and fails when trying to print later on.
I'm importing OFX from Vanguard. Here's what the security list section looks like.
<SECLIST>
<MFINFO>
<SECINFO>
<SECID>
<UNIQUEID>92204E852</UNIQUEID>
<UNIQUEIDTYPE>CUSIP</UNIQUEIDTYPE>
</SECID>
<SECNAME>Vanguard Target Retirement 2060 Trust Select</SECNAME>
<FIID>1685</FIID>
<UNITPRICE>44.11</UNITPRICE>
<DTASOF>20200116160000.000[-5:EST]</DTASOF>
<MEMO>Price as of date based on closing price</MEMO>
</SECINFO>
</MFINFO>
</SECLIST>
Inserting the following tag gets it working.
<TICKER>VTTSX</TICKER>
Would it be possible to fallback to printing the cusip
if no ticker is found? Seems like a bug from #12.
I'd be willing to make a jab at making the fix if you think it would be proper to fallback to printing the cusip
.
Aside:
Thanks for your work on ledger-autosync, it's really great ๐.
This release was uploaded to pypi, but no corresponding tag was pushed to the git repository.
Hi,
When using a credit card with deferred payment, the effective date mechanism is not used.
That means that a payment that I did, for instance, on the 31th of march is appears as done on the 4th of april when the bank actual withdraw the money from the account.
This is related jseutter/ofxparse#150 as ofxparse doesn't make that value available.
Example of such ofx transaction:
<STMTTRN>
<TRNTYPE>DEBIT
<DTPOSTED>20190304
<DTUSER>20190131
<TRNAMT>-109.17
<FITID>4fthuee
<NAME>FOO
</STMTTRN>
this is rendered as
2019/02/04 FOO
actif:account $-86.76
; ofxid: **************
expanse:Unknown $86.76
while it should be
2019/01/24=2019/02/04 FOO
...
I'd like to contribute a PR to support import for FirstDirect CSV files. FirstDirect is a UK bank, and their file format is ludicrously simplistic.
Here's an example:
Date,Description,Amount,Balance
04/03/2018,"GROSS INTEREST TO 03MAR2018",0.04,1599.54
27/02/2018,"MICKEY MOUSE HAPPY B'DAY",50.00,1599.50
22/02/2018,"MINNIE MOUSE I LOVE U",500.00,1549.50
04/02/2018,"GROSS INTEREST TO 03FEB2018",0.03,1049.50
The amounts are all GBP, but nothing in the file tells you that. So I'm thinking we would need a new CLI option for default currency.
The field names are rather generic, but sufficiently different from the existing CSV converters that the CSV subtype selection based on fieldset would still work OK (but may not in future, who knows).
Does this sound like something you would be prepared to merge? Should it have a more general name than FirstDirectConverter
?
While parsing value expression:
(real)&((payee =~ /...256 characters of stuff... ...10 more chars/))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Invalid char ' ' (wanted '/')
ERROR:root:Error checking --real payee for ...256 characters of stuff... ...10 more chars
I originally came to file this more urgently as it appeared that it was causing the program to immediately stop and only whatever partial output had been flushed at that point survived, but as I was doing a final repro on this I found myself unable to reproduce that part of it. Hmm. If I see that again, I'll let you know, but for now this seems to be simply a logged error that's not blocking functionality.
Apparently, latest release is compatible with Python 2 only even though master is compatible with Python 3. Is it time for a new release?
When a previous transaction was split into multiple accounts (paycheck is a good example), the system seems to match the payee and assign it all to the last entry, even if the values are identical. It should bring forward the split if it can match the amount, and leave it in default if it cannot.
hledger 1.10, ledger-autosync 7a303f3. With $LEDGER_FILE
pointing to a zero-length file, ledger-autosync some-ofx-from-discovercard.ofx
gets me:
Traceback (most recent call last):
File "/home/gnoutchd/ofx/ofxenv/bin/ledger-autosync", line 11, in <module>
load_entry_point('ledger-autosync', 'console_scripts', 'ledger-autosync')()
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/cli.py", line 355, in run
import_ofx(ledger, args)
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/cli.py", line 178, in import_ofx
print_results(converter, ofx, ledger, txns, args)
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/cli.py", line 74, in print_results
print(converter.convert(txn).format(args.indent))
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/converter.py", line 423, in convert
exclude=self.name))])
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/converter.py", line 247, in mk_dynamic_account
account = self.lgr.get_account_by_payee(payee, exclude)
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/ledgerwrap.py", line 80, in get_account_by_payee
self.load_payees()
File "/home/gnoutchd/ofx/ledger-autosync/ledgerautosync/ledgerwrap.py", line 270, in load_payees
next(r) # skip headers
File "/usr/lib/python3.7/csv.py", line 112, in __next__
row = next(self.reader)
StopIteration
Adding a transaction to $LEDGER_FILE
fixes it.
This patch also fixes it:
diff --git a/ledgerautosync/ledgerwrap.py b/ledgerautosync/ledgerwrap.py
index 5387994..de46d94 100644
--- a/ledgerautosync/ledgerwrap.py
+++ b/ledgerautosync/ledgerwrap.py
@@ -267,7 +267,6 @@ class HLedger(MetaLedger):
self.payees = {}
cmd = ["reg", "-O", "csv"]
r = csv.DictReader(self.run(cmd).splitlines())
- next(r) # skip headers
for line in r:
self.add_payee(line['description'], line['account'])
(I think DictReader
already consumes the headers?)
I ran ledger-autosync
just now, and it returned with no output, even though earlier it had given me a list of transactions and I hadn't added all of them to my ledgerfile yet. I enabled debug logging to troubleshoot the issue, and found this:
[snip]
DEBUG:root:---- response ----
DEBUG:root:{'fp': None, 'status': 200, 'will_close': False, 'chunk_left': 'UNKNOWN', 'length': 0, 'strict': 0, 'reason': 'OK', 'version': 11, 'debuglevel': 0, 'msg': <httplib.HTTPMessage instance at 0x7ff9703c0e18>, 'chunked': 0, '_method': u'POST'}
DEBUG:root:OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:28a7999be2484c698d601ec9d4aaea3d
<OFX><SIGNONMSGSRSV1><SONRS><STATUS><CODE>2000<SEVERITY>ERROR<MESSAGE>Customer needs an Access Code from Capital One 360 (along with your Customer Number or Saver ID (Username)) in order to pull Capital One 360 info into this tool.</STATUS><DTSERVER>20170830042305.465<LANGUAGE>ENG<DTACCTUP>20170830042305.465<FI><ORG>ING DIRECT<FID>031176110</FI></SONRS></SIGNONMSGSRSV1></OFX>
DEBUG:root:empty account: increasing days ago to 14.
[snip]
This happens several times until the max days is reached.
It appears that ledger-autosync
is not catching an error condition reported by the server. I believe this is a bug, and the error message above should be shown to the user.
In this case, the error isn't very helpful (it appears the cause is Capital One is having some issues, I couldn't login online either), but that's a server error, and it'd still be nice to know that something is wrong.
[user@machine ~]$ ledger-autosync
Caught exception processing Assets:(myaccount)Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/ledgerautosync/cli.py", line 55, in sync
(ofx, txns) = sync.get_new_txns(acct, resync=resync, max_days=max_days)
File "/usr/lib/python2.7/site-packages/ledgerautosync/sync.py", line 70, in get_new_txns
new_txns = self.filter(ofx)
File "/usr/lib/python2.7/site-packages/ledgerautosync/sync.py", line 40, in filter
sorted_txns = sorted(txns, key=lambda t: t.settleDate)
TypeError: can't compare datetime.datetime to NoneType
That's not working well there. I can't get started.
Hi there,
Is it possible to implement custom regex-based payee auto renaming before using the payee names to guess the account names? This is because some of my transactions fetched through OFX from Chase actually have a unique number attaches to the payee line and this makes the account name guessing unusable. If I could unify these by regex-replacing the payee lines first before doing the guessing this would be a lot more easier and tidier.
@egh , thanks again for ledger-autosync. Final barrier preventing me from integrating into my workflow is that Fidelity's OFX files give the CUSIP in <SECID>
, rather than the ticker symbol.
I've written a class that will translate CUSIP->Ticker (if that information is supplied in the OFX file) for both InvestmentTransactions and position statements (misnomer, actually P
commodity price lines).
This is not the optimal implementation as I would have it, for several reasons:
All of that being said, I don't want to let the perfect be the enemy of the good and shortly I will issue a pull request that functions. Please take a look at the implementation and let me know if you object and would require re-factor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.