Canonical Representation of Commodity Identifiers

Christopher Browne cbbrowne@hex.net
Tue, 25 Jul 2000 20:49:31 -0500


On Mon, 24 Jul 2000 20:00:11 EST, the world broke into rejoicing as
Jon Trowbridge <trow@emccta.com>  said:
> On Mon, Jul 24, 2000 at 05:41:58PM -0500, Bill Gribble wrote:
> >   2. gnc_commodity knows the full name of the commodity
> >      ("International Business Machines", "US Dollars"), plus any
> >      mnemonic or nickname that is used for trading or quoting purposes
> >      ("IBM", "USD"), and the namespace in which the name is unique
> >      ("NYSE", "ISO-4217").
> 
> It is more than a problem of namespace collisions in some areas.  In
> the futures markets, there are *no* standard for the mnemonic/"symbol"
> used for the various markets.  The exchange might use one symbol, data
> vendors another, and different brokers will use another one still.
> 
> For example, my company's database shows that the Australian 3-year
> Gov't Bond contract traded on the Syndey Futures Exchange is
> alternatively known as HT, YS and YTT.  Orange Juice futures are known
> sometimes as OJ and sometimes as JO, depending on who you are talking
> to.  I could go on and on...
> 
> This is a pain in the ass in a number of different applications:
> processing historical price data from different data vendors, parsing
> electronically transmitted info from brokers, etc.
> 
> IMHO, the gnc_commodity API should show some flexibility in this area,
> rather than just mapping each commodity to one allegedly canonical
> abbreviation.

I don't think that the commodities are as "canonical" as people are
implying.

I would rather suggest that they are canonical _within the context
of a particular market._

-> RHAT stock trades _on NASDAQ_.
-> Royal Bank of Canada trades _on the Toronto Stock Exchange_.
-> Sony trades _on the Japanese Stock Exchange (Nikkei?)_.

Thus, if the commodity is given _two_ components, rather than one,
that can provide the context required in order for the amounts to become
"canonical" _within the market_.

I get my stock valuations by indicating that I own stock traded on
some exchange:
   add_stock("NVA", 100, -10.16, "TSE");
   --> Indicates I bought 100 shares of Nova, trading on the TSE, for
       $-10.16.  (This is a true statement despite sounding peculiar,
       there was a split, and Something Strange Happened.)

It might be fair to reference the commodity as "TSE:NVA"; I'd have no
trouble going along with either that, or referencing via the tuple
("TSE" "NVA").

I guess the open question is of what sort of "pattern matching" needs
to be done to disambiguate situations like HT versus YTT versus YS.

Are they all used in the _same_ context?  That is, ("My Broker" "HT")
is equivalent to ("My Broker" "YTT") is equivalent to ("My Broker"
"YS")?  Or are they used in different contexts, so that ("My Broker"
"HT") is equivalent to ("Your Broker" "YTT") and is equivalent to
("Sydney Stock Exchange" "YS")?
--
cbbrowne@hex.net - <http://www.hex.net/~cbbrowne/lsf.html>
I am not a number!
I am a free man!