Hey James, Implementer of the average cost booking here. We rolled it back from v3 due to a performance regression. I've been pretty busy and haven't had a chance to address that to get it merged back again. It works and is correct to the best of my knowledge / tests.
My recommendation for taxes: I would do the reporting script you mention. I plan to do exactly that for my own US taxes. I can release the code for that if folks are interested - I haven't written it yet. - Parser my ledger with parser.parse_file() - Iterate through the transactions, looking for stock sales in tax year 2020. - Retrieve all the important fields from the sale, and keep running short-term/long-term capital gains. - Investigate if the programmatic tax info file format is relatively easy. If so I'll dump my data into that format so I can import it into my tax program programmatically. Otherwise I'll just key them in by hand. For your Canadian taxes, same thing, but you can code in your special casing to change the date and compute average basis. Follow the code here <https://github.com/beancount/beancount/pull/591/files>. You can emulate average cost booking on top of the US booked lots: just iterate over the final booked output from parse_file(), but run the average booker whenever you see lots (and you can also replace the date there to your Canadian date). You'll build up Inventory() objects as you iterate through the ledger. Whenever you see a reduction (stock sale), you can use your average basis instead of the one the US booking method picked. Longer term plan: Martin is still putting some of the foundational pieces for V3 in place before it makes sense to have others contribute on the core. One of the key additions in V3 is to make booking more of a utility that you can invoke in your own scripts. V3 is much more modular. It will make writing scripts like the above one simpler - you can recompose parts of beancount itself rather than needing to reimplement bits of it. I floated the idea of making booking itself configurable via plugin and Martin was open to the idea. I want to implement for my own ledger a "tax optimizing lot selection" booking method for things like Crypto where there's no broker tracking the basis or lot selection. On Thu, Mar 4, 2021 at 1:28 PM James Cook <[email protected]> wrote: > On Thu, Mar 04, 2021 at 09:01:42PM +0000, James Cook wrote: > > Hi list, > > > > I file taxes in both the US and Canada, for which I have to calculate > > capital gains differently: > > > > a) In Canada I'm deemed to have bought most of my assets on the date I > > moved here. There's no such fiction on my US taxes. > > > > b) When calculating capital gains, Canada taxes use average cost > > booking; for the US I can somewhat choose the booking method. > > > > Has anyone dealt with this using beancount? My tentative plan is below, > > but suggestions would be welcome. > > I should mention: I saw on the list there's some ongoing work on > implementing average cost booking, but I'm assuming that would replace > any other booking method rather than allow tracking both at once. If > I'm wrong about that do let me know! > > -- > James > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/20210304212758.awiyxbvkvjjmz7wl%40moth.falsifian.org > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACGEkZvxqBo8bPnxjSbSitjBo_67SoBwZizWcs%2B6a4oynRGZ_g%40mail.gmail.com.
