Hello!

What is the best way (approach) to deal with different commodities that are 
convertible between them?

Let's suppose I want to work with different units of the same commodity. 
Example: BTC and SAT (Satoshis). 1 BTC is = 100,000,000 SAT - Is there a 
way to tell to Ledger-CLI that these currencies are the same (or 
convertible between them) and if I could use both freely and get the report 
in only one unit?

For example:

2021-09-06 Test
    Assets:Checking
    Expenses:Food:Groceries               0.00010000 BTC

2021-09-06 Test
    Assets:Checking
    Expenses:Food:Groceries                   10,000 SAT

Both entries are exactly the same thing, but the report:

ledger -f draft.ledger balance
     -0.00010000 BTC
         -10,000 SAT  Assets:Checking
      0.00010000 BTC
          10,000 SAT  Expenses:Food:Groceries

I can do this:

commodity SAT
  note Satoshis
  format 1,000 SAT

commodity BTC
  note Bitcoin
  format 1,000.00000000 SAT

define BTC_TO_SAT=100,000,000 SAT

2021-09-06 Test
    Assets:Checking
    Expenses:Food:Groceries               (0.00010000 * BTC_TO_SAT)

2021-09-06 Test
    Assets:Checking
    Expenses:Food:Groceries                   10,000 SAT

To result in:

         -20,000 SAT  Assets:Checking
          20,000 SAT  Expenses:Food:Groceries
--------------------
                   0

But maybe there is a better way to deal with that?

Thank 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/12df4be8-e860-4334-a3f2-37b04b3ddb01n%40googlegroups.com.

Reply via email to