ores.marketdata.market_fixing
Table of Contents
A historical index fixing: the official value of a fixing index (identified via
series_id) on a given fixing_date. Separate from observations: fixings are
historical facts (e.g. EUR-EURIBOR-3M fixed at X on date Y) rather than
forward-looking curve points.
TimescaleDB hypertable partitioned by fixing_date with 30-day chunks.
Corrections use the soft-update/soft-delete pattern (no GIST, no DELETE RULEs).
No audit trail columns — volume makes them impractical.
1. Flags
2. Columns
2.1. id
Surrogate UUID uniquely identifying this fixing row.
2.2. party_id
Party that owns this fixing.
Set server-side from the authenticated session. Enforced by RLS.
ctx.generate_uuid()
2.3. series_id
Reference to ores_marketdata_market_series_tbl(id) — identifies the fixing index.
2.4. fixing_date
Calendar date on which the index was fixed. Also the hypertable partition column.
std::chrono::year_month_day{std::chrono::floor<std::chrono::days>(ctx.past_timepoint())}
2.5. value
Serialised fixing value (numeric string).
std::to_string(faker::number::decimal<double>(0.0, 100.0))
2.6. source
Source tag identifying the feed or authority that published this fixing.
3. SQL
3.1. Flags
3.2. Checks
| expression |
|---|
| "value" <> '' |
3.3. Bitemporal natural keys
| column | nullable |
|---|---|
| party_id | false |
| series_id | false |
| fixing_date | false |
3.4. Indexes
| name | columns | unique | current_only | where_extra |
|---|---|---|---|---|
| fixings_current_uniq | tenant_id, party_id, series_id, fixing_date | true | true | |
| fixings_series_date | tenant_id, party_id, series_id, fixing_date desc | false | false | |
| fixings_tenant_date | tenant_id, party_id, fixing_date desc | false | false | |
| fixings_source | tenant_id, party_id, source, fixing_date desc | false | false | source is not null |
4. C++
4.1. Flags
4.2. Repository
4.2.1. read_latest_for_series
Reads every current fixing of one series, in fixing date order. The ORE export walks a tenant's fixing series and writes each one's fixings.
std::vector<domain::market_fixing> read_latest_for_series(context ctx, const boost::uuids::uuid& series_id);
#include <boost/uuid/uuid_io.hpp> #include <string>
std::vector<domain::market_fixing> market_fixing_repository::read_latest_for_series(context ctx, const boost::uuids::uuid& series_id) { BOOST_LOG_SEV(lg(), debug) << "Reading latest fixings for series: " << series_id; static constexpr auto max = db_timestamp::max(); const auto tid = ctx.tenant_id().to_string(); const auto sid = boost::uuids::to_string(series_id); const auto query = query_builder::read<std::vector<market_fixing_entity>> | query_builder::where("tenant_id"_c == tid && "series_id"_c == sid && "valid_to"_c == max) | query_builder::order_by("fixing_date"_c); return query_builder::execute_read_query<market_fixing_entity, domain::market_fixing>( ctx, query, [](const auto& entities) { return market_fixing_mapper::map(entities); }, lg(), "Reading latest market fixings."); }
4.3. Domain includes
#include <chrono> #include <boost/uuid/uuid.hpp> #include <string>
4.4. Entity includes
#include <optional> #include <string>