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 instrument_id;
54
58 boost::uuids::uuid party_id;
59
65 std::optional<boost::uuids::uuid> trade_id;
66
70 std::string trade_type_code;
71
75 std::string reference_entity;
76
80 std::string currency;
81
85 double notional = 0.0;
86
90 double spread = 0.0;
91
95 double recovery_rate = 0.0;
96
100 std::string tenor;
101
105 std::string start_date;
106
110 std::string maturity_date;
111
115 std::string day_count_code;
116
121
126 std::string index_name;
127
133
138 std::string seniority;
139
144 std::string restructuring;
145
149 std::string description;
150
154 std::string modified_by;
155
159 std::string performed_by;
160
165
169 std::string change_commentary;
170
174 std::chrono::system_clock::time_point recorded_at;
175
176 // -------------------------------------------------------------------------
177 // Phase 7 extensions: CreditDefaultSwapOption, CreditLinkedSwap, CBO
178 // -------------------------------------------------------------------------
179
184 std::string option_type;
185
190
194 std::optional<double> option_strike;
195
199 std::string linked_asset_code;
200
204 std::optional<double> tranche_attachment;
205
209 std::optional<double> tranche_detachment;
210};
211
212}
213
214#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:184
std::string modified_by
Username of the person who last modified this record.
Definition credit_instrument.hpp:154
std::optional< double > tranche_detachment
CBO tranche detachment point as decimal. Null when not set.
Definition credit_instrument.hpp:209
boost::uuids::uuid instrument_id
UUID uniquely identifying this credit instrument.
Definition credit_instrument.hpp:53
std::optional< boost::uuids::uuid > trade_id
UUID of the associated trade record.
Definition credit_instrument.hpp:65
std::string start_date
Start date (ISO 8601 date string, e.g. 2026-01-15).
Definition credit_instrument.hpp:105
std::string change_commentary
Free-text commentary explaining the change.
Definition credit_instrument.hpp:169
int index_series
Optional index series number for CDSIndex trades. Zero means not specified.
Definition credit_instrument.hpp:132
double notional
Notional amount of the credit instrument.
Definition credit_instrument.hpp:85
std::string restructuring
Optional restructuring clause (e.g. "MM", "MR", "CR", "XR"). Empty if not applicable.
Definition credit_instrument.hpp:144
std::string description
Optional free-text description.
Definition credit_instrument.hpp:149
double recovery_rate
Recovery rate as a decimal (e.g. 0.4 for 40%).
Definition credit_instrument.hpp:95
std::string linked_asset_code
Reference asset code for CreditLinkedSwap. Empty otherwise.
Definition credit_instrument.hpp:199
double spread
Credit spread in basis points (e.g. 100.0 for 100 bps).
Definition credit_instrument.hpp:90
std::string index_name
Optional index name for CDSIndex trades (e.g. "CDX.NA.IG"). Empty for non-index products.
Definition credit_instrument.hpp:126
boost::uuids::uuid party_id
Party that owns this instrument.
Definition credit_instrument.hpp:58
std::chrono::system_clock::time_point recorded_at
Timestamp when this version of the record was recorded.
Definition credit_instrument.hpp:174
std::string payment_frequency_code
Payment frequency code (e.g. Quarterly, SemiAnnual).
Definition credit_instrument.hpp:120
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:115
std::optional< double > tranche_attachment
CBO tranche attachment point as decimal. Null when not set.
Definition credit_instrument.hpp:204
std::string maturity_date
Maturity date (ISO 8601 date string, e.g. 2031-01-15).
Definition credit_instrument.hpp:110
std::string performed_by
Username of the account that performed this action.
Definition credit_instrument.hpp:159
std::string reference_entity
Name or identifier of the reference entity.
Definition credit_instrument.hpp:75
std::optional< double > option_strike
Option strike spread in bps for CDS options. Null when not set.
Definition credit_instrument.hpp:194
std::string tenor
Tenor of the instrument (e.g. "5Y", "3Y").
Definition credit_instrument.hpp:100
std::string seniority
Optional seniority (e.g. "Senior", "Subordinated"). Empty if not applicable.
Definition credit_instrument.hpp:138
std::string trade_type_code
ORE product type code (CreditDefaultSwap, CDSIndex, SyntheticCDO).
Definition credit_instrument.hpp:70
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:164
std::string currency
ISO 4217 currency code (e.g. USD).
Definition credit_instrument.hpp:80
std::string option_expiry_date
Option expiry date (ISO 8601) for CDS options. Empty otherwise.
Definition credit_instrument.hpp:189
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