Long/short term tx splitting

135 views
Skip to first unread message

Eric Altendorf

unread,
Aug 22, 2024, 6:04:47 PM8/22/24
to bean...@googlegroups.com
The Redstreet long/short plugin splits single capital gains legs into short and long term legs.

In an 8949 style report, one should report assets held for short or long term separately.  This might be faciliated by a plugin that cleaves the transaction rather than just the income leg, e.g. from:

2014-02-01 * "Buy"
  Assets:Brokerage    100 ORNG {1 USD}
  Assets:Bank        -100 USD

2016-02-01 * "Buy"
  Assets:Brokerage    100 ORNG {2 USD}
  Assets:Bank        -200 USD

2016-03-01 * "Sell"
  Assets:Brokerage   -100 ORNG {1 USD} @ 2.50 USD
  Assets:Brokerage   -100 ORNG {2 USD} @ 2.50 USD
  Assets:Bank         500 USD
  Income:Capital-Gains

to:

2014-02-01 * "Buy"
  Assets:Brokerage    100 ORNG {1 USD}
  Assets:Bank        -100 USD

2016-02-01 * "Buy"
  Assets:Brokerage    100 ORNG {2 USD}
  Assets:Bank        -200 USD

2016-03-01 * "Sell"
  Assets:Brokerage   -100 ORNG {1 USD} @ 2.50 USD
  Assets:Bank         250 USD
  Income:Capital-Gains:Long

2016-03-01 * "Sell"
  Assets:Brokerage   -100 ORNG {2 USD} @ 2.50 USD
  Assets:Bank         250 USD
  Income:Capital-Gains:Short

I'm not especially happy with this idea since it loses the fact that it really was one single transaction.

Any other thoughts/opinions?

Red S

unread,
Aug 23, 2024, 4:23:15 AM8/23/24
to Beancount
I forget what all 8949 needs, but metadata+querying (or a custom script) usually works well for these situations in my experience:

2016-03-01 * "Sell" Assets:Brokerage -100 ORNG {1 USD} @ 2.50 USD held: "long" Assets:Brokerage -100 ORNG {2 USD} @ 2.50 USD held: "short" Assets:Bank 500 USD Income:Capital-Gains:Long ... Income:Capital-Gains:Short ...

Would that work?

Eric Altendorf

unread,
Aug 23, 2024, 4:41:35 PM8/23/24
to bean...@googlegroups.com
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/344a8ca5-8d36-49ca-9ff2-e6543d9b8f45n%40googlegroups.com.

Red S

unread,
Aug 24, 2024, 1:22:24 AM8/24/24
to Beancount

Why bother splitting it into two transactions? Why not just query by postings with the held: "long" metadata?

Eric Altendorf

unread,
Aug 24, 2024, 2:15:59 AM8/24/24
to bean...@googlegroups.com
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.
Message has been deleted

Red S

unread,
Oct 17, 2024, 7:39:27 PM10/17/24
to Beancount
I needed pretty much the same thing recently. Here’s a gist to build up capital gains data from Beancount, and output it in any format desired. The gist assumes a certain account structure to determine which the taxable accounts are.

The interesting thing is not the gist itself, but the fact that the code was almost completely written by GPT-4o. And I didn't even have to put in that much effort into the prompts. Whenever you need something like this, GPT is the answer now!

Lover O'Bean

unread,
Oct 19, 2024, 5:29:31 PM10/19/24
to Beancount
That does seem ignificant.  It will be interesting to see if the increasing capabilities of ChatGPT will continue to be matched with increased availability of Sarco Pods for people whose skills become worthless.
Reply all
Reply to author
Forward
0 new messages