document about the new booking functionnality

71 views
Skip to first unread message

francois PEGORY

unread,
Nov 15, 2016, 5:41:38 PM11/15/16
to Beancount
dear martin,
i have seen that the new booking functionality is now released.
but it seem that the documentation about trading is not updated.
do you foresee to update it ? at least, the syntax explanation document .

regards

Stefano Zacchiroli

unread,
Nov 16, 2016, 4:10:07 AM11/16/16
to bean...@googlegroups.com
On Tue, Nov 15, 2016 at 11:41:37PM +0100, francois PEGORY wrote:
> i have seen that the new booking functionality is now released.

Does that include booking at average cost or is that still unreleased?

--
Stefano Zacchiroli . za...@upsilon.cc . upsilon.cc/zack . . o . . . o . o
Computer Science Professor . CTO Software Heritage . . . . . o . . . o o
Former Debian Project Leader . OSI Board Director . . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

Martin Blais

unread,
Nov 16, 2016, 11:26:26 PM11/16/16
to Beancount
It's basically an improvement on this:
http://furius.ca/beancount/doc/proposal-booking
Minus the average cost booking method, which is not there yet (though FIFO and LIFO are).

I haven't had time to document the changes yet, but whatever used to work should just work (*). There's only one very specific and very unlikely case that differs with the new method (multiple buys at the same cost with no lot date and an ambiguous sale off of those lots). If you hit this problem, you can disambiguate by inserting the date of the lots you want to sell, or ask a question here (or even revert to the older method, which is still there).

The new doc explaining the changes will be the "How Inventories Work" doc. I'm extremely busy these days - barely any time to reply to personal emails honestly, new role at work - the docs are going to take a while to get completed. If you can't wait and you have the stamina, you could try reading the unit tests, they provide some insight into the new functionality:



(*) Issue #145 might also affect sales off of postings that buy and sell in the same transaction, but I'll fix that very soon, as soon as I can get hold of a half day of quiet time.



--
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+unsubscribe@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/CALUWbLdbmnJWbvbFKPoB80d_Cu7OjJEXT%3D9x5xynHWhRObNqyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Martin Blais

unread,
Nov 16, 2016, 11:28:38 PM11/16/16
to Beancount
Not yet. NONE (i.e., like Ledger), STRICT, FIFO, and LIFO are supported.
AVERAGE is a tougher nut to crack and will come along later.

In the meantime, I use (and recommend using) NONE for those accounts.
Like Ledger, calculating the total number of units and the total cost basis works just fine this way. It's just the specific list of lots that is all fakakta (and for non-taxable accounts this doesn't matter anyway).




--
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+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.

francois PEGORY

unread,
Nov 19, 2016, 5:45:08 PM11/19/16
to Beancount
ok i test it and maybe i don't use it right.
but if i use this:
option "operating_currency" "GBP"
option "booking_method" "FIFO"
1998-01-01 commodity GBP
1998-01-01 commodity WIDGET
1999-02-01 open Assets:Inventory
1999-02-01 open Assets:Cash
1999-02-01 open Assets:Pnl
2014-10-15 * "buy widgets"
  Assets:Inventory     10 WIDGET {} ; Price inferred to 8 GBP/widget
  Assets:Cash         -80 GBP

2014-10-16 * "sell a widget"
  Assets:Cash           10 GBP
  Assets:Inventory      -1 WIDGET {} ;
  Assets:Pnl


and run bean-check. i get :
/mnt/d/ledger/data/test_trading.ledger:8:       Transaction does not balance: (-80 GBP, 10 WIDGET)

   2014-10-15 * "buy widgets"
     Assets:Inventory   10 WIDGET
     Assets:Cash       -80 GBP

i don't understand why ?

regards

Martin Blais

unread,
Nov 19, 2016, 5:52:14 PM11/19/16
to Beancount
Works for me (no error at all).
Which version are you using?


francois PEGORY

unread,
Nov 19, 2016, 7:29:53 PM11/19/16
to Beancount
i used the version 2.0b13 install with pip

regards

Martin Blais

unread,
Nov 20, 2016, 1:03:07 PM11/20/16
to Beancount
Ha! Yes, I understand.
You're using the older "SIMPLE" booking method.
In this method, the inference of cost was never supported.
This is why it fails.

What's adding to the confusion here is that at some point I had to make grammar changes that made this syntax valid for the new booking algorithm (where this type of interpolation is legal and works fine), so instead of getting a syntax error, you're now getting this error, which incorrectly seems to hint that automatically inferring the cost ought to work. It should not. An more accurate reaction from Beancount would be to reject the syntax.

You should either:

a) add an explicit cost to your augmenting postings
b) switch to the newer algorithm, e.g. option "booking_algorithm" "FULL"

I'd recommend (b).
If you update from head (from the source code) that's the new default.

I hope this helps,


Martin Blais

unread,
Nov 20, 2016, 1:52:11 PM11/20/16
to Beancount
Reply all
Reply to author
Forward
0 new messages