Trial balance -0.0000000000000000000000001 USD

99 views
Skip to first unread message

Joel Shprentz

unread,
Dec 28, 2017, 7:39:20 AM12/28/17
to Beancount
Beancount cloned with hg at 2017-12-27 22:14 EST
Python 3.5.3 running on Ubuntu 14.04

In the following bean file, I purchase $1,000.00 of a Vanguard fund. Vanguard reports shares to three decimal places.

option "operating_currency" "USD"
option
"booking_algorithm" "FULL"

2017-12-01 commodity USD
2017-12-01 commodity VFIAX

2017-12-01 open Assets:Checking
2017-12-01 open Equity:Opening-Balances
2017-12-01 open Assets:Vanguard     VFIAX "FIFO"

2017-12-01 * "Opening balance"
 
Assets:Checking           1000.00 USD
 
Equity:Opening-Balances

2017-12-27 * "Buy retirement fund shares"
 
Assets:Vanguard           4.039 VFIAX {}
 
Assets:Checking           -1000.00 USD

Using bean-web, in the trail balance report for all transactions, the USD column totals -0.00 and the total balance is -0.0000000000000000000000001 USD. Other reports appear correct.

The share purchase transaction details show a basis of 999.9999999999999999999999999 USD instead of 1000.00 USD. How can I configure Beancount to round the basis to the customary two decimal places for USD?

Hash:4baf7306f442bd171b65dd8a83e8390f
Location: /home/joel/projects/accounting/vanguard.bean:15

------------ Balances before transaction

  Assets:Vanguard                                                   

  Assets:Checking                                        1000.00 USD


------------ Transaction

2017-12-27 * "Buy retirement fund shares"
  Assets:Vanguard     4.039 VFIAX {247.59 USD, 2017-12-27}  ; 999.9999999999999999999999999 USD
  Assets:Checking  -1000.00 USD                             ;                      -1000.00 USD


Residual: (-0.0000000000000000000000001 USD)
Tolerances: USD=0.005
Basis: (999.9999999999999999999999999 USD)

------------ Balances after transaction

* Assets:Vanguard  4.039 VFIAX {247.5860361475612775439465214 USD, 2017-12-27}

  Assets:Checking

Martin Blais

unread,
Dec 28, 2017, 12:36:34 PM12/28/17
to Beancount
Short answer: there's no "customary"
If you want a precise amount, put it i n
4.039 VFIAX {247.59 USD}

If you need to get rid of rounding error check in the plugins directory there's a plugin for that



--
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/9b46d869-2e31-4466-951a-7b910f34f977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joel Shprentz

unread,
Dec 28, 2017, 7:11:15 PM12/28/17
to Beancount
Thanks, Martin, for your quick response. I experimented with some alternative transaction entries.

Specify the per-share price.

2017-12-27 * "Buy retirement fund shares"

 
Assets:Vanguard           4.039 VFIAX {247.59 USD}
 
Assets:Checking           -1000.00 USD

Beancount rejects this, logging:

/home/joel/projects/accounting/vanguard.bean:15:      Transaction does not balance: (0.01601 USD)


   2017-12-27 * "Buy retirement fund shares"
     Assets:Vanguard     4.039 VFIAX {247.59 USD, 2017-12-27}
     Assets:Checking  -1000.00 USD

Is this the error check you mentioned?

The sellgains.py plugin description mentions rounding, but I am buying here. Which plugin should I use?

Specify the total cost.

2017-12-27 * "Buy retirement fund shares"

 
Assets:Vanguard           4.039 VFIAX {# 1000.00 USD}
 
Assets:Checking           -1000.00 USD



Beancount reports that the basis is
999.9999999999999999999999999 USD rather than 1000.00 USD.


Hash:4baf7306f442bd171b65dd8a83e8390f
Location: /home/joel/projects/accounting/vanguard.bean:15

------------ Balances before transaction

  Assets:Vanguard                                                   

  Assets:Checking                                        1000.00 USD


------------ Transaction

2017-12-27 * "Buy retirement fund shares"
  Assets:Vanguard     4.039 VFIAX {247.59 USD, 2017-12-27}  ; 999.9999999999999999999999999 USD
  Assets:Checking  -1000.00 USD                             ;                      -1000.00 USD


Residual: (-0.0000000000000000000000001 USD)
Tolerances: USD=0.005
Basis: (999.9999999999999999999999999 USD)

------------ Balances after transaction

* Assets:Vanguard  4.039 VFIAX {247.5860361475612775439465214 USD, 2017-12-27}

  Assets:Checking

Apparently each lot records a quantity and a cost per share. Beancount multiplies those two values to compute the basis when needed (as for the trial balance).

If each lot recorded a quantity and the total cost, Beancount could divide to compute the cost per share when needed. I wonder if that approach would eliminate these tiny discrepancies in the trial balance.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.

Justus Pendleton

unread,
Dec 28, 2017, 8:04:16 PM12/28/17
to Beancount
On Friday, December 29, 2017 at 7:11:15 AM UTC+7, Joel Shprentz wrote:
Thanks, Martin, for your quick response. I experimented with some alternative transaction entries.

Specify the per-share price.

2017-12-27 * "Buy retirement fund shares"
 
Assets:Vanguard           4.039 VFIAX {247.59 USD}
 
Assets:Checking           -1000.00 USD

Beancount rejects this, logging:

/home/joel/projects/accounting/vanguard.bean:15:      Transaction does not balance: (0.01601 USD)

FWIW, beancount is correct here. Vanguard has stolen 1.6 cents from you. This happens on many (most? all?) Vanguard transactions. I haven't had it happen with any other service I use. I write it off to a quirk of how Vanguard handles rounding and attribute the lost money to an Equity:VanguardRounding account I created.

(I have a feeling that Vanguard's rounding has been mentioned before either on this forum or somewhere in the beancount documentation.)

yegle

unread,
Dec 28, 2017, 9:04:43 PM12/28/17
to Beancount
On Thu, Dec 28, 2017 at 5:04 PM, Justus Pendleton <just...@gmail.com> wrote:
On Friday, December 29, 2017 at 7:11:15 AM UTC+7, Joel Shprentz wrote:
Thanks, Martin, for your quick response. I experimented with some alternative transaction entries.

Specify the per-share price.

2017-12-27 * "Buy retirement fund shares"
 
Assets:Vanguard           4.039 VFIAX {247.59 USD}
 
Assets:Checking           -1000.00 USD

Beancount rejects this, logging:

/home/joel/projects/accounting/vanguard.bean:15:      Transaction does not balance: (0.01601 USD)

FWIW, beancount is correct here. Vanguard has stolen 1.6 cents from you. This happens on many (most? all?) Vanguard transactions. I haven't had it happen with any other service I use. I write it off to a quirk of how Vanguard handles rounding and attribute the lost money to an Equity:VanguardRounding account I created.

It's actually Vanguard giving you 1.6 cents for free. Vanguard's rounding issue is not uncommon, I have a special account used to absorb those remaining balances.
  

(I have a feeling that Vanguard's rounding has been mentioned before either on this forum or somewhere in the beancount documentation.)

--
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.

For more options, visit https://groups.google.com/d/optout.



--

Martin Blais

unread,
Dec 28, 2017, 9:25:14 PM12/28/17
to Beancount
On Thu, Dec 28, 2017 at 7:11 PM, Joel Shprentz <jshp...@his.com> wrote:
Thanks, Martin, for your quick response. I experimented with some alternative transaction entries.

Specify the per-share price.

2017-12-27 * "Buy retirement fund shares"
 
Assets:Vanguard           4.039 VFIAX {247.59 USD}
 
Assets:Checking           -1000.00 USD

Beancount rejects this, logging:

/home/joel/projects/accounting/vanguard.bean:15:      Transaction does not balance: (0.01601 USD)

   2017-12-27 * "Buy retirement fund shares"
     Assets:Vanguard     4.039 VFIAX {247.59 USD, 2017-12-27}
     Assets:Checking  -1000.00 USD


Is this the error check you mentioned?

The sellgains.py plugin description mentions rounding, but I am buying here. Which plugin should I use?

Sellgains.py is unrelated, it is used to add a new assertion on the price (the @ part).


 

Specify the total cost.

2017-12-27 * "Buy retirement fund shares"
 
Assets:Vanguard           4.039 VFIAX {# 1000.00 USD}
 
Assets:Checking           -1000.00 USD



Beancount reports that the basis is
999.9999999999999999999999999 USD rather than 1000.00 USD.

Hash:4baf7306f442bd171b65dd8a83e8390f
Location: /home/joel/projects/accounting/vanguard.bean:15

------------ Balances before transaction

  Assets:Vanguard                                                   

  Assets:Checking                                        1000.00 USD


------------ Transaction

2017-12-27 * "Buy retirement fund shares"
  Assets:Vanguard     4.039 VFIAX {247.59 USD, 2017-12-27}  ; 999.9999999999999999999999999 USD
  Assets:Checking  -1000.00 USD                             ;                      -1000.00 USD


Residual: (-0.0000000000000000000000001 USD)
Tolerances: USD=0.005
Basis: (999.9999999999999999999999999 USD)

------------ Balances after transaction

* Assets:Vanguard  4.039 VFIAX {247.5860361475612775439465214 USD, 2017-12-27}

  Assets:Checking

Apparently each lot records a quantity and a cost per share. Beancount multiplies those two values to compute the basis when needed (as for the trial balance).

If each lot recorded a quantity and the total cost, Beancount could divide to compute the cost per share when needed. I wonder if that approach would eliminate these tiny discrepancies in the trial balance.

Way way back this was considered but rejected for the following reasons: 
- your broker does not keep track of costs this way, and the right way - throughout the entire design - is to replicate what the institutions do, so rounding should occur here at the cost basis leve
- splitting lots would introduce another source of rounding
- it would be more complicated to implemented


Sorry I can't get into this at depth right now I have other urgent priorities (tummy time and changing diapers)
 
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.
Reply all
Reply to author
Forward
0 new messages