This works for a while:

C 1.00000000 BTC = 100,000,000 SAT
C 1.00 bit = 100 SAT
C 1.00000000 BTC = 1,000,000.00 bit

But then the ledger-cli made a mess of commodity conversions. Even if I use 
the option --exchange BRL if I put this equivalence lines the ledger-cli 
just ignores the conversion price I put.

Take this file as an example:

P 2021-09-01 00:00:00 BTC 256103,91738800 R$

2021-09-17 * Opening Balance
    My Wallet                             1,00000000 BTC
    Equity:Opening Balances

When I run:

ledger -f draft.ledger bal --exchange=R$

I get the expected result:

           R$-256104  Equity:Opening Balances
            R$256104  My Wallet
--------------------
                   0

But if I add the equivalence of the commodity BTC, as follow:

C 1.00000000 BTC = 100,000,000 SAT
C 1.00 bit = 100 SAT
C 1.00000000 BTC = 1,000,000.00 bit

P 2021-09-01 00:00:00 BTC 256103,91738800 R$

2021-09-17 * Opening Balance
    My Wallet                             1,00000000 BTC
    Equity:Opening Balances

The result of:

ledger -f draft.ledger bal --exchange=R$

is surprisingly:

     -1,00000000 BTC  Equity:Opening Balances
      1,00000000 BTC  My Wallet
--------------------
                   0

The ledger-cli starts to ignore the conversion.

It seems a bug behavior.


On Wednesday, September 15, 2021 at 2:14:52 AM UTC-3 jwie...@gmail.com 
wrote:

> >>>>> "CD" == Colin Dean <c...@cad.cx> writes: 
>
> CD> You should be able to use commodity equivalencies to solve this 
> problem to 
> CD> a degree, but it won't be automatic based on the magnitude in context, 
> CD> only whatever you set as the exchange, I think. 
>
> Actually, it should adjust the magnitude dependent on context, this is how 
> the 
> automated conversions to hours, minutes and seconds work for time values. 
> Just 
> use something like this: 
>
> C 1 KB = 1000 B 
> C 1 MB = 1000 KB 
> C 1 GB = 1000 MB 
> etc. 
>
> It should then pick whichever one can be reported at a value of 1 or more. 
>
> John 
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/41790972-b737-4174-a444-28ce94573199n%40googlegroups.com.

Reply via email to