ORE Studio 0.0.4
Loading...
Searching...
No Matches
credit_instrument.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_TRADING_DOMAIN_CREDIT_INSTRUMENT_HPP
21#define ORES_TRADING_DOMAIN_CREDIT_INSTRUMENT_HPP
22
23#include <chrono>
24#include <string>
25#include <optional>
26#include <boost/uuid/uuid.hpp>
27#include "ores.utility/uuid/tenant_id.hpp"
28
29namespace ores::trading::domain {
30
39struct credit_instrument final {
43 int version = 0;
44
49
53 boost::uuids::uuid id;
54
58 std::string trade_type_code;
59
63 std::string reference_entity;
64
68 std::string currency;
69
73 double notional = 0.0;
74
78 double spread = 0.0;
79
83 double recovery_rate = 0.0;
84
88 std::string tenor;
89
93 std::string start_date;
94
98 std::string maturity_date;
99
103 std::string day_count_code;
104
109
114 std::string index_name;
115
121
126 std::string seniority;
127
132 std::string restructuring;
133
137 std::string description;
138
142 std::string modified_by;
143
147 std::string performed_by;
148
153
157 std::string change_commentary;
158
162 std::chrono::system_clock::time_point recorded_at;
163
164 // -------------------------------------------------------------------------
165 // Phase 7 extensions: CreditDefaultSwapOption, CreditLinkedSwap, CBO
166 // -------------------------------------------------------------------------
167
172 std::string option_type;
173
178
182 std::optional<double> option_strike;
183
187 std::string linked_asset_code;
188
192 std::optional<double> tranche_attachment;
193
197 std::optional<double> tranche_detachment;
198};
199
200}
201
202#endif
Credit instrument economics for CreditDefaultSwap, CDSIndex, SyntheticCDO, CreditDefaultSwapOption,...
Definition credit_instrument.hpp:39
std::string option_type
Option type: "Call" or "Put" — CreditDefaultSwapOption. Empty otherwise.
Definition credit_instrument.hpp:172
std::string modified_by
Username of the person who last modified this record.
Definition credit_instrument.hpp:142
std::optional< double > tranche_detachment
CBO tranche detachment point as decimal. Null when not set.
Definition credit_instrument.hpp:197
std::string start_date
Start date (ISO 8601 date string, e.g. 2026-01-15).
Definition credit_instrument.hpp:93
std::string change_commentary
Free-text commentary explaining the change.
Definition credit_instrument.hpp:157
int index_series
Optional index series number for CDSIndex trades. Zero means not specified.
Definition credit_instrument.hpp:120
double notional
Notional amount of the credit instrument.
Definition credit_instrument.hpp:73
std::string restructuring
Optional restructuring clause (e.g. "MM", "MR", "CR", "XR"). Empty if not applicable.
Definition credit_instrument.hpp:132
std::string description
Optional free-text description.
Definition credit_instrument.hpp:137
double recovery_rate
Recovery rate as a decimal (e.g. 0.4 for 40%).
Definition credit_instrument.hpp:83
std::string linked_asset_code
Reference asset code for CreditLinkedSwap. Empty otherwise.
Definition credit_instrument.hpp:187
double spread
Credit spread in basis points (e.g. 100.0 for 100 bps).
Definition credit_instrument.hpp:78
std::string index_name
Optional index name for CDSIndex trades (e.g. "CDX.NA.IG"). Empty for non-index products.
Definition credit_instrument.hpp:114
std::chrono::system_clock::time_point recorded_at
Timestamp when this version of the record was recorded.
Definition credit_instrument.hpp:162
std::string payment_frequency_code
Payment frequency code (e.g. Quarterly, SemiAnnual).
Definition credit_instrument.hpp:108
boost::uuids::uuid id
UUID uniquely identifying this credit instrument.
Definition credit_instrument.hpp:53
int version
Version number for optimistic locking and change tracking.
Definition credit_instrument.hpp:43
std::string day_count_code
Day count convention code (e.g. Actual365Fixed, Thirty360).
Definition credit_instrument.hpp:103
std::optional< double > tranche_attachment
CBO tranche attachment point as decimal. Null when not set.
Definition credit_instrument.hpp:192
std::string maturity_date
Maturity date (ISO 8601 date string, e.g. 2031-01-15).
Definition credit_instrument.hpp:98
std::string performed_by
Username of the account that performed this action.
Definition credit_instrument.hpp:147
std::string reference_entity
Name or identifier of the reference entity.
Definition credit_instrument.hpp:63
std::optional< double > option_strike
Option strike spread in bps for CDS options. Null when not set.
Definition credit_instrument.hpp:182
std::string tenor
Tenor of the instrument (e.g. "5Y", "3Y").
Definition credit_instrument.hpp:88
std::string seniority
Optional seniority (e.g. "Senior", "Subordinated"). Empty if not applicable.
Definition credit_instrument.hpp:126
std::string trade_type_code
ORE product type code (CreditDefaultSwap, CDSIndex, SyntheticCDO).
Definition credit_instrument.hpp:58
utility::uuid::tenant_id tenant_id
Tenant identifier for multi-tenancy isolation.
Definition credit_instrument.hpp:48
std::string change_reason_code
Code identifying the reason for the change.
Definition credit_instrument.hpp:152
std::string currency
ISO 4217 currency code (e.g. USD).
Definition credit_instrument.hpp:68
std::string option_expiry_date
Option expiry date (ISO 8601) for CDS options. Empty otherwise.
Definition credit_instrument.hpp:177
A strongly-typed wrapper around a UUID representing a tenant identifier.
Definition tenant_id.hpp:66
static tenant_id system()
Creates a tenant_id representing the system tenant.
Definition tenant_id.cpp:41