Capital gains

75 views
Skip to first unread message

Bakul Shah

unread,
Aug 10, 2023, 6:12:31 PM8/10/23
to bean...@googlegroups.com
[new user here]

Consider this example snippet:

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {10.00 USD}
  Expenses:Financial:Commissions               10.00 USD

2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {10.00 USD} @ 12.00 USD
  Assets:US:ETrade:Cash                            110.00 USD
  Expenses:Financial:Commissions               10.00 USD
  Income:US:ETrade:Gains                           -20.00 USD //anything else yields an error with bean-check

As I understand it, actual capital gains in this case would be 0 when you consider the two commissions. But if 20 shares were bought originally with a $10 commission, Cap gains income would be -5 dollars (since half of the original shares were sold).

Is there a way to reflect the actual capital gains?

Thanks!

Eric Altendorf

unread,
Aug 10, 2023, 7:13:57 PM8/10/23
to bean...@googlegroups.com
On Thu, Aug 10, 2023 at 3:12 PM Bakul Shah <ba...@iitbombay.org> wrote:
[new user here]

Consider this example snippet:

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {10.00 USD}
  Expenses:Financial:Commissions               10.00 USD

2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {10.00 USD} @ 12.00 USD
  Assets:US:ETrade:Cash                            110.00 USD
  Expenses:Financial:Commissions               10.00 USD
  Income:US:ETrade:Gains                           -20.00 USD //anything else yields an error with bean-check

As I understand it, actual capital gains in this case would be 0 when you consider the two commissions.

At least in the US, yes.  FWIW, what your ledger currently reflects is that you made 20 USD in capital gains profits but paid 20 USD in commissions, which is a legitimate way of looking at things, just not as convenient for reporting "capital gains" for tax purposes.
 
But if 20 shares were bought originally with a $10 commission, Cap gains income would be -5 dollars (since half of the original shares were sold).

Is there a way to reflect the actual capital gains?

This is apparently not yet figured out.

See the documentation:

Also see my related question from yesterday:


 

Thanks!

--
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/49465864-64C4-41CC-BB06-8827FB5F5D89%40iitbombay.org.

Bakul Shah

unread,
Aug 11, 2023, 6:53:41 PM8/11/23
to bean...@googlegroups.com

On Aug 10, 2023, at 4:13 PM, Eric Altendorf <erical...@gmail.com> wrote:



On Thu, Aug 10, 2023 at 3:12 PM Bakul Shah <ba...@iitbombay.org> wrote:
[new user here]

Consider this example snippet:

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {10.00 USD}
  Expenses:Financial:Commissions               10.00 USD

2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {10.00 USD} @ 12.00 USD
  Assets:US:ETrade:Cash                            110.00 USD
  Expenses:Financial:Commissions               10.00 USD
  Income:US:ETrade:Gains                           -20.00 USD //anything else yields an error with bean-check

As I understand it, actual capital gains in this case would be 0 when you consider the two commissions.

At least in the US, yes.  FWIW, what your ledger currently reflects is that you made 20 USD in capital gains profits but paid 20 USD in commissions, which is a legitimate way of looking at things, just not as convenient for reporting "capital gains" for tax purposes.
 
But if 20 shares were bought originally with a $10 commission, Cap gains income would be -5 dollars (since half of the original shares were sold).

Is there a way to reflect the actual capital gains?

Thanks for your response. Through a connection I asked a couple of experienced CPAs the same question and they suggested this:

image.png

Not quite what I was hoping for!


This is apparently not yet figured out.

See the documentation:

There is a link to a proposal for this but seems broken....

Eric Altendorf

unread,
Aug 11, 2023, 8:20:47 PM8/11/23
to bean...@googlegroups.com
On Fri, Aug 11, 2023 at 3:53 PM Bakul Shah <ba...@iitbombay.org> wrote:


On Aug 10, 2023, at 4:13 PM, Eric Altendorf <erical...@gmail.com> wrote:



On Thu, Aug 10, 2023 at 3:12 PM Bakul Shah <ba...@iitbombay.org> wrote:
[new user here]

Consider this example snippet:

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {10.00 USD}
  Expenses:Financial:Commissions               10.00 USD

2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {10.00 USD} @ 12.00 USD
  Assets:US:ETrade:Cash                            110.00 USD
  Expenses:Financial:Commissions               10.00 USD
  Income:US:ETrade:Gains                           -20.00 USD //anything else yields an error with bean-check

As I understand it, actual capital gains in this case would be 0 when you consider the two commissions.

At least in the US, yes.  FWIW, what your ledger currently reflects is that you made 20 USD in capital gains profits but paid 20 USD in commissions, which is a legitimate way of looking at things, just not as convenient for reporting "capital gains" for tax purposes.
 
But if 20 shares were bought originally with a $10 commission, Cap gains income would be -5 dollars (since half of the original shares were sold).

Is there a way to reflect the actual capital gains?

Thanks for your response. Through a connection I asked a couple of experienced CPAs the same question and they suggested this:

image.png

Not quite what I was hoping for!

I think this is a pretty standard way of doing capital gains taxes.  Add the commissions to the cost when you buy, and deduct the commissions from the sale when you sell.

This is what the linked beancount documentation means when it says:  "A convenient method to automatically allocate the acquisition costs to the pro-rata value of the number of shares sold is to add the acquisition trading cost to the total book value of the position [....] You could even go one step further and fold the commission on sale into the price of each share sold as well"

in this context, "book value" is the same thing as "cost", "cost basis", "acquisition cost", etc.  (AFAIK)

You can manually adjust your cost and proceeds in this way, and then beancount will compute the gain or loss that you expect.  Here's what that would look like (I think):

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {11.00 USD}   ;; Cost per share is 10 USD plus 1 USD of commission
  ;; Expenses:Financial:Commissions               10.00 USD   Don't account for commissions here


2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {11.00 USD} @ 11.00 USD   ;; Sale price per share was 12 USD minus 1 USD of commission

  Assets:US:ETrade:Cash                            110.00 USD
;;  Expenses:Financial:Commissions               10.00 USD  Don't account for commissions here
  Income:US:ETrade:Gains                          ;;  this will now be computed as zero.

As you can see, doing things this way isn't as clear to the reader of the ledger.  What doesn't exist in Beancount is a nice syntax for specifying the actual cost and proceeds, and separately specifying transaction fees, and asking beancount to do the desired computation, so you get clarity and the output you want. 


This is apparently not yet figured out.

See the documentation:

There is a link to a proposal for this but seems broken....


yeah, there are a few broken links on that site.  it's probably obsolete anyway.  the thread below is probably the most recent info: 

Also see my related question from yesterday:

--
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.

Martin Blais

unread,
Sep 3, 2023, 2:52:16 PM9/3/23
to bean...@googlegroups.com
On Fri, Aug 11, 2023 at 8:20 PM Eric Altendorf <erical...@gmail.com> wrote:


On Fri, Aug 11, 2023 at 3:53 PM Bakul Shah <ba...@iitbombay.org> wrote:


On Aug 10, 2023, at 4:13 PM, Eric Altendorf <erical...@gmail.com> wrote:



On Thu, Aug 10, 2023 at 3:12 PM Bakul Shah <ba...@iitbombay.org> wrote:
[new user here]

Consider this example snippet:

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {10.00 USD}
  Expenses:Financial:Commissions               10.00 USD

2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {10.00 USD} @ 12.00 USD
  Assets:US:ETrade:Cash                            110.00 USD
  Expenses:Financial:Commissions               10.00 USD
  Income:US:ETrade:Gains                           -20.00 USD //anything else yields an error with bean-check

As I understand it, actual capital gains in this case would be 0 when you consider the two commissions.

At least in the US, yes.  FWIW, what your ledger currently reflects is that you made 20 USD in capital gains profits but paid 20 USD in commissions, which is a legitimate way of looking at things, just not as convenient for reporting "capital gains" for tax purposes.
 
But if 20 shares were bought originally with a $10 commission, Cap gains income would be -5 dollars (since half of the original shares were sold).

Is there a way to reflect the actual capital gains?

Thanks for your response. Through a connection I asked a couple of experienced CPAs the same question and they suggested this:

image.png

Not quite what I was hoping for!

I think this is a pretty standard way of doing capital gains taxes.  Add the commissions to the cost when you buy, and deduct the commissions from the sale when you sell.
+1
 

This is what the linked beancount documentation means when it says:  "A convenient method to automatically allocate the acquisition costs to the pro-rata value of the number of shares sold is to add the acquisition trading cost to the total book value of the position [....] You could even go one step further and fold the commission on sale into the price of each share sold as well"

in this context, "book value" is the same thing as "cost", "cost basis", "acquisition cost", etc.  (AFAIK)

You can manually adjust your cost and proceeds in this way, and then beancount will compute the gain or loss that you expect.  Here's what that would look like (I think):

2023-06-18 * "Buy shares of XYZ"
  Assets:US:ETrade:Cash                           -110.00 USD
  Assets:US:ETrade:XYZ                                10 XYZ {11.00 USD}   ;; Cost per share is 10 USD plus 1 USD of commission
  ;; Expenses:Financial:Commissions               10.00 USD   Don't account for commissions here

2023-07-21 * "Sell shares of XYZ"
  Assets:US:ETrade:XYZ                             -10 XYZ {11.00 USD} @ 11.00 USD   ;; Sale price per share was 12 USD minus 1 USD of commission
  Assets:US:ETrade:Cash                            110.00 USD
;;  Expenses:Financial:Commissions               10.00 USD  Don't account for commissions here
  Income:US:ETrade:Gains                          ;;  this will now be computed as zero.

As you can see, doing things this way isn't as clear to the reader of the ledger.  What doesn't exist in Beancount is a nice syntax for specifying the actual cost and proceeds, and separately specifying transaction fees, and asking beancount to do the desired computation, so you get clarity and the output you want. 

In the input syntax you recognize the commissions & fees separately, and it's at the reporting stage that something's needed to make the necessary adjustments. I do this in Johnny, and I think it should be easy to write a script to do this for a Beancount ledger as well.


Reply all
Reply to author
Forward
0 new messages