Could the Ledger documentation be revised to offer a different method of
handling stock sales? The documentation (section 5.5.2) currently
recommends:
2005/08/01 Stock sale
Assets:Broker -50 APPL {$30.00} @ $50.00
Expenses:Broker:Commissions $19.95
Income:Capital Gains $-1,000.00
Assets:Broker $2,500.00
There are three problems with this.
First, it is simply a bad transaction; Ledger refuses to accept it if
you cut-and-paste it into a ledger because it is unbalanced! I assume
that it was actually intended to read as follows, since a commission
cuts into the deposit that the brokerage will make into your account:
2005/08/01 Stock sale
Assets:Broker -50 APPL {$30.00} @ $50.00
Expenses:Broker:Commissions $19.95
Income:Capital Gains $-1,000.00
Assets:Broker $2,480.05
But there are a second and third problem as well.
Second, it invokes the broken behavior of auto-creating unbalanced (!)
"Capital" entries beneath the "Equity" account, which I will not discuss
further because it now seems to have been "CONFIRMED" as a bug that
needs fixing:
http://bugs.ledger-cli.org/show_bug.cgi?id=712
Third, and to me most crucially, there is no check in the transaction to
verify that the dollar amount claimed as "Income:Capital Gains" in fact
matches the difference in price. Try it; you can move dollars between
"Income:Capital Gains" and "Expenses:Broker:Commissions" as much as you
want without breaking the transaction! For example, this balances as
well:
2005/08/01 Stock sale
Assets:Broker -50 APPL {$30.00} @ $50.00
Expenses:Broker:Commissions $29.95
Income:Capital Gains $-1,010.00
Assets:Broker $2,480.05
Presumably you would notice if it were the "Assets:Broker" number that
went wrong, since your end-of-month or end-of-year balance would not
match your statement. But unless you are also checking for a correct
balance on the total commissions to date, there is no safety net here to
make sure that you chose the correct trade-off point between commissions
and capital gains income, since you can move money back and forth
between the two freely as long as you are expressing the transaction
like this.
After an hour of experimentation, I have hit upon a scheme that
correctly double-checks every number and, if you run a balance with
--lot-prices, will show you that everything cancels successfully. My
scheme is to split the transaction in two, one representing the stock's
rise in price, and the other accomplishing its cash-out:
2005/08/01 Stock sale
Assets:Broker -50 APPL @ $30.00
Assets:Broker 50 APPL @ $50.00
Income:Capital Gains $-1,000.00
2005/08/01 Stock sale
Assets:Broker -50 APPL @ $50.00
Expenses:Broker:Commissions $19.95
Assets:Broker $2,480.05
By exchanging the shares at their original price for shares at the sale
price, we guarantee that the capital gains number is absolutely correct.
And then by splitting the actual dollar proceeds from the sale into
commissions and assets, we guarantee that the cash is entirely accounted
for.
So I think this should become the official way to handle stock sales,
unless someone else sees something I am missing and can suggest an even
simpler maneuver that also makes sure that the gains and commissions
numbers are correct.
Some brokerages roll the commissions right into the capital gains
number, which is also supported by IRS Form 8949, in which case I can
make my Capital Gains number match by making commissions a debit against
gains:
2005/08/01 Stock sale
Assets:Broker -50 APPL @ $30.00
Assets:Broker 50 APPL @ $50.00
Income:Capital Gains $-1,000.00
2005/08/01 Stock sale
Assets:Broker -50 APPL @ $50.00
Income:Capital Gains:Commissions $19.95
Assets:Broker $2,480.05
But this quirk is doubtless not suitable for the documentation; I simply
share it as an optimization if any of you here on the mailing list also
want your Income accounts to match your tax documents more directly.
--
Brandon Rhodes [email protected] http://rhodesmill.org/brandon
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.