Issue #223: Cost of the same currency (blais/beancount)

51 views
Skip to first unread message

Zhuoyun Wei

unread,
Mar 1, 2018, 3:13:25 AM3/1/18
to bean...@googlegroups.com
New issue 223: Cost of the same currency
https://bitbucket.org/blais/beancount/issues/223/cost-of-the-same-currency

Zhuoyun Wei:

Hi,

I am not sure if this is a bug or this is by design.

I try to use a special approach to record my gift card transactions. Here is a minimal bean file:

```
1970-01-01 open Assets:Cash
1970-01-01 open Assets:GiftCards
1970-01-01 open Income:SomeIncome
1970-01-01 open Expenses:Music
1970-01-01 open Expenses:Apps

2018-01-01 * "Some income"
Income:SomeIncome -1000.00 USD
Assets:Cash +1000.00 USD

2018-02-01 * "Buy 100 USD gift card with 50% discount"
Assets:Cash -50.00 USD
Assets:GiftCards +100.00 USD { 0.50 USD }

2018-02-02 * "Buy some music with gift cards"
Assets:GiftCards -10.00 USD { 0.50 USD }
Expenses:Music +5.00 USD
```

The idea is, I am tagging lots in "Assets:GiftCards" with a cost, but the cost is of the same currency. I put 100 USD (which I "bought" with 50 USD) into GiftCards, then buy music with 10 USD (which I "bought" with 5 USD) in the gift card.

The balance looks good (but the cost tag is already missing)
```
# bean-report
Assets:Cash 950.00 USD
Assets:GiftCards 90.00 USD
Equity
Expenses:Apps
Expenses:Music 5.00 USD
Income:SomeIncome -1000.00 USD
Liabilities
```

However, if I forget to attach a cost, things went wrong:

```
2018-02-02 * "Buy some apps with gift cards"
Assets:GiftCards -20.00 USD
Expenses:Apps

# bean-report
Assets:Cash 950.00 USD
Assets:GiftCards 70.00 USD
Equity
Expenses:Apps 20.00 USD
Expenses:Music 5.00 USD
Income:SomeIncome -1000.00 USD
Liabilities
```

At this time the "Assets:GiftCards" account should be a mixed inventory, with two lots: 90 "discounted USD" and -20 "normal USD". But no, Beancount does not distinguish a "discounted USD" (i.e. USD with a cost) and a "normal USD", instead if merges the two lots together into a 70 USD lot.

This is quite an edge case. I remember someone in the mailing list recommended creating a new commodity GUSD (gift card USD) for gift card balances. But if I have gift cards of different currencies, creating gift card counterpart for each one of them seems cumbersome.

So may I ask if distinguishing between "currency with cost of the same currency (e.g. 100 USD { 0.50 USD })" and "normal currency (e.g. 100 USD)" is trivial to implement? If the "feature" is implemented, there would be no need to create imaginary currencies like "GUSD" any more.


Reply all
Reply to author
Forward
0 new messages