Getting closer on this. :-)
After spending some time on format strings, I've got the output to
look like (nasty format string omitted):
$ ledger reg investments
01/21 Purchase Assets:Investments 370.949 ABC 370.949 ABC $3140.89
$3140.89
12/26 Reinvest Assets:Investments 9.928 ABC 380.877 ABC $113.68
$3254.57
12/28 Sell Assets:Investments -380.877 ABC 0
$-3254.57 0
The problem is, I lose the share information if I do this:
$ ledger -r reg investments
01/21 Purchase Equity:Starting $3140.89 $3140.89 $3140.89
$3140.89
12/26 Reinvest Income:Dividends $113.68 $3254.57 $113.68
$3254.57
12/28 Sell Assets:Checking $-4402.94 $-1148.37 $-4402.94
$-1148.37
Income:Cap Gains $1148.37 0
$1148.37 0
It seems to me, if we can figure out the cash basis for transaction
involving shares, we should be able to do the opposite as well (figure
out the share basis for the cash transactions). Clear as mud? Here's a
long-winded example:
Our basic report:
$ ledger reg investments
01/21 Purchase Assets:Investments 370.949 ABC 370.949 ABC
12/26 Reinvest Assets:Investments 9.928 ABC 380.877 ABC
12/28 Sell Assets:Investments -380.877 ABC 0
Now the report in terms of cash basis:
$ ledger -B reg investments
01/21 Purchase Assets:Investments $3140.89 $3140.89
12/26 Reinvest Assets:Investments $113.68 $3254.57
12/28 Sell Assets:Investments $-3254.57 0
Now the related transactions:
$ ledger -r reg investments
01/21 Purchase Equity:Starting $3140.89 $3140.89
12/26 Reinvest Income:Dividends $113.68 $3254.57
12/28 Sell Assets:Checking $-4402.94 $-1148.37
Income:Cap Gains $1148.37 0
So now, it seems I should be able to do something like:
$ ledger -r -B reg investments
or even:
$ ledger -r -B ABC reg investments
to get a report like:
01/21 Purchase Equity:Starting 370.949 ABC 370.949 ABC
12/26 Reinvest Income:Dividends 9.928 ABC 380.877 ABC
12/28 Sell Assets:Checking -515.269 ABC -134.392 ABC
Income:Cap Gains 134.392 ABC 0
In general, for transactions involving multiple currencies, it would
be nice to be able to explicitly specify which currency to use as the
"basis". If I could then use this in a formatting string, I can
generate something like the first couple reports above, showing side-
by-side the transactions and position of an account in terms of each
currency. Is this possible, either in 2.6.1 or the next version?
Thanks for your help and patience on this!