On Wed, Aug 04, 2010 at 02:38:15PM -0400, John Wiegley wrote:
> > I have a retirement account that has "shares" where the number of shares
> > is reported to me in four decimal places. The share price is done in
> > dollars, also computed out to four decimal places. To get all this setup
> > correctly in Ledger my currency amounts in US dollars are now computed
> > to eight decimal places, no joke.
>
> Can you show me an example transaction? There are places where Ledger
> "observes" precision, and places where it doesn't. There may be a way
> to rewrite your transaction so as to avoid the problem you're seeing.
Sure, this captures what I'm doing in my ledger:
2010/08/04 Paycheck
Income:Salary $-104.38
Assets:TSP
2010/08/04 TSP Share Purchase
Assets:TSP 10.3297 C @ $10.1048
Assets:TSP $-104.38
Equity:Rounding Error:TSP
Since the share purchases are specified in dollars rather than in round
share amounts, something gets rounded somewhere. I used to do them like
this:
2010/08/04 TSP Share Purchase
Assets:TSP 10.3297 C
Assets:TSP $-104.38
Then Ledger would compute a price per share on its own (which
necessarily differed just a tiny fraction from the published value.)
However hledger did not like this file format at all, and I went through
the c++ Ledger manual and didn't see any example like this, and it
occurred to me that the division would inevitably lead to
approximations. I wasn't sure how these rounding errors might accumulate
internally in Ledger. I suppose I could go back to the old way, though,
as my reports then didn't have eight decimal places. Thoughts? Thanks.
--Omari