Have you seen/read
https://beancount.github.io/docs/precision_tolerances.html ?

On Sat, Jan 2, 2021, 11:56 [email protected] <[email protected]> wrote:

> Peter,
>
> I don't have any experience with the issues you're dealing with, but I
> can't help but notice this line in your output: "Tolerances: XRP=0.0005"
> That sure looks like Beancount is using less than your provided 8
> significant digits.  Why, or how to fix it, I don't know.    Can you add
> another tolerance statement for the XRP as well?  *option
> "inferred_tolerance_default" "XRP:0.00000001"*  ??
>
> - Cameron Murphy
>
> On Saturday, January 2, 2021 at 5:48:11 AM UTC-7 Peter wrote:
>
>> 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/de39f33b-9a4d-4eb9-b330-bce9052b053bn%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/de39f33b-9a4d-4eb9-b330-bce9052b053bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CACGEkZttNspieb%2BCTsmz%3D6JOhBiKg0a2%2Br%2BEsbshB305-7d8Yw%40mail.gmail.com.

Reply via email to