ores.marketdata.series_classification_rule
Table of Contents
The taxonomy rule for a market series, one row per identity the runtime classifies. The runtime reads the whole table once, builds a classifier from it, and asks that classifier for the asset classes and the series subclass of every series it creates.
The table replaces a compiled C++ map, so the taxonomy is managed like every other catalogue: an instrument a corpus adds later, or one a user brings, is an inserted row rather than a rebuild. This matters because an ingest that cannot classify a series it must create aborts on it, so a compiled table makes every new instrument a code change.
The key is the oresmd identity and not an ORE key. Two kinds of identity reach
this table, and key_kind says which a row is keyed by:
datum, keyed byinstrument– the text the URI writes underinstrument, such asir_swapordiscount– and byquote, the text it writes underquote, or the empty string for a rule that applies to every quote of its instrument. Most instruments classify the same way whatever their quote carries, so their row holds the empty string; a lookup tries the exact quote first and falls back to the empty one.index, keyed byinstrumenttoo, which for this kind holds the index family's oresmd name or the empty string for every family. A fixing series is an index and not a datum, so it is keyed by the index's own vocabulary.
asset_class_source says where a row's classes come from:
literalnames its class inasset_class_code.correlation_operandsreads the classes from the two operand fields of a correlation datum, because a pairwise correlation belongs to the two classes it relates and to no class of its own.index_authorityreads the class from the index family's schema row, whose asset authority names the market-data namespace the index is written in, andores.refdata.asset_class_cataloguemaps that authority onto a refdata class. One row serves every index family, and a family the catalogue maps to no class leaves the class list empty rather than mis-classing the series.
The class codes name rows in refdata.asset_class_code and the subclass codes
name rows in refdata.series_subclass_code, and the insert trigger checks both
against those catalogues.
The reader rejects an empty table, because an empty table aborts the first ingest that reads it and the message should name the table rather than the first series it met.
1. Flags
2. Columns
2.1. instrument
The identity's instrument, as the URI writes it under instrument, in lower
case: ir_swap, discount, correlation for a datum; the index family's name
such as ibor for an index, or the empty string for a rule that speaks for
every family. An empty instrument is the one honest "any" this table states, and
only an index row uses it: a datum's identity always names its instrument.
std::string("ir_swap")
2.2. quote
The identity's quote, as the URI writes it under quote, in lower case, or the
empty string for a rule that applies to every quote of its instrument. An index
has no quote and holds the empty string.
A lookup tries the exact quote first and falls back to the empty one.
std::string("rate")
2.3. key_kind
Which kind of oresmd identity this rule is keyed by: datum for a market datum
and index for a market index, which is what a fixing series is.
Examples: 'datum', 'index'.
std::string("datum")
2.4. asset_class_source
How this rule obtains its asset classes: literal, correlation_operands
or index_authority.
A literal rule names its class in asset_class_code. A correlation rule reads
the classes from the two operand fields of the datum, because a pairwise
correlation belongs to the two classes it relates and to no class of its own.
An index_authority rule reads the class from the index family's own schema
row: one index row serves every family, and the class cannot be a literal
because the corpus carries rates, equity, commodity, power, inflation, security
and generic fixings alike.
std::string("literal")
2.5. asset_class_code
Code of the asset class this type measures, from
refdata.asset_class_code.
Null on a correlation rule, which names no class of its own, and on a rule whose classes come from the key. The column is nullable rather than empty because null is the honest "no class here", and the insert trigger validates a code only where one is set.
[idx]{ constexpr auto count = sizeof(domain::asset_class_codes) / sizeof(domain::asset_class_codes[0]); return std::string(domain::asset_class_codes[static_cast<std::size_t>(idx) % count]); }()
2.6. series_subclass_code
Code of the series subclass this type belongs to, from
refdata.series_subclass_code.
Example: 'spot' for FX, 'index_fixing' for FIXING, 'correlation' for CORRELATION.
[idx]{ static constexpr std::string_view subclasses[] = { "spot", "forward", "volatility", "yield", "basis", "fra", "xccy", "spread", "index_credit", "recovery", "swap", "capfloor", "seasonality", "price", "correlation", "prepayment", "transition_probability", "index_fixing"}; return std::string(subclasses[static_cast<std::size_t>(idx) % std::size(subclasses)]); }()
2.7. description
Why the identity carries this taxonomy, and the evidence behind it.
Example: 'The two operands of a correlation datum name the classes it relates; the subclass is the correlation itself.'
3. SQL
3.1. Flags
3.2. Checks
| expression |
|---|
| "key_kind" in ('datum', 'index') |
| "asset_class_source" in ('literal', 'correlation_operands', 'index_authority') |
| ("asset_class_source" <> 'literal') or ("asset_class_code" is not null) |
| ("asset_class_source" = 'literal') or ("asset_class_code" is null) |
4. Insert trigger
4.1. Validations
| column | validation_function |
|---|---|
| asset_class_code | ores_refdata_validate_asset_class_code_fn |
| series_subclass_code | ores_refdata_validate_series_subclass_code_fn |
| change_reason_code | ores_dq_validate_change_reason_fn |
5. C++
5.1. Flags
5.2. Repository
5.3. Domain includes
#include "ores.marketdata.api/domain/asset_class_authorities.hpp" #include <optional> #include <string>
5.4. Entity includes
#include <optional> #include <string>
5.5. Conventions
5.6. Table display
| column | header |
|---|---|
| key_kind | Key Kind |
| instrument | Instrument |
| quote | Quote |
| asset_class_source | Asset Class Source |
| asset_class_code | Asset Class |
| series_subclass_code | Series Subclass |
| description | Description |
| modified_by | Modified By |
| version | Version |
5.7. Custom repository methods
6. See also
- A pillar names the market series it reads — the decision that moved the runtime's identity off the ORE key and onto the oresmd URI, of which this key is the catalogue's half.
- market_series_asset_class — the junction these rules populate for each series an import creates.
- Asset classes — the
taxonomy the
asset_class_codecolumn references, and the convention the correlation operands are named by.