ores.trading.synthetic_cdo_instrument
Table of Contents
Represents the product facts of a SyntheticCDO trade: the qualifier, the protection start and the tranche. The tranche points and the recovery rate are continuous quantities, so they are binary floats.
This row is the family's fact table, not its identity. The header,
ores.trading.credit_instrument, 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. qualifier
The qualifier of the CDO, from the required Qualifier element.
std::string("ACME")
2.4. protection_start_date
The protection start date, from the required ProtectionStart element.
std::chrono::year_month_day{std::chrono::year{2026}/1/15}
2.5. attachment_point
The tranche attachment point as a fraction of the pool.
0.03
2.6. detachment_point
The tranche detachment point as a fraction of the pool.
0.07
2.7. recovery_rate
The fixed recovery rate as a fraction. Null when the document states none.
2.8. settles_accrual
Whether the accrued premium settles on default, from SettlesAccrual. Null when the document states none.
2.9. rebates_accrual
Whether the accrued premium is rebated, from RebatesAccrual. Null when the document states none.
2.10. pays_at_default_time
Whether the protection pays at the default time, from PaysAtDefaultTime. Null when the document states none.
2.11. protection_payment_time
When the protection payment falls, from ProtectionPaymentTime (e.g. atDefault). Null when the document states none.
2.12. upfront_date
The date the upfront fee is paid, from UpfrontDate. Null when the document states none.
2.13. upfront_fee
The upfront fee, from UpfrontFee. Money, so an exact decimal that keeps the digits the document wrote. Null when the document states none.
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 |
|---|
| "qualifier" <> '' |
| "attachment_point" >= 0 |
| "detachment_point" <= 1 |
| "detachment_point" >= "attachment_point" |
| "recovery_rate" is null or ("recovery_rate" >= 0 and "recovery_rate" <= 1) |
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.credit_instrument, 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 <optional> #include <string> #include <boost/uuid/uuid.hpp> #include "ores.utility/decimal/decimal.hpp"
5.4. Conventions
5.5. Table display
| column | header |
|---|---|
| trade_id | ID |
| qualifier | Qualifier |
| protection_start_date | Protection Start |
| attachment_point | Attachment |
| detachment_point | Detachment |
| upfront_fee | Upfront Fee |
| modified_by | Modified By |
| version | Version |
5.6. Custom repository methods
6. See also
- ores.trading — component group overview.