This seems to be working pretty well, except I think it is leading to 
over-precision problems. As shown below, I booked an opening transaction 
establishing years' worth of lots of a TDF, then booked a bunch of 
payslips, each of which puts money into a 401k Cash account, with a related 
transaction that purchase more of the TDF using the Cash. So, money flows 
into Cash, then flows out. So I placed a balance assertion after the job 
concluded, stating that there should be 0 USD in cash. But I get an error 
due to a silly precision of 3E-25.

2016-01-01 * "Starting position"
  Assets:Fidelity:CompanyA:PreTax401k:LIPIX      10.175 LIPIX {{109.69 USD, 
2013-07-01}}
  Assets:Fidelity:CompanyA:PreTax401k:LIPIX       0.051 LIPIX {{  0.58 USD, 
2013-09-30}}
  ;; ... about 60 lots
  Assets:Fidelity:CompanyA:PreTax401k:LIPIX       9.783 LIPIX {{115.05 USD, 
2016-01-04}}
  Equity:Opening-Balances

;; for around 20 paychecks:

2016-01-14 * "CompanyA Payroll" ""
  Income:CompanyA:Salary                                   -1111.11 USD
  ;; ...
  Assets:Fidelity:CompanyA:PreTax401k:Cash                   115.05 USD
  ;; ...
  Income:CompanyA:Match401k                                 -115.05 USD
  Assets:Fidelity:CompanyA:PreTax401k:Cash                   115.05 USD

2016-01-15 * "Contribution"
  Assets:Fidelity:CompanyA:PreTax401k:LIPIX      20.994 LIPIX {{230.10 USD}}
  Assets:Fidelity:CompanyA:PreTax401k:Cash

;; ...earned dividends for a while after job ended...

2017-12-29 * "Dividend"
  Assets:Fidelity:CompanyA:PreTax401k:LIPIX      11.606 LIPIX {{173.97 USD}}
  Income:Fidelity:Dividends

*2018-01-10 balance Assets:Fidelity:CompanyA:PreTax401k:Cash        0 USD*

2018-01-11 * "Liquidated for Transfer"
  Assets:Fidelity:CompanyA:PreTax401k:LIPIX   -1056.687 LIPIX {} @@ 
16262.42 USD
  Assets:Fidelity:CompanyA:PreTax401k:Cash     16262.42 USD
  Income:Fidelity:PnL                          -3236.81 USD

This balance assertion results in the following error from bean-check:

path/to/main.beancount:3503:    Balance failed for 
'Assets:Fidelity:CompanyA:PreTax401k:Cash': expected 0 USD != accumulated 
0.0000000000000000000000003 USD (3E-25 too much)

   2018-01-10 balance Assets:Fidelity:CompanyA:PreTax401k:Cash        0 USD

Is this crazy precision a direct result of my exclusively using the 
double-brackets to infer a share price every time I purchased a lot of the 
fund? If so, what is the recommended practice at this point to convince 
beancount to use a more reasonable precision?

Thanks again

On Friday, January 18, 2019 at 6:50:22 PM UTC-6, Jeff Brantley wrote:
>
> Thanks, this is exactly what I needed to know.
>
> On Friday, January 18, 2019 at 9:52:58 AM UTC-6, Martin Michlmayr wrote:
>>
>> * Jeff Brantley <[email protected]> [2019-01-18 07:29]: 
>> > 1. Is it possible to have beancount infer the unit price, or do I 
>> > need to provide it explicitly? One could imagine writing 123.456 
>> > HOOL {} @@ 789.10 USD 
>>
>> You can write: 
>>
>>     Assets:Investments           123.456 HOOL {{789.10 USD}} 
>>
>> I think this is missing from the Language Syntax document, but I do see 
> now that it's listed in the Syntax Cheat Sheet.
>  
>
>> beancount will covert from 789.10 USD to a per share price internally: 
>>
>> 2019-01-18 *   Bought  123.456 HOOL {6.39 USD} 
>> 2019-01-18 *   Bought -789.100 USD 
>>
>> > 2. The documentation sometimes shows a 2- or 3-tuple for the lot 
>> > definition, including date. Can an explicit date be given when the lot 
>> is 
>> > acquired, separate from the date of the transaction. That is, can I 
>> have an 
>> > Equity:Opening-Balance type entry with a transaction date of 2016-01-01 
>> > (when I started keeping books) and a lot date of, e.g., 2013-05-13 
>>
>> Yes. 
>>
>> 2016-01-01 * "Bought" 
>>     Assets:Investments           123.456 HOOL {{789.10 USD, 2013-05-10}} 
>>     Equity:Opening-Balance 
>>
>> Okay, I found an example of explicitly dating the purchase in Trading 
> with Beancount, and eventually explicit wording about overriding the date 
> in How Inventories Work. It's listed in the Cheat Sheet as well. But again, 
> I can't find any reference to it in Language Syntax, which seems peculiar.
>
> Anyhow, thanks for your help!
>  
>
>> -- 
>> Martin Michlmayr 
>> https://www.cyrius.com/ 
>>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/10838fe5-59f7-4ba8-b198-380765df372b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to