BTW, I do have some scripts to do that type of thing - my point is that the data is indeed available in your ledger - but it's currently something I do with custom code for particular accounts and that people are hacking on their own, probably. Here's an example: https://bitbucket.org/blais/beancount/src/17304eeaf830698e522b122a4d63c4fa342d33fa/experiments/washsales/list-wash-sales.py?at=default <https://bitbucket.org/blais/beancount/src/17304eeaf830698e522b122a4d63c4fa342d33fa/experiments/washsales/list-wash-sales.py?at=default&> In that particular script, I process the sales from a particular subset of accounts in order to precisely match the 1099's I'm getting from the broker. I'm having to do this because when I import the 1099 in TurboTax, the cost basis somehow gets lost and I need to enter it manually. This computes it for me (to cross-check the values that I see in the PDF version, when they're available - wasn't always the case for that broker). This script isn't generalizable - it relies on the presence of metadata in order to match how the sales get aggregated and reported - and needs prices.
Anyhow, this is the status of doing that typo of thing in Beancount today. The data's there, but it involves a little DIY. Eventually this type of thing will be made easier and generic; I'll make the booking code insert matching tags on buy/sell posting pairs that make it possible to quickly and reliably extract this information and report those. I really want this, this is rather basic functionality that should be there. On Sat, Mar 16, 2019 at 4:12 PM Martin Blais <[email protected]> wrote: > Just had a very quick look at what was stopping me from doing this in an > hour or two and it turns out I'd need to make changes to the core, which is > not a super quick fix. Basically, I need to create some way for inventories > to track unique ids per position. It shouldn't be rocket science, but a > very quick trial changelist brings up more questions and complications than > I can solve quickly. > > I need to allocate time to implementing this correctly. > Right now it's tax time.... > > > > On Sat, Mar 16, 2019 at 3:36 PM Martin Blais <[email protected]> wrote: > >> On Tue, Mar 12, 2019 at 6:01 PM Jason Lefley <[email protected]> wrote: >> >>> I have a number of trades recorded in a beancount file. If I navigate to >>> the long term capital gains account I used to track the gains from selling >>> the shares in the web interface, it shows the total proceeds, cost basis, >>> and gain. Is there a way to generate a CSV file using beancount that has >>> this same information? It would save a lot of copying and pasting. I tried >>> generating an account report but it only shows the gains but does not >>> include the cost basis. >>> >> >> It's doable but it requires writing some code and it's not entirely >> trivial (and it really ought to be!). >> At the moment one would have to accumulate postings to an Inventory >> object, watch out for reductions, and record trades when those do occur. >> >> I have a design to make this much easier that I haven't implemented yet. >> Basically, it requires the booking algorithm to insert a unique string >> between reducing (sell) and their corresponding augmenting (buy) postings, >> and then for a little piece of code to gather all the trades to a new table >> and group by the unique ids. The fully general result may not be as simple >> as one would imagine (one sell may book against multiple buys, and >> vice-versa). It's not difficult, I just have never done it (and I need >> this too!). >> Ideally, that new list of trades should be presented to the user as a new >> table of "trades" in the SQL interface. >> >> -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhNEZ4yuAup1coeRSZWirf5omqH9W_YqvbMgfvDva7uh8g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
