ORE Studio 0.0.4
Loading...
Searching...
No Matches
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_INSTRUMENT_HPP
21#define ORES_TRADING_DOMAIN_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
40struct instrument final {
44 int version = 0;
45
50
54 boost::uuids::uuid id;
55
62 std::string trade_type_code;
63
67 double notional = 0.0;
68
72 std::string currency;
73
77 std::string start_date;
78
82 std::string maturity_date;
83
87 std::string description;
88
92 std::string modified_by;
93
97 std::string performed_by;
98
103
107 std::string change_commentary;
108
112 std::chrono::system_clock::time_point recorded_at;
113
114 // -------------------------------------------------------------------------
115 // Phase 7 extensions: FRA, BalanceGuaranteedSwap, CallableSwap,
116 // KnockOutSwap, RiskParticipationAgreement, InflationSwap
117 // -------------------------------------------------------------------------
118
122 std::string fra_fixing_date;
123
129
134 std::optional<int> lockout_days;
135
141
146 std::string rpa_counterparty;
147
153
157 std::optional<double> base_cpi;
158};
159
160}
161
162#endif
Parent instrument record holding economic terms for a trade.
Definition instrument.hpp:40
std::string modified_by
Username of the person who last modified this record.
Definition instrument.hpp:92
std::string start_date
Date from which the instrument is effective (ISO 8601).
Definition instrument.hpp:77
std::string change_commentary
Free-text commentary explaining the change.
Definition instrument.hpp:107
double notional
Principal notional amount.
Definition instrument.hpp:67
std::string description
Optional free-text description.
Definition instrument.hpp:87
std::string fra_settlement_date
Settlement date for ForwardRateAgreement (ISO 8601). Empty otherwise.
Definition instrument.hpp:128
std::string fra_fixing_date
Fixing date for ForwardRateAgreement (ISO 8601). Empty otherwise.
Definition instrument.hpp:122
std::chrono::system_clock::time_point recorded_at
Timestamp when this version of the record was recorded.
Definition instrument.hpp:112
std::string inflation_index_code
Inflation index code for InflationSwap (e.g. HICP, RPI). Empty otherwise.
Definition instrument.hpp:152
std::optional< int > lockout_days
Lockout days for BalanceGuaranteedSwap / KnockOutSwap. Null when not set.
Definition instrument.hpp:134
boost::uuids::uuid id
UUID uniquely identifying this instrument.
Definition instrument.hpp:54
int version
Version number for optimistic locking and change tracking.
Definition instrument.hpp:44
std::string rpa_counterparty
Reference counterparty code for RiskParticipationAgreement. Empty otherwise.
Definition instrument.hpp:146
std::string maturity_date
Maturity/termination date of the instrument (ISO 8601).
Definition instrument.hpp:82
std::string performed_by
Username of the account that performed this action.
Definition instrument.hpp:97
std::optional< double > base_cpi
Base CPI level for InflationSwap. Null when not set.
Definition instrument.hpp:157
std::string trade_type_code
ORE product type code discriminating the asset class.
Definition instrument.hpp:62
utility::uuid::tenant_id tenant_id
Tenant identifier for multi-tenancy isolation.
Definition instrument.hpp:49
std::string callable_dates_json
JSON array of call dates for CallableSwap. Empty otherwise.
Definition instrument.hpp:140
std::string change_reason_code
Code identifying the reason for the change.
Definition instrument.hpp:102
std::string currency
ISO 4217 currency code for the notional (e.g. USD, EUR).
Definition instrument.hpp:72
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