Amount interpolation by ratios

44 views
Skip to first unread message

lijie...@gmail.com

unread,
Jul 25, 2019, 11:50:37 AM7/25/19
to Beancount
Hi,

New here (and new to beancount in general); I tried doing a search but was unsuccessful.

The problem: I have this "transaction"

2019-07-01 * "amazon.com" "stuff"
  Expenses:Gadgets 20USD
  Expenses:Books 30USD
  Liabilities:CreditCard 60AUD

I don't really care to track USD in my Expenses accounts, so I'd like beancount to apportion 60USD in that ratio.

I was hoping that this kind of syntax would work:

2019-07-01 * "amazon.com" "stuff"
  Expenses:Gadgets 20
  Expenses:Books 30
  Liabilities:CreditCard 60AUD

where amount interpolation occurs on all postings that are commodity-less in the ratios specified by the numbers, but this isn't a thing.

I can probably introduce a special commodity (and, depending on whether transaction balances are checked before plugins run, a throwaway account for interpolation) and write a plugin, but I'm wondering whether there are better ways of doing this..


Thanks,
lj 

Martin Blais

unread,
Jul 28, 2019, 11:30:52 AM7/28/19
to Beancount
There's currently no automatic way to distribute the interpolated amount.
I would write some code.
You can try use a commodity and/or a posting flag.

kuba jamro

unread,
Jul 30, 2019, 11:14:38 AM7/30/19
to Beancount
Hi,

Why not use beancount to work out the math for you to attribute the correct proportional amount to each expenses?

For instance:
2019-07-30 * "Amazon"
  Expenses:Gadgets (20/50)*60 AUD ; Where 50 is the total USD spent
  Expenses:Books
  Liabilities:CreditCard -60 AUD

Does this not give the desired result? 

You could easily add this logic to your import code too.

Jakub.

On Sunday, 28 July 2019 16:30:52 UTC+1, Martin Blais wrote:

Li Jie Wong

unread,
Jul 30, 2019, 11:58:37 AM7/30/19
to bean...@googlegroups.com
On Wed, 31 Jul 2019 at 01:14, kuba jamro <kuba....@gmail.com> wrote:
Hi,

Why not use beancount to work out the math for you to attribute the correct proportional amount to each expenses?

For instance:
2019-07-30 * "Amazon"
  Expenses:Gadgets (20/50)*60 AUD ; Where 50 is the total USD spent
  Expenses:Books
  Liabilities:CreditCard -60 AUD

Does this not give the desired result? 

Yes it does, but I find this clunky: e.g. 60 and 50 need to be repeated on all but 1 expense line.
 
You could easily add this logic to your import code too.

This is true, assuming I use import code to label expenses (unlikely -- receipts are too varied). Seems neater to write a plugin so that I can instead say...

2019-07-30 * "Amazon"
  Expenses:Gadgets 20 ZZ
  Expenses:Books 30 ZZ
  Liabilities:CreditCard -60 AUD
 

Jakub.

On Sunday, 28 July 2019 16:30:52 UTC+1, Martin Blais wrote:
On Thu, Jul 25, 2019 at 11:50 AM <liji...@gmail.com> wrote:
Hi,

New here (and new to beancount in general); I tried doing a search but was unsuccessful.

The problem: I have this "transaction"

2019-07-01 * "amazon.com" "stuff"
  Expenses:Gadgets 20USD
  Expenses:Books 30USD
  Liabilities:CreditCard 60AUD

I don't really care to track USD in my Expenses accounts, so I'd like beancount to apportion 60USD in that ratio.

I was hoping that this kind of syntax would work:

2019-07-01 * "amazon.com" "stuff"
  Expenses:Gadgets 20
  Expenses:Books 30
  Liabilities:CreditCard 60AUD

where amount interpolation occurs on all postings that are commodity-less in the ratios specified by the numbers, but this isn't a thing.

I can probably introduce a special commodity (and, depending on whether transaction balances are checked before plugins run, a throwaway account for interpolation) and write a plugin, but I'm wondering whether there are better ways of doing this..

There's currently no automatic way to distribute the interpolated amount.
I would write some code.
You can try use a commodity and/or a posting flag.

--
You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/xfyzQxJoBjo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/3302ea14-f6ee-4bd9-b628-756c1f14719c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages