ORE Studio 0.0.4
Loading...
Searching...
No Matches
commodity_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_COMMODITY_INSTRUMENT_HPP
21#define ORES_TRADING_DOMAIN_COMMODITY_INSTRUMENT_HPP
22
23#include <chrono>
24#include <optional>
25#include <string>
26#include <boost/uuid/uuid.hpp>
27#include "ores.utility/uuid/tenant_id.hpp"
28
29namespace ores::trading::domain {
30
52 int version = 0;
53
58
62 boost::uuids::uuid instrument_id;
63
67 boost::uuids::uuid party_id;
68
74 std::optional<boost::uuids::uuid> trade_id;
75
79 std::string trade_type_code;
80
84 std::string commodity_code;
85
89 std::string currency;
90
94 double quantity = 0.0;
95
99 std::string unit;
100
104 std::string start_date;
105
109 std::string maturity_date;
110
114 std::optional<double> fixed_price;
115
119 std::string option_type;
120
124 std::optional<double> strike_price;
125
129 std::string exercise_type;
130
134 std::string average_type;
135
140
145
150
154 std::optional<double> spread_amount;
155
160
164 std::optional<double> variance_strike;
165
169 std::optional<double> accumulation_amount;
170
174 std::optional<double> knock_out_barrier;
175
179 std::string barrier_type;
180
184 std::optional<double> lower_barrier;
185
189 std::optional<double> upper_barrier;
190
194 std::string basket_json;
195
199 std::string day_count_code;
200
205
210
214 std::string description;
215
219 std::string modified_by;
220
224 std::string performed_by;
225
230
234 std::string change_commentary;
235
239 std::chrono::system_clock::time_point recorded_at;
240};
241
242}
243
244#endif
Commodity instrument economics for all commodity ORE product types.
Definition commodity_instrument.hpp:48
std::string option_type
Option type: 'Call' or 'Put'. Empty for non-option products.
Definition commodity_instrument.hpp:119
std::string modified_by
Username of the person who last modified this record.
Definition commodity_instrument.hpp:219
std::string commodity_code
Commodity identifier code (e.g. NGAS, WTI, GOLD).
Definition commodity_instrument.hpp:84
std::string spread_commodity_code
Second commodity code for spread options.
Definition commodity_instrument.hpp:149
std::string unit
Unit of measure for the commodity (e.g. BBL, MMBTU, MT).
Definition commodity_instrument.hpp:99
boost::uuids::uuid instrument_id
UUID uniquely identifying this commodity instrument.
Definition commodity_instrument.hpp:62
std::optional< boost::uuids::uuid > trade_id
UUID of the associated trade record.
Definition commodity_instrument.hpp:74
std::optional< double > knock_out_barrier
Knock-out barrier level for accumulator products.
Definition commodity_instrument.hpp:174
std::string exercise_type
Exercise type: 'European' or 'American'.
Definition commodity_instrument.hpp:129
std::string start_date
Start date for swaps, forwards, and strips.
Definition commodity_instrument.hpp:104
std::string change_commentary
Free-text commentary explaining the change.
Definition commodity_instrument.hpp:234
std::string description
Optional free-text description.
Definition commodity_instrument.hpp:214
double quantity
Contract quantity. Must be positive.
Definition commodity_instrument.hpp:94
std::optional< double > spread_amount
Spread amount for spread options. Nullopt when not applicable.
Definition commodity_instrument.hpp:154
std::optional< double > lower_barrier
Lower barrier level. Nullopt when not applicable.
Definition commodity_instrument.hpp:184
std::string swaption_expiry_date
Swaption expiry date for CommoditySwaption products.
Definition commodity_instrument.hpp:209
std::optional< double > variance_strike
Strike variance for variance swap products. Nullopt when not applicable.
Definition commodity_instrument.hpp:164
boost::uuids::uuid party_id
Party that owns this instrument.
Definition commodity_instrument.hpp:67
std::optional< double > upper_barrier
Upper barrier level. Nullopt when not applicable.
Definition commodity_instrument.hpp:189
std::string average_type
Averaging type for Asian options: 'Arithmetic' or 'Geometric'.
Definition commodity_instrument.hpp:134
std::optional< double > accumulation_amount
Per-fixing accumulation amount for accumulator products.
Definition commodity_instrument.hpp:169
std::string strip_frequency_code
Strip frequency code for option strips (e.g. Monthly, Quarterly).
Definition commodity_instrument.hpp:159
std::chrono::system_clock::time_point recorded_at
Timestamp when this version of the record was recorded.
Definition commodity_instrument.hpp:239
std::string averaging_start_date
Start of the averaging window for Asian options.
Definition commodity_instrument.hpp:139
std::optional< double > strike_price
Option strike price. Nullopt for non-option products.
Definition commodity_instrument.hpp:124
std::string basket_json
JSON array of {code, weight} constituents for basket products.
Definition commodity_instrument.hpp:194
std::string payment_frequency_code
Payment frequency code for swap products.
Definition commodity_instrument.hpp:204
int version
Version number for optimistic locking and change tracking.
Definition commodity_instrument.hpp:52
std::string day_count_code
Day count fraction code for swap products.
Definition commodity_instrument.hpp:199
std::optional< double > fixed_price
Fixed price for forwards and fixed-leg swaps. Nullopt if not applicable.
Definition commodity_instrument.hpp:114
std::string maturity_date
Maturity/expiry date.
Definition commodity_instrument.hpp:109
std::string performed_by
Username of the account that performed this action.
Definition commodity_instrument.hpp:224
std::string trade_type_code
ORE product type code (CommodityForward, CommodityOption, etc.).
Definition commodity_instrument.hpp:79
utility::uuid::tenant_id tenant_id
Tenant identifier for multi-tenancy isolation.
Definition commodity_instrument.hpp:57
std::string change_reason_code
Code identifying the reason for the change.
Definition commodity_instrument.hpp:229
std::string currency
ISO 4217 currency code.
Definition commodity_instrument.hpp:89
std::string averaging_end_date
End of the averaging window for Asian options.
Definition commodity_instrument.hpp:144
std::string barrier_type
Barrier type: e.g. 'UpIn', 'UpOut', 'DownIn', 'DownOut'.
Definition commodity_instrument.hpp:179
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