DB design document

David Merrill dmerrill@lupercalia.net
Thu, 14 Dec 2000 09:27:07 -0500


On Wed, Dec 13, 2000 at 11:32:21PM -0800, Dave Peticolas wrote:
> 
> security: units of what is currently called 'damount' in splits
>           that belong to this account
> 
> currency: units of 'value' in splits that belong to this account
> 
> Neither currency or security should be stored as 3-character codes.
> They should be references to entries in the commodities table.

So currency means the unit of measure, e.g., 'USD'? But only world
currencies, not anything else (bonds, whatever)? Because they always
go in as securities.

Why isn't three characters sufficient for currency codes? It looks
like the existing code is using three characters; that's why I am.

And security means the actual security, as in the security code under
which the security is traded on the NYSE or NASDAQ? Which then also
links you to a 'securities' table where more information about the
security is recorded?

> security_scu & currency_scu: 'scu' is Smallest Convertable (I think)
>   Unit, the denominator used for amounts in security/currency.
>   Commodities have default scu's, but accounts can override them.
>   For example, you might have stock in two different brokerages.
>   One may track your shares to 4 decimal places, and another to
>   5 decimal places, even if they're the same shares. This is not
>   an academic example.

This is closely related to the whole rational number mechanism, right?
Is this the number that will appear in damount when a split is
recorded against this account?

> Note: we've considered moving currency to transactions. This may
>       still happen in the future.

Do you mean I should be prepared to add the currency_code field to the
transaction table? Shouldn't it be the split table?

Why would you do this? So you can have transactions in more than one
currency in a single account? Why would you need that capability?


-- 
Dr. David C. Merrill                     http://www.lupercalia.net
Linux Documentation Project                dmerrill@lupercalia.net
Collection Editor & Coordinator            http://www.linuxdoc.org
                                       Finger me for my public key

			Pittsburgh Driver's Test

(8) Pedestrians are

	(a) irrelevant.
	(b) communists.
	(c) a nuisance.
	(d) difficult to clean off the front grille.

The correct answer is (a).  Pedestrians are not in cars, so they are
totally irrelevant to driving; you should ignore them completely.