I may be wrong, but IIRC, there’s no way to do this through the API. @@ is not very well supported. The parser <https://github.com/beancount/beancount/blob/eb8be17c750257dc693e3173c30d2cabc9ab2faa/beancount/parser/grammar.py#L868> has it but the Posting class <https://github.com/beancount/beancount/blob/eb8be17c750257dc693e3173c30d2cabc9ab2faa/beancount/core/data.py#L206> doesn’t.
For what you’re wanting, shouldn’t you be wanting to *avoid* using @@? On Sunday, February 8, 2026 at 6:06:04 AM UTC-8 Zoltan wrote: > The Beancount documentation says it supports "total cost" or "total price" > using @@ symbols: > https://beancount.github.io/docs/beancount_language_syntax.html > > The grammar file of Beancount also has separate, distinct entries for @ > and @@. > > I do currency exchanges(with no additional, explicit fees). For me, it is > cleaner to declare the amount I paid and received than only the amount I > paid and fiddle with the many digits of the exchange rate. > For example, this is what I would like to have: > 2025-01-01 * "Exchanged to GBP" > Assets:Bank:EUR -117 EUR @@ 100 GBP > Assets:Bank:GBP > > And this is what I would like to avoid: > 2025-01-01 * "Exchanged to GBP" > Assets:Bank:EUR -117 EUR @ 0.854700855 GBP > Assets:Bank:GBP > > I'm writing an importer by extending beangulp.importers.csvbase.Importer > and I'm using beancount.core.data. I couldn't find any reference in the > documentation how to declare total cost(@@) using the python API. > > Is it possible to generate clean records of currency exchanges using an > importer script where the transaction only declares the total amount paid > and received? > -- 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 visit https://groups.google.com/d/msgid/beancount/70e41697-544a-491d-93da-c0152bdc1759n%40googlegroups.com.
