Martin,
thanks for your in-depth reply.
Am Donnerstag, den 01.09.2022, 10:07 +0800 schrieb Martin Michlmayr:
> > 2005/08/01 Stock sale
> > Assets:Broker -50 AAPL {$30.00} @ $50.00
> > Expenses:Broker:Commissions $19.95
> > Income:Capital Gains $-1,000.00
> > Assets:Broker $2,480.05
> >
> > Clearly the second transaction does not balance if I leave out the
> > lot price "{$30.00}". What exactly is happening here with the lot
> > price so that this transaction balances?
>
> You sell 50 AAPL for $50, so that's $2500. You also have a capital
> gain of $20 per share ($50 - $30), so that's income of $1000; income
> is negative in ledger, so that's -$1000.
I think I kind of understand your explanation, but I have trouble
understanding on a technical level how that transaction balances.
When you write "you *also* have a capital gain of $20 per share", can I
imagine that this lot notation means that there is an implicit "hidden
posting"
Assets:Broker (($50 - $30) * 50)
that is used to balance the "Income:Capital Gains" posting?
---
On a related note, today I found out that for the purposes of computing
capital gains, the way things are done in Japan is that on the point in
time where you sell shares of a particular company X, an average buy
price is computed for all the X shares you bought in the past, like
buy_price_avg = (total_price_1 + ... + total_price_n) /
(count_1 + ... + count_n)
and then the taxable capital gain is computed as
sell_count * (sell_price - buy_price_avg)
which means that you don't sell the shares from a particular lot, but
from some averaged lot. How would I model that? With your advice from
above, I have tried the following:
2004/05/01 Stock purchase
Assets:Broker 10 ETF @ 1,000 JPY
Assets:Savings -10,000 JPY
2004/06/01 Stock purchase
Assets:Broker 20 ETF @ 1,300 JPY
Assets:Savings -26,000 JPY
2004/07/01 Compute average
Assets:Broker -10 ETF @ 1,000 JPY
Assets:Broker -20 ETF @ 1,300 JPY
Assets:Broker 30 ETF @ 1,200 JPY ; weighted average
2004/07/01 Stock sell
Assets:Broker -20 ETF {1,200 JPY} @ 1,500 JPY
Income:Capital Gains -6,000 JPY
Assets:Savings 30,000 JPY
and that works well in the sense that both `ledger bal` and `ledger bal
--lot-prices` look good:
$ ledger -f example.ledger bal --lot-prices
10 ETF {1,200 JPY}
-6,000 JPY Assets
10 ETF {1,200 JPY} Broker
-6,000 JPY Savings
-6,000 JPY Income:Capital Gains
--------------------
10 ETF {1,200 JPY}
-12,000 JPY
However, `ledger bal --lots` still shows all of the lots that have ever
existed, it's a bit overwhelming:
$ ledger -f example2.ledger bal --lots
10 ETF {1,000 JPY} [04-May-01]
-10 ETF {1,000 JPY} [04-Jul-01]
-20 ETF {1,200 JPY}
30 ETF {1,200 JPY} [04-Jul-01]
20 ETF {1,300 JPY} [04-Jun-01]
-20 ETF {1,300 JPY} [04-Jul-01]
-6,000 JPY Assets
10 ETF {1,000 JPY} [04-May-01]
-10 ETF {1,000 JPY} [04-Jul-01]
-20 ETF {1,200 JPY}
30 ETF {1,200 JPY} [04-Jul-01]
20 ETF {1,300 JPY} [04-Jun-01]
-20 ETF {1,300 JPY} [04-Jul-01] Broker
-6,000 JPY Savings
-6,000 JPY Income:Capital Gains
--------------------
10 ETF {1,000 JPY} [04-May-01]
-10 ETF {1,000 JPY} [04-Jul-01]
-20 ETF {1,200 JPY}
30 ETF {1,200 JPY} [04-Jul-01]
20 ETF {1,300 JPY} [04-Jun-01]
-20 ETF {1,300 JPY} [04-Jul-01]
-12,000 JPY
Is that a problem? Should I try and get rid of these lots that I
thought should have disappeared in the "Compute average" transaction?
How would I do that?
Thank you,
Tobias