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%2BhMAgVgW%2BwT73m_%2Bd5jHVLbgmoCHG3uDdowoKAo-%3DDB25A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
