Dear Pierre, I just today saw this discussion. I made the change to the wiki, and would like to explain the change.
Multiple functions are served by commodity/currency trading accounts: 1. They enable the trial balance to be "0", regardless of the commodity which you use (with `-X`) 2. They act as a store of unrealized gains, when prices are changed using price directives. Function 1 will be served regardless of the naming pattern of the commodity trading accounts. However, for fully realizing Function 2, the naming convention makes a difference. Depending on the naming pattern, you can either find out your total unrealized gains (for instance, from all your stocks, etc., taken together), or you can find out unrealized gains from each commodity pair (for instance, the gain for each stock separately). If you want more granular reporting of unrealized gains, having a "parent" sub-account where both commodities in a commodity pair are represented is important. Without that, you can't get a single account balance to tell you the gain/loss: you'll need the balance of two accounts. So using `Equity:Trading:AUD-EUR:AUD` and `Equity:Trading:AUD-EUR:EUR` will allow you to see the unrealized gains for the AUD-EUR pair by running `ledger bal Equity:Trading;AUD-EUR -X EUR` which, if you use `Equity:Trading:AUD:EUR` and `Equity:Trading:EUR:AUD` will need two separate accounts to be mentioned: `ledger bal Equity:Trading:AUD:EUR Equity:Trading:EUR:AUD -X EUR`. Now, if you have multiple commodity pairs, and want a tree view, then the `AUD:EUR` / `EUR:AUD` naming pattern makes it very difficult. Whereas with `--depth`, getting unrealized gains for multiple commodity pairs is very easy if you use the `:COMM1-COMM2:` naming pattern. Of course, you need to be consistent in which of the two commodities you use as "COMM1". I tend to think of a single currency as the "base" currency in the transaction, and use that as "COMM1". You could also just go by alphabetical order. I hope that helps. In case it is still not clear, try constructing an example journal with multiple commodities (at least 3) in both styles and play around with the reports. That ought to help. Cheers, Pranesh On Friday, 31 December, 2021 at 11:55:40 pm UTC+5:30 Pierre Bastoul wrote: > Thank you guys for that 2 tools. I will try to understand them. > > On Friday, December 31, 2021 at 12:35:48 AM UTC+1 d10 wrote: > >> On Wednesday, December 29, 2021 at 12:51:22 PM UTC-5 Pierre wrote: >> >>> Hello, >>> >>> I'm working on tracking my cryptocurrencies trades with ledger-cli as >>> described in the "Multiple currencies with currency trading accounts >>> <https://github.com/ledger/ledger/wiki/Multiple-currencies-with-currency-trading-accounts>" >>> wiki >>> page. >>> >>> >> Check out lotter, https://src.d10.dev/lotter. It's goal is to let you >> express your trades in ledger-cli and calculate cost basis for you. >> >> > -- --- 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/d5bac723-eaf8-4afc-8371-03ee164f125fn%40googlegroups.com.
