Hi again,

Am Donnerstag, den 01.09.2022, 21:28 +0900 schrieb Tobias Pfeiffer:
> 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: [...]

I should have tried just a bit harder before sending my message ;-)

The following works fine, it seems we need to be explicit about both
lot prices and dates when computing the average:

  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 Re-evaluate
    Assets:Broker    -10 ETF {1,000 JPY} [2004/05/01] @ 1,000 JPY
    Assets:Broker    -20 ETF {1,300 JPY} [2004/06/01] @ 1,300 JPY
    Assets:Broker     30 ETF @ 1,200 JPY  ; weighted average

  2004/07/01 Stock sell
    Assets:Broker          -20 ETF {1,200 JPY} [2004/07/01] @ 1,500 JPY
    Income:Capital Gains    -6,000 JPY
    Assets:Savings          30,000 JPY

This completely eliminates the original lots in the "Re-evaluate"
transaction, so that only the ones with the average prices remain:

  $ ledger -f example.ledger bal --lots
  10 ETF {1,200 JPY} [04-Jul-01]
            -6,000 JPY  Assets
  10 ETF {1,200 JPY} [04-Jul-01]    Broker
            -6,000 JPY    Savings
            -6,000 JPY  Income:Capital Gains
  --------------------
  10 ETF {1,200 JPY} [04-Jul-01]
           -12,000 JPY

Not sure if I'm going to rewrite my transaction history like that, but
good to know how it works ;-)

Thanks
Tobias


-- 

--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/20b682446889fc42cf13102d43a598769aa04d73.camel%40web.de.

Reply via email to