This way of expressing the transaction doesn't work.Hi all,On a recent trip from New Zealand to the US, I incurred some expenses that I'm trying to import into beancount. Here's an example transaction:
2014-11-19 * "POS W/D 77.00USD @ 0.7907 conver / POS W/D 77.00USD @ 0.7907 conversion rate ;(INC. $2.43 CURRENCY CONVERSION COMMISSION) CHECKERAIRPORT TAXI STERLING"
Assets:NZ:KiwiBank:Current -99.81 NZD @ 0.7907 USD
Expenses:Other:Bank:Fees 2.43 NZD
Expenses:Other:Travel:Taxi 77.00 USD
I have the full amount charged to my account (99.81 NZD), I have the exchange rate in USD that they used to calculate it, I have the original USD charge amount and I have the fee they charged me for the currency conversion. Deducting the fee from the full amount and then multiplying by the exchange rate gives the original USD amount, but I can't find a way to import these transactions without doing some manual calculation for each one.
I had hoped that I could leave the exchange rate off and that beancount would work it out for me, but it refuses to balance. I can't put the conversion rate on the full amount because it doesn't balance either, I need to subtract the fee first. The only way I can seem to make it work is to calculate the inverse of the quoted exchange rate and add that to the USD entry, but that's tedious - I have quite a few of these transactions. Is there an easier way to achieve this?
--ColinThanks,
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACK23AfJ%2BMicfNHS5WzHryjkNZayxcBP6YtauB_xGHWGrAXVKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhMCbLXGYSYKLz_mYbBsALkap48kP-A2Uvz6Km83U6SX-A%40mail.gmail.com.
Thanks very much for the excellent documentation for beancount, too - I haven't made my way through it all yet, but I run a project myself and I'm acutely aware of how much effort it is. It's greatly appreciated! One very nice feature would be to compile it into a Kindle book - I'm not sure how much effort that would be, though.Thanks Martin. After playing around with it for a while I ended up with something similar:But any of the solutions you suggest look good too. I think the division solution is probably the cleanest, that's good to know.
2014-11-26 * "POS W/D 543.77USD @ 0.7765 conve HYATT HOTELS GRAND WA. WASHINGTON"
Assets:NZ:KiwiBank:Current -700.30 NZD @ 0.7765 USD
Assets:NZ:KiwiBank:Current -17.50 NZD
Expenses:Other:Bank:Fees 17.50 NZD
Expenses:Other:Travel:Food
I was excited to see some Clojure code in the repo too, I'll play around with that and see if I can brush it up - Clojure is my main programming language and I'd love to use it for import scripts.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACK23AeRa6bRsAQVMm%3DmGeY_NVwwDzS6XxsjTHBbhMdDXPou4Q%40mail.gmail.com.
Thanks Colin, it is indeed very time-consuming, many many entire weekends have been sunk hacking and writing on this. I don't really know why I do it. I think I just don't like not finishing things.
About compiling it to a Kindle book: almost there, I can do PDF now.I wrote a script that downloads my index file and that fetches all the documents linked from it, and can download all the docs to PDF and put them together in a single file:Here, I just ran it, here's what it looks like:
Originally I thought I might use Clojure for this project - I love Clojure, have been dabbling for a while, I go to the Conj every couple of years - but in practice it's a bit of a moving target (that community has somewhat of a disregard for software dependencies and things break a lot) and when I need to actually _use_ Beancount (that is, without tinkering with it) having to fiddle with setup is just not an option for me, I just need it to work, I really do. With Python it'll always "just work", the environment is much more stable.
That being said, I encourage you to build Clojurethings for Beancount - or even reimplement the whole thing in Clojure! - that could be fun indeed.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhNnTGsgPQsgk2jgfDoB0KmRPTgOW%2B-QFKNsUNVDYy722w%40mail.gmail.com.
About compiling it to a Kindle book: almost there, I can do PDF now.I wrote a script that downloads my index file and that fetches all the documents linked from it, and can download all the docs to PDF and put them together in a single file:Here, I just ran it, here's what it looks like:Wow, nice - I've bought smaller books than that! The one thing that would be useful would be for the links to work within the documents - currently they still point to the website. This is slightly complicated by the redirect you're using from furius.ca, it might require a mapping from the redirected name to the Google doc. Can the docs be exported as HTML rather than PDF?
Originally I thought I might use Clojure for this project - I love Clojure, have been dabbling for a while, I go to the Conj every couple of years - but in practice it's a bit of a moving target (that community has somewhat of a disregard for software dependencies and things break a lot) and when I need to actually _use_ Beancount (that is, without tinkering with it) having to fiddle with setup is just not an option for me, I just need it to work, I really do. With Python it'll always "just work", the environment is much more stable.Oh nice - maybe I'll see you at the conj one of these days, my main project is https://cursiveclojure.com.
I think the stability of a lot of the projects has increased recently but it can be a problem depending on what you're using (CLJS always moves pretty fast). But particularly if you want outside contributions Python is probably a better choice anyway.
On 29 June 2015 at 13:17, Colin Fleming <colin.ma...@gmail.com> wrote:Whoops, I've just come back to this, and in all the excitement about Clojure I just realised I never got an answer for this question - is there any advice here?On 11 June 2015 at 00:32, Colin Fleming <colin.ma...@gmail.com> wrote:Another question related to this - in the bean-web interface I can get the Income Statement which shows the totals for all the categories. I'm using this for the accounts for a small company I'm running, and I'd like to transcribe those values to the financial statements summary for my company tax return.
However to do that I need the NZD values, and now that I have the conversion correctly accounted for it shows me a combination of currencies. There doesn't seem to be a way to achieve this either in the web UI or using bean-report - do I need to dig into the query language for this?
And an additional question - for transactions where I have a receipt which I'd like to associate with the transaction, what's the best way to achieve this? The document directive doesn't seem to be associated with a particular transaction - should I just use metadata for this?
Are you using the "operating_currencies" option to let it know you're interested in breaking out NZD in its own dedicated column?
Also, can you be more specific about some line of output that does not appear the way you'd like it?
Personal I'm hoping to create a little filter program that accept the output of a bean-query SQL query and render it as an income statement and balance sheet, so that these details could be done away with: you'd write the desired query and the output would be processed by this external tool to produce a nicely formatted income statement and balance sheet instead of using the special-purpose reporting code that currently generates those pages.
If you want to associate a document to a particular transaction, use metadata. On some of my transactions I use the "doc" key with a string that is just the filename of the document. I'm not really using those yet, it's write-only so far, but you can script something if you need it, that's what metadata is for.
On 30 June 2015 at 00:34, Martin Blais <bl...@furius.ca> wrote:Are you using the "operating_currencies" option to let it know you're interested in breaking out NZD in its own dedicated column?No, I'm not - I hadn't seen that. It doesn't appear in the Language Syntax Guide, BTW.
However this doesn't do what I need - it just breaks it out into a column but doesn't actually perform any conversion.
Also, can you be more specific about some line of output that does not appear the way you'd like it?Sure. I actually came up with a workaround where I just commented out the currency calculation, like:
2014-11-19 * "POS W/D 77.00USD @ 0.7907 conver / POS W/D 77.00USD @ 0.7907 conversion rate ;(INC. $2.43 CURRENCY CONVERSION COMMISSION) CHECKERAIRPORT TAXI STERLING"
Assets:NZ:KiwiBank:Current -99.81 NZD
Expenses:Other:Bank:Fees 2.43 NZD
Expenses:Other:Travel:Taxi ;77.00 USD @ 1/0.7907 NZD
receipt: "washington-airport-taxi.pdf"
That gives me what I need, which is all values in NZD. If I uncomment that conversion, then I get:
select date, position, balance where date >= 2014-04-01 and date < 2015-04-01 and account ~ "Expenses:Other";
date position balance
---------- ----------- -----------
2014-09-28 2653.00 NZD 2653.00 NZD
2014-09-30 0.20 NZD 2653.20 NZD<etc etc...>
2014-11-19 77.00 USD 3358.12 NZD
77.00 USD
<etc etc...>
2015-03-03 2516.00 NZD 6834.43 NZD
77.00 USDSo this gives me the balance in a mix of USD and NZD, which is no good for me - the tax return box only accepts NZD.
There's an additional issue - if I do provide a conversion and then somehow convert the balance to NZD, rounding is a problem.
What I really need is for the expense value to be the exact NZD amount calculated by taking into account the remaining transaction legs, which is exactly what I get by leaving the conversion commented out. I'm starting to think that that is really what I want, and that maybe I don't care about currencies.
Personal I'm hoping to create a little filter program that accept the output of a bean-query SQL query and render it as an income statement and balance sheet, so that these details could be done away with: you'd write the desired query and the output would be processed by this external tool to produce a nicely formatted income statement and balance sheet instead of using the special-purpose reporting code that currently generates those pages.This would be really great. I actually looked into how to produce a custom report which I could just copy to the tax return fields, but it looks trickier than I have time for right now. For now I have various queries saved for things like GST periods and the various fields in the financial statements summary, it would be nice to be able to automate the extraction of those values somehow.
It appears in the options reference but it's true I haven't dedicated a section to this topic and it deserves it.
Have you tried this?select date, convert(position, "NZD"), convert(balance, "NZD") where date >= 2014-04-01 and date < 2015-04-01 and account ~ "Expenses:Other";I think this does more or less what you want (minus the ugly rendering of too many digits).
Ah I think I see what you mean. You don't want that third leg to "compute to 77.00 * 1/0.7907", but rather "compute to -(-99.81 + 2.43)". Is that right?
But you also want to record & deposit USD expenses of 77.00 USD to that account.
It's not obvious to me how I would generalize that.This is a quirky request indeed.
You may want to look at the realization example I just wrote in the design doc this weekend:I think you can get balances for a particular account directly like this, it's a one-liner:realization.get(real_root, 'Expenses:Other:Bank:Fees').balance
On 30 June 2015 at 17:18, Martin Blais <bl...@furius.ca> wrote:Where is the options reference? I can't find it in the doc TOC and it's not in the Language Syntax.It appears in the options reference but it's true I haven't dedicated a section to this topic and it deserves it.
Related to this, a bit of feedback on the Google Docs documentation - as a user, it's quite difficult to navigate. It insists on opening linked pages in a new tab which makes going back unintuitive,
and I can't search it - the lack of a directory structure means that I can't even use a site: search in Google.
I'd really like to see a standard website, even if you edit in Docs and then export somehow -
I totally understand that WYSIWYG is nice for the editing.
Have you tried this?select date, convert(position, "NZD"), convert(balance, "NZD") where date >= 2014-04-01 and date < 2015-04-01 and account ~ "Expenses:Other";I think this does more or less what you want (minus the ugly rendering of too many digits).That does indeed do what I want, thanks!Ah I think I see what you mean. You don't want that third leg to "compute to 77.00 * 1/0.7907", but rather "compute to -(-99.81 + 2.43)". Is that right?But you also want to record & deposit USD expenses of 77.00 USD to that account.Right, which is exactly what I get if I leave off the currency conversion on the posting. In general, that's how much the cost to me actually was, but for larger transactions (of which I have a couple) rounding means that this value and the conversion via the quoted rate are frequently not equal. This is related to the rendering of too many digits in the convert() example above. I also had to fiddle with the tolerance a couple of times for several of my postings to get them to balance. For example:
2014-11-26 * "POS W/D 543.77USD @ 0.7765 conve / POS W/D 543.77USD @ 0.7765 conversion rate ;(INC. $17.50 CURRENCY CONVERSION COMMISSION) HYATT HOTELS GRAND WA. WASHINGTON"
Assets:Cash:KiwiBank:Current -717.8 NZD
Expenses:Other:Bank:Fees 17.50 NZD
Expenses:Other:Travel:Food 543.77 USD @ 1/0.7765 NZD
receipt: "washington-grand-hyatt.pdf"Here, this transaction doesn't balance if I have the KiwiBank leg as -717.80. I could probably also have used tolerance directives to work around it. But this is the same problem - the actual cost to me was 717.80 - 17.50, and the conversion is really only indicative of how that value was calculated.
It's not obvious to me how I would generalize that.This is a quirky request indeed.Really? I guess no-one thinks of their own requests as quirky :-). Isn't this a problem for anyone filling in a tax return from data including other currencies?
Again, I'm starting to think that perhaps I'm better off not worrying about the currencies at all - it seems wrong to throw away that information, but the IRD only cares about NZD which means that mostly I only care about that too.You may want to look at the realization example I just wrote in the design doc this weekend:I think you can get balances for a particular account directly like this, it's a one-liner:realization.get(real_root, 'Expenses:Other:Bank:Fees').balanceThanks, I'll study that when I get a moment and see if I can make it do what I want. Can I collapse accounts like this? For example, the tax return just has a field for "Other expenses", the groupings under that (bank fees or whatever) are just for my information. In bean-query I do that using account ~ "Expenses:Other", which works very well.Thanks for all the help!
--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CACK23Af1xM7P_V1Vwh348YT8dU%2BhwwyFKDk9aEnApvi_Xq8j3g%40mail.gmail.com.
It's not obvious to me how I would generalize that.This is a quirky request indeed.Really? I guess no-one thinks of their own requests as quirky :-). Isn't this a problem for anyone filling in a tax return from data including other currencies?
Again, I'm starting to think that perhaps I'm better off not worrying about the currencies at all - it seems wrong to throw away that information, but the IRD only cares about NZD which means that mostly I only care about that too.
You may want to look at the realization example I just wrote in the design doc this weekend:I think you can get balances for a particular account directly like this, it's a one-liner:realization.get(real_root, 'Expenses:Other:Bank:Fees').balanceThanks, I'll study that when I get a moment and see if I can make it do what I want. Can I collapse accounts like this?
For example, the tax return just has a field for "Other expenses", the groupings under that (bank fees or whatever) are just for my information. In bean-query I do that using account ~ "Expenses:Other", which works very well.Thanks for all the help!
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhMj1sACUhCipEj_0S55DSxX0TKNCtFjRCorPjLwAw1A2Q%40mail.gmail.com.
I'll offer three existing solutions:
<snip>
Neither of these is ideal but would you rather the transactions not balance?Do you have ideas for making this easier? (Beyond the plugin suggestion from previously?)I'm open to suggestions.
I think you're worrying about rounding way too much.
IIRC there's an iterator function that allows you to iterate over all postings of an account and a subaccount.
On 2 July 2015 at 19:50, Martin Blais <bl...@furius.ca> wrote:I'll offer three existing solutions:<snip>Neither of these is ideal but would you rather the transactions not balance?Do you have ideas for making this easier? (Beyond the plugin suggestion from previously?)I'm open to suggestions.The only thing I could think of would be to infer the exchange rate, basically do automatically what you're doing by fiddling the rate manually. Could you automatically infer the exchange rate if I provided:2014-11-26 * "HYATT HOTELS GRAND WA. WASHINGTON"Assets:Cash:KiwiBank:Current -717.80 NZDExpenses:Other:Bank:Fees 17.50 NZDExpenses:Other:Travel:Food 543.77 USD @/receipt: "washington-grand-hyatt.pdf"Where @/ (or whatever symbol) means I'd like the rate calculated. That seems to be the free variable here since the actual USD and NZD amounts are all known exactly
I think you're worrying about rounding way too much.I think you're right, and I must admit this has diverged a little into "I wonder how it should work" rather than "I need it to work like this" :-). Is there a query function I can use to round the convert(balance, "NZD") values to 2DP? That would make the output more readable.