Hi,

I was off a little with the numbers (off by two decimal digits too much)
That is the correct example:

option "booking_method" "FIFO"
plugin "beancount.plugins.auto_accounts"
option "inferred_tolerance_default" "EUR:0.001"

2020-07-15 * "" "Buy XRP"
          Assets:Cash:Binance                  -214.158 EUR
          Assets:Crypto:XRP:Binance          428.317149 XRP {0.5 EUR} @ 0.5 
EUR

2020-07-30 * "" "Buy XRP"
          Assets:Cash:Binance                   -200.00 EUR
          Assets:Crypto:XRP:Binance               2,000 XRP {0.1 EUR} @ 0.1 
EUR

2020-07-31 * "" "Transfer"
          Assets:Crypto:XRP:Binance       -2,428.317149 XRP {}
          Assets:Crypto:XRP:Coinbase-Pro   2,000.000000 XRP {0.1 EUR, 
2020-07-30}
          Assets:Crypto:XRP:Coinbase-Pro     428.317127 XRP {0.5 EUR, 
2020-07-15}
;                                                    ↑↑ 0.000022 missing 
and no error

Maybe I am pendantic here, because the value of 0.000022 XRP @ 0.5 EUR is 
0.0011 cents and therefore really doesn't matter. What bothers me is that 
it is possible that coin units can be "lost".  Even bean-doctor won't say a 
word about the missing units:

------------ Balances before transaction

  Assets:Crypto:XRP:Binance                    428.317149 XRP {0.5 EUR, 
2020-07-15}
  Assets:Crypto:XRP:Binance                          2000 XRP {0.1 EUR, 
2020-07-30}

  Assets:Crypto:XRP:Coinbase-Pro                                            
       


------------ Transaction

2020-07-31 * "Transfer"
  Assets:Crypto:XRP:Binance        -428.317149 XRP {0.5 EUR, 2020-07-15}  ; 
-214.1585745 EUR
  Assets:Crypto:XRP:Binance       -2000.000000 XRP {0.1 EUR, 2020-07-30}  
;       -200.0 EUR
  Assets:Crypto:XRP:Coinbase-Pro   2000.000000 XRP {0.1 EUR, 2020-07-30}  
;  200.0000000 EUR
  Assets:Crypto:XRP:Coinbase-Pro    428.317000 XRP {0.5 EUR, 2020-07-15}  
;     214.1585 EUR


Residual: (-0.0000745 EUR)
Tolerances: XRP=0.0005
Basis: (-0.0000745 EUR)

------------ Balances after transaction

  Assets:Crypto:XRP:Binance                                                
        

* Assets:Crypto:XRP:Coinbase-Pro              2000.000000 XRP {0.1 EUR, 
2020-07-30}
* Assets:Crypto:XRP:Coinbase-Pro                  428.317 XRP {0.5 EUR, 
2020-07-15}

As I said, it is possible to strip the decimal digits 4-6:
          Assets:Crypto:XRP:Coinbase-Pro     428.317 XRP {0.5 EUR, 
2020-07-15}

Assuming the price rises sometimes to 150.5 EUR the value of 0.000149 XRP 
is high enough to be relevant:

option "booking_method" "FIFO"
plugin "beancount.plugins.auto_accounts"
option "inferred_tolerance_default" "EUR:0.001"

2020-07-15 * "" "Buy XRP"
          Assets:Cash:Binance                  -214.158 EUR
          Assets:Crypto:XRP:Binance          428.317149 XRP {0.5 EUR} @ 0.5 
EUR

2020-07-30 * "" "Buy XRP"
          Assets:Cash:Binance                   -200.00 EUR
          Assets:Crypto:XRP:Binance               2,000 XRP {0.1 EUR} @ 0.1 
EUR

2020-07-31 * "" "Transfer"
          Assets:Crypto:XRP:Binance       -2,428.317149 XRP {}
          Assets:Crypto:XRP:Coinbase-Pro   2,000.000000 XRP {0.1 EUR, 
2020-07-30}
          Assets:Crypto:XRP:Coinbase-Pro        428.317 XRP {0.5 EUR, 
2020-07-15}
;                                                    ↑↑ 0.000149 missing 
and no error

2021-01-02 price XRP                              150.5 EUR

; Value of the 0.000149 XRP @ 150.5 is 0.022 EUR

Still no error. Having some hundreds txn this could sum up.

Maybe I'm wrong here, because I'm missing/misunderstood something.

Regards

Peter schrieb am Donnerstag, 31. Dezember 2020 um 16:36:33 UTC+1:

> Hi,
>
> I ran into a new obstacle while dealing with my crypto:
>
> Because of the eight digits most cryptocurrencies can be divided into, I 
> had to add a default EUR tolerance:
>
> option "inferred_tolerance_default" "EUR:0.001"
>
> E.g.:
>
> option "booking_method" "FIFO"
> plugin "beancount.plugins.auto_accounts"
> option "inferred_tolerance_default" "EUR:0.001"
>
> 2020-07-01 * "" "Buy XRP"
>           Assets:Cash:Binance                    -200.00 EUR
>           Assets:Crypto:XRP:Binance                1,000 XRP {0.2 EUR} @ 
> 0.2 EUR
>
> 2020-07-15 * "" "Buy XRP"
>           Assets:Cash:Binance                   -214.158 EUR
>           Assets:Crypto:XRP:Binance          428.3171498 XRP {0.5 EUR} @ 
> 0.5 EUR
>
> The second transaction will fail without the option.
>
> Then I tried to book a transfer manually:
>
> option "booking_method" "FIFO"
> plugin "beancount.plugins.auto_accounts"
> option "inferred_tolerance_default" "EUR:0.001"
>
> 2020-07-15 * "" "Buy XRP"
>           Assets:Cash:Binance                   -214.158 EUR
>           Assets:Crypto:XRP:Binance          428.3171498 XRP {0.5 EUR} @ 
> 0.5 EUR
>
> 2020-07-30 * "" "Buy XRP"
>           Assets:Cash:Binance                    -200.00 EUR
>           Assets:Crypto:XRP:Binance                2,000 XRP {0.1 EUR} @ 
> 0.1 EUR
>
> 2020-07-31 * "" "Transfer"
>           Assets:Crypto:XRP:Binance       -2,428.3171498 XRP {}
>           Assets:Crypto:XRP:Coinbase-Pro     428.3171487 XRP {0.5 EUR, 
> 2020-07-15} ; reduced by 0.00000011 XRP
>           Assets:Crypto:XRP:Coinbase-Pro  2,000.00000000 XRP {0.1 EUR, 
> 2020-07-30}
>         ; transaction fee leg missing, therefore unbalanced by 0.00000011
>
> The transaction has an assumed fee of 0.00000011 XRP. 
>
> I saved the file while creating the transaction. I noticed that beancount 
> didn't yield a warning/error that the transaction doesn't balance, although 
> I didn't add all legs to the transaction and the numbers didn't add up.
>
> That's because of the EUR tolerance. If I delete the line
> option "inferred_tolerance_default" "EUR:0.001"
> beancount yields me an error because of the incomplete transaction, but 
> then again also for the first transaction.
>
> To sum it up: Without the tolerance option beancount yields me a lot of 
> unbalanced transaction errors where the (real) EUR amounts are off by a 
> tiny fraction of cents. But with the tolerance option set beancount seems 
> to ignore unbalanced crypto lots up to the third decimal digit. E.g.: I 
> could cap the XRP amount to:
>
> 2020-07-31 * "" "Transfer"
>           Assets:Crypto:XRP:Binance       -2,428.3171498 XRP {}
>           Assets:Crypto:XRP:Coinbase-Pro         428.317 XRP {0.5 EUR, 
> 2020-07-15}
>           Assets:Crypto:XRP:Coinbase-Pro           2,000 XRP {0.1 EUR, 
> 2020-07-30} 
>
> And there's no warning/error.
>
> If the same kind of problem could occur with BTC the capped 0.0001498 
> units would sum up to 3,45€.
>
> How can I deal with that? 
>
> Regards
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" 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/beancount/cfd13ca2-3522-423d-a136-4017e2369192n%40googlegroups.com.

Reply via email to