ores.refdata.portfolio
Table of Contents
Represents organizational, risk, or reporting groupings. Never holds trades directly. Supports hierarchical structure via self-referencing parent_portfolio_id.
Flags
:seed_currency:: the eventing integration test writes a synthetic
portfolio whose aggregation currency the generator hardcodes as the
synthetic currency generator's first code (X-0); the portfolios insert
trigger validates aggregation_ccy against the active currencies for
the write tenant — the test must seed that currency row.
Columns
id
UUID uniquely identifying this portfolio.
Surrogate key for the portfolio record.
party_id
Party that owns this portfolio.
Set server-side from the authenticated session. Enforced by RLS.
ctx.generate_uuid()
name
Human-readable name for the portfolio.
e.g., 'Global Rates', 'APAC Credit'.
std::string(faker::company::companyName()) + " Portfolio"
description
Optional free-text description of the portfolio.
std::string(faker::lorem::sentence())
parent_portfolio_id
Self-referencing FK. NULL indicates a root node.
Links to the parent portfolio in the hierarchy.
std::nullopt
owner_unit_id
Business unit responsible for management.
References the business_units table.
// Left null: optional FK, and the insert trigger rejects ids that do // not name an active business unit. std::nullopt
purpose_type
Portfolio purpose classification.
References purpose_types lookup (Risk, Regulatory, ClientReporting, Internal). Defaults to
Risk so a freshly-constructed portfolio (the Add dialog, before the
Purpose Type combo's async populate completes) always carries a value the
FK-validation trigger accepts.
std::string("Risk")
aggregation_ccy
Currency for P&L/risk aggregation at this node.
ISO 4217 currency code.
// "X-0" is the first code the synthetic currency generator emits: the // aggregation-currency validation accepts only codes of active // currencies, and every test tenant inherits the system tenant's // accumulated active set, which always contains X-0 (every generator // process starts its counter at zero). std::string("X-0")
is_virtual
If true, node is purely for on-demand reporting.
Not persisted in trade attribution when virtual.
false
status
Current lifecycle status (Active, Inactive, Closed). No dedicated
lookup table exists yet (unlike book_status) – a fixed three-value
list, defaulting to Active for the same reason as
purpose_type=/book's =book_status: a freshly-constructed portfolio
always carries a value.
std::string("Active")
SQL
Flags
Foreign keys
aggregation_ccy
party_id
parent_portfolio_id
Self-referencing: a portfolio's own writes recursively bump its parent portfolio's version too (multi-level composite-entity versioning), so that a nested tree's top-level "as of version N" composition sees every descendant's state as of that same instant – not just its immediate children. NULL (root node) safely no-ops: the touch function's row lookup finds nothing for a NULL id and returns without effect, terminating the recursion. See the "Temporal composite entity versioning" architecture doc, "Multi-level composition".
owner_unit_id
Insert trigger
Validations
| column | validation_function |
|---|---|
| purpose_type | ores_refdata_validate_purpose_type_fn |
| aggregation_ccy | ores_refdata_validate_currency_fn |
C++
Flags
Repository
Domain includes
#include <chrono> #include <optional> #include <string> #include <boost/uuid/uuid.hpp>
Entity includes
#include <string> #include "sqlgen/Timestamp.hpp" #include "sqlgen/PrimaryKey.hpp"
Conventions
Table display
| column | header |
|---|---|
| name | Name |
| purpose_type | Purpose |
| aggregation_ccy | Currency |
| is_virtual | Virtual |
| modified_by | Modified By |
| version | Version |
Qt
Detail fields
parent_portfolio_id=/=owner_unit_id (optional UUID FKs) are not
exposed here, matching book's owner_unit_id precedent – neither
codegen entity has an entity-picker combo widget yet.
| field | label | widget | type | is_key | is_required | placeholder | flag_source | combo_allow_blank | combo_fetch | combo_domain_type | combo_fetch_include | combo_fetch_fn | combo_watcher_name | combo_code_field | combo_tooltip_field | combo_sort_field | combo_label | combo_setter_pascal | combo_values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | Id | idEdit | line_edit | true | true | Portfolio id | |||||||||||||
| name | Name | nameEdit | line_edit | true | Enter portfolio name | ||||||||||||||
| purpose_type | Purpose Type | purposeTypeCombo | dynamic_combo | refdata::domain::purpose_type | ores.qt/LookupFetcher.hpp | fetch_purpose_types | purposeTypeWatcher | code | description | display_order | purpose types | PurposeTypeCombo | |||||||
| status | Status | statusCombo | static_combo | Active,Inactive,Closed,Frozen,Pending | |||||||||||||||
| is_virtual | Virtual | isVirtualCheckBox | check_box | ||||||||||||||||
| aggregation_ccy | Aggregation Currency | aggregationCcyEdit | flagged_combo | currency | |||||||||||||||
| description | Description | descriptionEdit | text_edit | Enter description (optional) |
Columns (Qt model)
| enum_name | field | header | type | width | is_badge | badge_key |
|---|---|---|---|---|---|---|
| Name | name | Name | string | 250 | ||
| PurposeType | purpose_type | Purpose | string | 120 | ||
| Status | status | Status | string | 100 | true | portfolio_status |
| AggregationCcy | aggregation_ccy | Agg. Currency | string | 120 | ||
| IsVirtual | is_virtual | Virtual | bool | 70 | true | is_virtual |
| Version | version | Version | int | 80 | ||
| ModifiedBy | modified_by | Modified By | string | 120 | ||
| RecordedAt | recorded_at | Recorded At | timestamp | 150 |
Icon columns (Qt model)
| column | accessor | field1 | field2 |
|---|---|---|---|
| AggregationCcy | currency_flag_icon | aggregation_ccy |
Custom repository methods
See also
- ores.refdata — component group overview.