ores.cpp.oresmd.identifiers
Table of Contents
The market_data_identifier and market_data_requirement structs: one per
asset class, with quote_type and vol fields. Existing structs that
already have asset-class-specific fields beyond the oresmd common ones are
reproduced exactly; the template generates the full file including the
variant using declaration.
See the Template variable reference.
1. Template
{{! GENERATED FILE — tangled from ores.cpp.oresmd.identifiers.org. Edit the org source. }}
{{{cpp_license}}}
#ifndef ORES_MARKETDATA_API_DOMAIN_MARKET_DATA_IDENTIFIER_HPP
#define ORES_MARKETDATA_API_DOMAIN_MARKET_DATA_IDENTIFIER_HPP
#include "ores.marketdata.api/domain/oresmd_enums.hpp"
#include <optional>
#include <string>
#include <variant>
namespace ores::marketdata::domain {
/**
* @brief Volatility surface point: expiry, strike, and model subtype — the three dimensions
* shared across all 8 ORE volatility sub-families. Only meaningful when `type=vol`.
*/
struct volatility_surface_point final {
std::string expiry;
std::string strike;
volatility_model_subtype model_subtype = volatility_model_subtype::rate_lnvol;
bool operator==(const volatility_surface_point&) const = default;
};
{{#oresmd_variant_specs}}
{{#identifier_brief}}
/**
* @brief {{{identifier_brief}}}
*/
{{/identifier_brief}}
struct {{asset_class}}_market_data_identifier final {
{{#fields}}
{{#default}}
{{{cpp_type}}} {{name}} = {{default}};
{{/default}}
{{^default}}
{{^generated}}
{{{cpp_type}}} {{name}};
{{/generated}}
{{/default}}
{{/fields}}
{{#has_quote_type}}
std::optional<domain::{{asset_class}}_quote_type> quote_type;
{{/has_quote_type}}
{{#has_point}}
std::optional<std::string> point;
{{/has_point}}
{{#has_vol}}
std::optional<volatility_surface_point> vol;
{{/has_vol}}
bool operator==(const {{asset_class}}_market_data_identifier&) const = default;
};
{{/oresmd_variant_specs}}
/**
* @brief Tagged union of the seven per-asset-class identifier structs.
*
* Deliberately *not* a common base class with virtual dispatch: the URI's `asset_class`
* authority component already tells a consumer which concrete struct applies, and
* reflection-based serialisation (`rfl`/reflect-cpp) handles plain structs and
* `std::variant` well but not polymorphic hierarchies -- see
* id:C3E053CA-0D4B-480B-9119-E11530160EC1, "Data model".
*/
using market_data_identifier = std::variant<
{{#oresmd_variant_specs}}
{{asset_class}}_market_data_identifier{{^last}},{{/last}}
{{/oresmd_variant_specs}}
>;
}
#endif