Ok, I was wrong. This report from the example using trading accounts is in fact 
correct:

ledger bal --dc --related canadian_cash

       100 USD         60 USD         40 USD  Assets:US_Cash
             0        200 CAD       -200 CAD  Equity:Initial_Capital
        20 CAD              0         20 CAD  Expenses:Food
       120 CAD         75 CAD         45 CAD  Income:Currency
--------------------------------------------
       140 CAD
       100 USD        275 CAD
                     60 USD       -135 CAD
                                  40 USD

Since the checking account is denominated in CAD, the cash flow is given by the 
amounts in CAD (140 CAD out, 275 CAD in, -135 CAD balance). The totals in USD 
can simply be ignored. Unfortunately, the report is not as clear as it could 
be: 
for example, the 75 CAD from Income:Currency and the 60 USD from Assets:US_Cash 
are in fact the same. How can this report be improved?

My confusion about cash flows with trading accounts has actually started from 
what I have now realized being a bug. Consider the following transaction:

2013/10/05 * Shopping
    Expenses:Food       5 A
    Assets:Cash       -20 B
    Income:Currency

Then, 'ledger bal --dc --related cash' gives:

           5 A              0            5 A  Expenses:Food
             0            5 A           -5 A  Income:Currency
--------------------------------------------
           5 A            5 A              0

which is wrong. But,

2013/10/05 * Shopping
    Expenses:Food       5 B
    Assets:Cash       -20 A
    Income:Currency

produces the expected output:

           5 B              0            5 B  Expenses:Food
          20 A              0           20 A  Income:Currency
--------------------------------------------
          20 A
           5 B              0           20 A
                                         5 B

Every time the commodity of the related account lexicographically precedes the 
commodity of the cash account, the cash flow report is wrong. A workaround 
consists in specifying the amounts explicitly:

2013/10/05 * Shopping
    Expenses:Food       5 A
    Assets:Cash       -20 B
    Income:Currency    -5 A
    Income:Currency    20 B

Life

-- 

--- 
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.

Reply via email to