Closed emin63 closed 4 years ago
Looks good to me! Thank you.
Yes, the tests are a little old and crufty. I'd like to rewrite with pytest. Usually nosetests -a generic -a ledger
should exercise them. There is an (old) python-ledger library that is used if present, but it's hard to build and complex.
This is a simple PR with a bugfix to include fees. See https://github.com/egh/ledger-autosync/issues/109.
Basically, in the case where there are fees in a stock trade, you need to adjust the total by the amount of the fees and also include a posting for the fees. If you don't do that, then your accounts will be wrong (at least for OFX files from Vanguard).
Note: I tried to run the unit tests you have but couldn't get them working. I think things were failing at
import ledger
. I installedhledger
and have ledger-cli installed but it looks like I need some other python package forledger
but that was not inrequirements.txt
.~If you provide docs on how to run tests, I am happy to try and write a test for this.~
I'm still not quite sure how to run your tests but I added a new test for the proposed fix and that seems to work.