ores.trading.swaption_instrument
Table of Contents
Represents a swaption — an option granting the right to enter into an interest rate swap at a future date. Exercise type may be European, Bermudan, or American.
This row is the family's fact table, not its identity. The header,
ores.trading.rate_instruments, holds the trade type code, the party, the
instrument's start and maturity dates and its description; this table holds
only the product's own fields, and joins the header by trade_id.
1. Flags
2. Columns
2.1. trade_id
The trade this instrument belongs to, and the instrument's own key.
The trade id identifies both the trade and its instrument, so the instrument carries no identity of its own: this column is the key, and the trade it names gives the instrument its scope.
2.2. trade_activity_id
The activity that wrote this version.
2.3. expiry_date
Option expiry date.
ISO 8601 date string (YYYY-MM-DD).
std::chrono::year_month_day{std::chrono::year{2025}/6/15}
2.4. exercise_type
Exercise type: European, Bermudan, or American.
Determines when the option may be exercised.
Soft FK to ores_trading_exercise_types_tbl: the values are the closed ORE exerciseStyle set (European, Bermudan, American). PR 4 tightens the soft reference into a real foreign key.
std::string("European")
2.5. settlement_type
Settlement type: Cash or Physical.
Determines how the swaption is settled upon exercise.
Soft FK to ores_trading_settlement_types_tbl: the values are the closed ORE settlementType set (Physical, Cash). PR 4 tightens the soft reference into a real foreign key.
std::string("Physical")
2.6. long_short
Position direction: Long or Short.
Soft FK to ores_trading_long_short_types_tbl: the values are the closed ORE longShort set (Long, Short), which the SQL schema already states as a check. PR 4 tightens the soft reference into a real foreign key.
Indicates whether the party holds or writes the option.
std::string("Long")
3. Foreign keys
3.1. trade_id
The trade that carries this instrument. An instrument is written beside its trade, so a row cannot exist without one.
#include "ores.trading.api/generators/trade_generator.hpp" #include "ores.trading.core/repository/trade_repository.hpp"
{
auto anchor = ores::trading::generators::generate_synthetic_trade(ctx);
anchor.party_id = *party_ctx.party_id();
ores::trading::repository::trade_repository().write(party_ctx, anchor);
v.trade_id = anchor.id;
}
3.2. trade_activity_id
The activity that wrote this version. A database foreign key: the activity is immutable.
#include "ores.trading.api/generators/trade_activity_generator.hpp" #include "ores.trading.core/repository/trade_activity_repository.hpp"
{
auto activity = ores::trading::generators::generate_synthetic_trade_activity(ctx);
activity.party_id = *party_ctx.party_id();
ores::trading::repository::trade_activity_repository().write(party_ctx, activity);
v.trade_activity_id = activity.id;
}
4. SQL
4.1. Flags
4.2. Checks
| expression |
|---|
| "exercise_type" in ('European', 'Bermudan', 'American') |
| "settlement_type" in ('Cash', 'Physical') |
| "long_short" in ('Long', 'Short') |
5. C++
The C++ domain class is a fact table's: the two keys stay flat, the
implicit scaffolding columns carry the version and the tenant, and the
columns below are the product's own fields. The row carries no
instrument_identity and no audit member, because it carries neither the
identity nor the party: the header, ores.trading.rate_instruments, owns
both and this row joins it by trade_id. The SQL schema, DB entity and
column lists are unaffected. The entity templates consume these
annotations; domain and repository profiles regenerate correctly.
5.1. Flags
5.2. Repository
5.3. Domain includes
#include <chrono> #include <string> #include <boost/uuid/uuid.hpp>
5.4. Conventions
5.5. Table display
| column | header |
|---|---|
| trade_id | ID |
| expiry_date | Expiry Date |
| exercise_type | Exercise |
| settlement_type | Settlement |
| long_short | Long/Short |
| modified_by | Modified By |
| version | Version |
5.6. Custom repository methods
5.7. Write observation
The trade's economic digest observes every write of this component. The observer's specialisation must be visible where the repository writes, so the repository includes it.
#include "ores.trading.core/repository/trade_write_observation.hpp"
6. See also
- ores.trading — component group overview.