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