Hi folks, I'm in the UK, so we get to deal with the inconvenience that is average cost booking when it comes to figuring out capital gains taxes. I'm currently using the average cost plugin, which works fine, but that approach it means that the inventory never gets reduced, so you end up with holdings never really going away.
So I was planning on using a cost-basis adjustment approach (https://beancount.github.io/docs/trading_with_beancount.html#cost-basis-adjustment-and-return-of-capital) to "re-base" the assets to have a single average cost basis. In this case, the asset is purchasable on a fractional basis. So I've tried something like this: 2020-12-07 open Assets:Fnord:Foo FOO 2020-12-07 open Assets:Fnord:Cash GBP 2020-12-07 * "Buy Asset" Assets:Fnord:Cash -6.86 GBP Assets:Fnord:Foo 5.5555 FOO {1.2345 GBP} 2021-04-07 * "Buy more asset" Assets:Fnord:Cash -30.80 GBP Assets:Fnord:Foo 13.1313 FOO {2.3456 GBP} 2021-04-11 * "Average cost re-base" ; Re-base to current average cost basis Assets:Fnord:Foo -5.5555 FOO {1.2345 GBP} Assets:Fnord:Foo -13.1313 FOO {2.3456 GBP} ; Actual average is 2.015275062075903846565490079, according to python's decimal module. Assets:Fnord:Foo 5.5555 FOO {2.0152 GBP} Assets:Fnord:Foo 13.1313 FOO {2.0152 GBP} No matter how much precision I specify for the average, it always seems to be off by some small amount: /Users/cez/Documents/beancount/ledger/cost-basis-simple.beancount:12: Transaction does not balance: (-0.00140267 GBP) If I use an average of 2.015, -0.0051. Even with the 20 decimal places of precision for the average price, the transaction is off by -0.000000000000000000102592 GBP. So I'm clearly missing something about the precision, and/or how to handle these cost basis adjustments. Can anyone offer any suggesiton as to what I might be missing? Is this one of those cases where I should post an adjustment to a hack account of some kind? Thanks, -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/db6e8cec-1ed5-49e9-b587-4719d1a90f54n%40googlegroups.com.