I needed something very similar recently. Here’s a gist <https://gist.github.com/redstreet/7986a0a0e9c90132ece165f7ccddb860#file-gistfile1-txt> to build up capital gains data from Beancount, and output it in any format desired. The code was almost completely written by GPT.
On Friday, August 23, 2024 at 11:15:59 PM UTC-7 erical...@gmail.com wrote: > On Fri, Aug 23, 2024 at 10:22 PM Red S <redst...@gmail.com> wrote: > >> Why bother splitting it into two transactions? Why not just query by >> postings with the held: "long" metadata? >> > For 8949, you're supposed to report the acquisition cost, disposal > proceeds, and the delta (gain/loss). Separately for long-term holdings, > and separately for short-term holdings. So I need the Assets:Bank leg > split into two, to get the long and short term disposal proceeds separately. > > At this point, I think, we've got ST/LT acquisition legs, ST/LT disposal > legs, and ST/LT gains/loss legs. So...the work is done, it's just a simple > mechanical transformation to call that ST/LT transactions, each with > acquisition, disposal, and gain/loss legs. > > The rest of my pipeline already handles long-term-only and short-term-only > disposal transactions for generating 8949-style PDFs, so even if I got one > transaction, with all legs segregated into ST/LT status, I'd probably still > query and transform into segregated transactions to pass down to report > generation. > > >> On Friday, August 23, 2024 at 1:41:35 PM UTC-7 erical...@gmail.com wrote: >> >> 8949 annoyingly completely segregates short term and long term sales into >> separate tables. So if you had a sale like in the example, you're supposed >> to split it into two sales, one which sells only the assets held for a >> short term, and the other which only sells the assets held for long term. >> >> I have a wrapper script already which loads the ledger, so yeah if the >> plugin tagged the legs I might be able to back it out into two >> transactions, although I feel I'd be duplicating some imputation logic in >> order to split up the Assets:Bank leg. >> >> Hmm.... >> >> -- >> > 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+...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/beancount/244e1f43-c3b2-4ccb-8a0d-1fe16a8558a1n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/beancount/244e1f43-c3b2-4ccb-8a0d-1fe16a8558a1n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/c6db43b2-c13b-45d0-b049-93fc88826cf8n%40googlegroups.com.