Mutual fund prices precision

Derek Atkins warlord at MIT.EDU
Tue Aug 4 11:21:13 EDT 2015


AC <gnucash at acarver.net> writes:

> As far as I've been able to tell from searching through the XML file,
> the price per share is stored in the price table where I do find the
> price being stored to six decimal places.  At the same time, the shares
> and the total cost are also stored in the XML file.
>
> Here's one of the records:
> <gnc:transaction version="2.0.0">
[snip]
> </gnc:transaction>
>
>
> Elsehwere the matching price record for the above transaction looks like
> this:
>
>     <price:commodity>
[snip]
>   </price>
>
>
> So all three entries are present.  The question is, if I have the parent

The price entry is only used for reporting.  It has no effect on the
register displays.

> account defined to be a bank with currency USD but a fraction of
> 1/100000 (instead of the default setting) and the actual fund account
> also defined to have a fraction 1/100000 why is the value recorded as
> only x/100 instead of x/100000 like I defined?  The parent currency
> account has this configuration:

Because there is no such thing as $0.001 so by definition you cannot
denote something in a non-existing currency denomination.  This is
enforced at a lower layer, which is why you see the rounded values when
you get GnuCash to display more significant digits than the currency
allows.

> <gnc:account version="2.0.0">
>   <act:name>Holding Parent Account</act:name>
>   <act:id type="guid">c344be16f8abf7b2977be1da33a462a7</act:id>
>   <act:type>BANK</act:type>
>   <act:commodity>
>     <cmdty:space>ISO4217</cmdty:space>
>     <cmdty:id>USD</cmdty:id>
>   </act:commodity>
>   <act:commodity-scu>100000</act:commodity-scu>
>   <act:non-standard-scu/>
> ...
>   <act:parent type="guid">81c93161a043b4cde6ae96c9cdc495e8</act:parent>
> </gnc:account>
>
> And the one line shows the fraction set to 100000.  But it seems to
> ignore that yet the table of accounts actually shows that many decimal
> places for that account.  I would have expected the transactions to
> honor that account's fractions and not the default for the currency.
> The price per share appears to behave that way.

See above.  The deep down logic limits to the SCU of the
currency/commodity.  The SCU of USD is 1/100, so you cannot denote
anything in USD smaller than $0.01.

> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-user mailing list