I've found that results of 'balance' command are different, depending
on the syntax of the amount.
Actually, I was expecting same result, whatever the way the amount is
spelled.
Thierry
$ ledger -f test8.ledger bal
$270 Assets:Broker
$30 Expense:Broker:Commissions
--------------------
$300
$ ledger -f test9.ledger bal
$270 Assets:Broker
$30 Expense:Broker:Commissions
$-300 Income:Capital Gains
--------------------
0
$ diff test8.ledger test9.ledger
10,11c10,11
< [Income:Capital Gains] $300 ; buy price 10*30
< [Income:Capital Gains] $-600 ; sell price 10*60
---
> [Income:Capital Gains] -10 AAPL @ $30 ; buy price 10*30
> [Income:Capital Gains] 10 AAPL @ $60 ; sell price 10*60
$ cat test8.ledger
1998/05/05 Buy AAPL
Assets:Broker 10 AAPL @ $30
Expense:Broker:Commissions $15
Assets:Broker
1999/08/16 Sell AAPL
Assets:Broker -10 AAPL @ $60
Expense:Broker:Commissions $15
Assets:Broker $585
[Income:Capital Gains] $300 ; buy price 10*30
[Income:Capital Gains] $-600 ; sell price 10*60
[Income:Capital Gains]
$ cat test9.ledger
1998/05/05 Buy AAPL
Assets:Broker 10 AAPL @ $30
Expense:Broker:Commissions $15
Assets:Broker
1999/08/16 Sell AAPL
Assets:Broker -10 AAPL @ $60
Expense:Broker:Commissions $15
Assets:Broker $585
[Income:Capital Gains] -10 AAPL @ $30 ; buy price 10*30
[Income:Capital Gains] 10 AAPL @ $60 ; sell price 10*60
[Income:Capital Gains]
$ ledger -v
Ledger master-0-g5471370, the command-line accounting tool
> I've found that results of 'balance' command are different, depending
> on the syntax of the amount.
> Actually, I was expecting same result, whatever the way the amount is
> spelled.
That's a great bug, Thierry. Thank you!
John
Repost of test8.ledger, there is a typo about the signed amount.
This has no impact on the bug, but this has impact on realisticness of
the transaction.
$ cat test8.ledger
1998/05/05 Buy AAPL
Assets:Broker 10 AAPL @ $30
Expense:Broker:Commissions $15
Assets:Broker
1999/08/16 Sell AAPL
Assets:Broker -10 AAPL @ $60
Expense:Broker:Commissions $15
Assets:Broker $585
[Income:Capital Gains] $-300 ; buy price 10*30
[Income:Capital Gains] $600 ; sell price 10*60
Income:Capital Gains is automatically balanced into Equity:Capital Gains for you when this style of transaction is encountered.
I believe this is a bug in ledger. I independently ran into this the
other day: http://newartisans.com/bugzilla/show_bug.cgi?id=213
It has some explanation of what I believe is going on.
--
Martin Michlmayr
http://www.cyrius.com/
> The balance does not balance to zero, and I do not understand why. I can not get the point of adding the "Equity:Capital Gains", on top of "Income:Capital Gains". Why both exists?
It exists because according to the rules of double-entry accounting, money
cannot "come from nowhere". You just made $300 on a stock transaction; this
$300 has to be balanced with an identical amount affecting another account.
I use Equity for this purpose since it reflects the fact that the value came
from your equity: or assets which you already owned whose value had not been
realized as a gain.
> I have read again chapter "3.5 Understanding Equity" in ledger v2.6 documentation, but I can not figure out why in the example of test92.ledger my Equity should be $-50.
It is important to note that the only report which is guaranteed to balance
to zero in all cases is the -B report:
$ ledger -B bal
$320 Assets:Broker
$-50 Equity
$300 Capital Gains
$-350 Opening Balances
$30 Expense:Broker:Commissions
$-300 Income:Capital Gains
--------------------
0
It makes more sense to see what's going on in the register report:
$ ledger -B --columns=70 reg
98-Jan-01 Account opening Assets:Broker $350 $350
..pening Balances $-350 0
98-May-05 Buy AAPL Assets:Broker $300 $300
Ex:Br:Commissions $15 $315
Assets:Broker $-315 0
99-Aug-16 Sell AAPL Assets:Broker $585 $585
Ex:Br:Commissions $15 $600
Assets:Broker $-600 0
In:Capital Gains $-300 $-300
Eq:Capital Gains $300 0
If Income:Capital Gains were not balanced into Equity:Capital Gains, then
*this* report would not balance to zero, which is _always must_.
> Another point about non english speaking users: I've translated the test91.ledger into French. Actually "Equity:Capital Gain" does not sound French and translation should be "Capitaux propres:Bénéfice". I would propose to add an option to .ledgerrc, something like "Equity:Capital gain=Capitaux propres:Bénéfice"
Ledger uses gettext, which allows for all English text within it to be
translated for a specific locale. When I get closer to final release,
would you be willing to translate a PO file into French for me? It will
include strings such as this one.
John
> I believe this is a bug in ledger. I independently ran into this the
> other day: http://newartisans.com/bugzilla/show_bug.cgi?id=213
> It has some explanation of what I believe is going on.
In your case, too, Martin, you need to use the -B flag for things to
balance to zero:
$ ledger -B --columns=70 reg
10-Jan-01 Opening balance Assets:Cash 10.00 EUR 10.00 EUR
..Opening balance -10.00 EUR 0
10-Jan-20 Buy GBP Assets:Cash 7.00 EUR 7.00 EUR
Assets:Cash -7.00 EUR 0
10-Jan-20 Sell GBP Assets:Cash -7.50 EUR -7.50 EUR
Assets:Cash 7.50 EUR 0
Income:Gain -0.50 EUR -0.50 EUR
Eq:Capital Gains 0.50 EUR 0
Without -B the report reflects the commodities involved, and thus includes
any gains:
$ ledger --columns=70 reg
10-Jan-01 Opening balance Assets:Cash 10.00 EUR 10.00 EUR
..Opening balance -10.00 EUR 0
10-Jan-20 Buy GBP Assets:Cash 5.00 GBP 5.00 GBP
Assets:Cash -7.00 EUR -7.00 EUR
5.00 GBP
10-Jan-20 Sell GBP Assets:Cash -5.00 GBP -7.00 EUR
Assets:Cash 7.50 EUR 0.50 EUR
Income:Gain -0.50 EUR 0
Eq:Capital Gains 0.50 EUR 0.50 EUR
The part of this bug about {=} not auto-balancing is a separate issue.
John
[snip]
>> Another point about non english speaking users: I've translated the test91.ledger into French. Actually "Equity:Capital Gain" does not sound French and translation should be "Capitaux propres:Bénéfice". I would propose to add an option to .ledgerrc, something like "Equity:Capital gain=Capitaux propres:Bénéfice"
>
> Ledger uses gettext, which allows for all English text within it to be
> translated for a specific locale. When I get closer to final release,
> would you be willing to translate a PO file into French for me? It will
> include strings such as this one.
I would like to translate to Brazilian Portuguese as well.
> John
Regards,
--
Felipe Magno de Almeida
> I would like to translate to Brazilian Portuguese as well.
Thank you so much, Felipe. I've added you to the list and will contact you
once things are finalized.
John
> It exists because according to the rules of double-entry accounting, money
> cannot "come from nowhere". You just made $300 on a stock transaction; this
> $300 has to be balanced with an identical amount affecting another account.
>
> I use Equity for this purpose since it reflects the fact that the value came
I think we all agree that it has to come from somewhere but what
Thierry and I don't understand why it has to be accounted for _twice_
(once in the manual "Income:Capital Gains" in Thierry's case and once
with the automatic "Equity:Capital Gains" posting).
Before I go any further, I should mention that I'm very new to
accounting so I'd like to get input from folks who are more
experienced. But I believe I've come up with a solution that I like
more than the current one.
Let's take my simple example: I own 10.00 EUR, I then buy 5.00 GBP for
7.00 EUR and then I sell those 5.00 GBP for 7.50 EUR, making a 0.50
EUR gain (ledger file below).
ledger -B will show:
10.00 EUR Assets:Cash
-9.50 EUR Equity
0.50 EUR Capital Gains
-10.00 EUR Opening balances
-0.50 EUR Income:Gain
The manual Income:Gain is to account for the gain and the
Equity:Capital Gains is an automatic posting from ledger.
But I wonder if this output makes sense. With -B, ledger says that I
have 10.00 EUR instead of 10.50 EUR. So imho if it shows this basis
cost, it should _not_ show the Income:Gain. After all, -B doesn't
consider the gain I made.
ledger without -B shows:
10.50 EUR Assets:Cash
-9.50 EUR Equity
0.50 EUR Capital Gains
-10.00 EUR Opening balances
-0.50 EUR Income:Gain
--------------------
0.50 EUR
So now I indeed I have 10.50 EUR and the 0.50 EUR gain is accounted
for by Income:Gain, but then we also have this automatic
Equity:Capital Gains posting and in the end it doesn't balance.
So imho there are three things wrong:
- in the first example (with -B), Equity:Capital Gains and Income:Gain
should not be there because we're talking about the basis cost.
- Also, the second example should imho balance because we account for
the gain.
- Finally, shouldn't Equity:Capital Gains be -0.50 EUR rather than
+0.50 EUR, leading to a total -10.50 equity (so that Assets == Equity)?
So how about this solution: at the moment, ledger generates an
automatic posting (in Equity) but you still need to manually account
for the gain/loss too. How about making these changes:
- don't require the manual account to account for the gain/loss since
ledger generates an automatic posting for this anyway.
- change the direction of the posting (i.e. a gain would be negative,
a loss positive)
- do not generate this automatic posting when -B is used.
This would mean that we end up with something that imho makes more
sense.
ledger -B would simply show:
10.00 EUR Assets:Cash
-10.00 EUR Equity:Opening balances
--------------------
0
i.e. we never made a gain/loss, we still have what we had.
whereas ledger without -B would show:
10.50 EUR Assets:Cash
-10.50 EUR Equity
-0.50 EUR Capital Gains
-10.00 EUR Opening balances
--------------------
0.00 EUR
i.e. we made a 0.50 EUR gain, now have 10.50 EUR in assets and
everything balances.
Finally, we could allow some way to change the name of the
automatic posting depending on the posting, e.g.:
Assets:Cash -5.00 GBP {=1.4 EUR} @ 1.5 EUR => Income:Gain
So I would end up with:
10.50 EUR Assets:Cash
-10.00 EUR Equity
-10.00 EUR Opening balances
-0.50 EUR Income:Gain
which I like more than the Equity:Capital Gains account.
Maybe this post shows my misunderstanding of ledger and accounting,
but it describes how I would expect ledger to work with this example.
Any comments?
Example file:
2007-01-01 Opening balances
Assets:Cash 10.00 EUR
Equity:Opening balances
2008-01-01 Buy 5.00 GBP for 7.00 EUR
Assets:Cash 5.00 GBP @ 1.4 EUR
Assets:Cash
2009-01-01 Sell 5.00 GBP for 7.50 EUR that I bought for 7.00 EUR
Assets:Cash -5.00 GBP {=1.4 EUR} @ 1.5 EUR
Assets:Cash 7.50 EUR
Income:Gain