decimal

62 views
Skip to first unread message

francois PEGORY

unread,
Apr 5, 2021, 4:08:11 PM4/5/21
to Beancount
i have a problem with decimal of commodities.
my stocks have 5 decimal for units but euro have only two decimals.

so basically here i have a buy operation.:
2021-02-09 * "Achat" "100"
  Assets:Titre: Assurance-vie                   0.081869 SMG-ASIE {232.69 EUR, 2021-02-09}
  Assets:Titre: Assurance-vie                   1.498820 ODDO-PATRIMOINE {25.42 EUR, 2021-02-09}
  Assets:Titre: Assurance-vie                   0.273118 ODDO-CONV {139.50 EUR, 2021-02-09}
  Assets:Titre: Assurance-vie                   0.021467 ODDO-AVENIR {4436.98 EUR, 2021-02-09}
  Expenses:Frais-bancaires              9.50 EUR
  Assets:Titre:Assurance-vie:Cash      -200 EUR

and the problem is if i do a BQL :
SELECT
account, units(sum(position)) AS quantity
WHERE
account ~ "Generation"
GROUP BY account
ORDER BY account

the quantity is with only two decimals not five :(
how i can do it ?

regards

Martin Blais

unread,
Apr 5, 2021, 5:42:12 PM4/5/21
to Beancount
Precision selected for BQL is a bit of a mess.
Just another reason why it needs a rewrite.
This is really gnawing at me, but I just don't have the cycles to rewrite it
Try this in the meantime:

option "inferred_tolerance_default" "EUR:0.0005"



--
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 beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CALUWbLf2eBhyOA8G59B8p-gxXof6k_Sn9Nv3RjEe088ia_N27A%40mail.gmail.com.

francois PEGORY

unread,
Apr 6, 2021, 6:07:08 PM4/6/21
to Beancount
unfortunatly it don't work. because if do this. some operations does not balance.
example with option "inferred_tolerance_default" "EUR:0.01", it balance well. with option "inferred_tolerance_default" "EUR:0.0005" , it does not balance anymore ...

2019-09-30 * "Achat" ""
  Assets:Titre:PEE        0.7996 PEEB {125.055 EUR, 2019-09-30}
  Assets:Titre:PEE        2.4955 PEEE {40.0720 EUR, 2019-09-30}
  Assets:Titre:PEE:Cash  -200.00 EUR

Martin Blais

unread,
Apr 6, 2021, 6:14:48 PM4/6/21
to Beancount
Try setting the tolerance for the instruments

  option "inferred_tolerance_default" "SMG-ASIE:0.000005"

The rendering code is buried in here somewhere:

All that code will be thrown away and get rewritten eventually. 
Patches are welcome in the meantime.


Reply all
Reply to author
Forward
0 new messages