The oresmd datum identity

Table of Contents

1. Summary

A datum is the thing a market data value is a value of. It is written as an oresmd URI by oresmd_uri_codec, in ores.marketdata.core/datum/oresmd_uri_codec.hpp. The note oresmd: ORE Studio Market Data URI states the URI grammar. This note states the datum the URI names.

2. Detail

2.1. The schema row is the authority

A datum is built only through market_datum::make or market_datum::make_series, both declared in ores.marketdata.api/datum/market_datum.hpp. Each checks its fields against the schema row for the instrument type and quote type. Refused are a field the row does not list, a field given twice, a field the row lists and the input leaves out, none in a field the row says is never none, a value of the wrong type, and a code outside its field's vocabulary. The constructors are private, so a market_datum value always matches its schema.

This is why the codec has no code per instrument type. It walks the datum's schema row, so a new instrument type is a schema row rather than a codec branch.

2.2. Series against datum

A series holds only the row's identity fields, so every datum of one series has the same series. A datum holds every field of the row, with none where the key leaves one out. series_of moves from a datum to its series, and the ingest loop calls it to name the series a tick belongs to.

2.3. The canonical write

ore_key_codec, in ores.marketdata.core/datum/ore_key_codec.hpp, reads and writes ORE's own key text. Its reader follows ORE's parseMarketDatum form by form, so every key form ORE accepts is accepted here, each token goes to the field ORE puts it in, and a field is chosen by what a token is rather than by where it sits.

Two facts about the write are worth keeping. First, write(read(k)) returns k except when the key spells its instrument or quote type with an alias that ORE also reads, such as FX_SPOT for FX, in which case the canonical spelling is written. Second, two kinds of key ORE accepts are refused, because the datum could not write them back. They are a key with tokens ORE ignores, such as a trailing token after a cap or floor shift, and a numeric slot holding text that ORE's own number reader would read only in part.

2.4. The fact the code shape does not show

Values compare by the text the key carried and not by what it denotes. A strike of 1.0 and a strike of 1.00 are different datums and different series, because they are different keys. The strict reader refuses any text other than the writer's own spelling, so one datum has one URI and stored URIs compare as text.

3. See also

Emacs 29.3 (Org mode 9.6.15)