Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importers should be able to output postings with @@ #4

Open
blais opened this issue Dec 27, 2017 · 6 comments
Open

Importers should be able to output postings with @@ #4

blais opened this issue Dec 27, 2017 · 6 comments

Comments

@blais
Copy link
Member

blais commented Dec 27, 2017

Original report by Kamal Marhubi (Bitbucket: kamalmarhubi, GitHub: kamalmarhubi).


When importing foreign currency transactions from my credit card, I am extracting the foreign currency price from the memo, eg 137.00 USD @@ 156.22 CAD. I'm trying to automate this with an importer.

As near as I can tell, this is currently impossible. The parser discards this info, and it is not explicit anywhere in the internals. If I compute the price in the importer, it spits out postings with a really ugly precision in the price.

Ideally, I could import them as I have the data available in the source.

@blais
Copy link
Member Author

blais commented Dec 27, 2017

Original comment by Kamal Marhubi (Bitbucket: kamalmarhubi, GitHub: kamalmarhubi).


@blais If you're willing to accept it, I could take a crack at API changes to allow this. Let me know!

@blais
Copy link
Member Author

blais commented Dec 27, 2017

Original comment by Zhuoyun Wei (Bitbucket: wzyboy, GitHub: wzyboy).


There is a related discussion about this: https://bitbucket.org/blais/beancount/issues/194/use-of-syntax-was-use-of-float-numbers-in

Beancount currently does not record the numerator and denominator of the exchange rate, just the rate itself. So internally @@ and @ are the same thing.

@blais
Copy link
Member Author

blais commented Dec 27, 2017

Original comment by Kamal Marhubi (Bitbucket: kamalmarhubi, GitHub: kamalmarhubi).


I should have said I had seen that issue. To be clear here, I'm not proposing changing he internal behaviour, just the structure that importers return, and the ingest module prints out. The changes would be scoped to just the ingest module; actual computation would be done as it is now.

@blais
Copy link
Member Author

blais commented Feb 17, 2018

Original comment by Martin Blais (Bitbucket: blais, GitHub: blais).


I'm quite opposed to changing the representation of Posting in beancount.core to an ambiguous representation (e.g. two fields: per-unit and total); however, here's a fun idea (see other thread): Just for the purpose of rendering, the rendering code could probe the posting's metadata, and if some total price has been attached there and its value is very close -- to some epsilon as a f(precision), which could be computed automatically -- to that of the computed one, it could use it to render a @@. Its treatment should be optional.

I think that change should be harmless to the rest of the code, and if well documented could be used to render @@ for importers.

@blais
Copy link
Member Author

blais commented Feb 25, 2018

Original comment by droogmic (Bitbucket: Michael Droogleever, GitHub: droogmic).


Further discussion can be found in beancount/beancount#194 and then a rejected implementation in pull request beancount/beancount#42

@blais blais transferred this issue from beancount/beancount Feb 2, 2021
@blais
Copy link
Member Author

blais commented Feb 17, 2021

This will require v3's ability to run booking on individual transaction, and will be made possible by that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant