ores.refdata.counterparty_identifier

Table of Contents

External identifiers for counterparties, such as LEI codes, BIC/SWIFT codes, national registration numbers, and tax identifiers. Each counterparty can have multiple identifiers across different schemes.

1. Flags

2. Columns

2.1. id

UUID uniquely identifying this counterparty identifier.

Surrogate key for the counterparty identifier record.

2.2. counterparty_id

The counterparty this identifier belongs to.

References the parent counterparty record.

uuid_gen()

2.3. id_scheme

The identification scheme for this identifier.

References the party_id_scheme lookup table (e.g. LEI, BIC).

// no_generator_suffix: validated enum, a "-<idx>" suffix would be invalid.
// Rotate so a batch of several identifiers for one counterparty gets
// distinct schemes (max one identifier per scheme per counterparty).
[idx]{
    static constexpr const char* schemes[] = {
        "LEI", "BIC", "MIC", "NATIONAL_ID", "CEDB",
        "NATURAL_PERSON", "ACER", "DTCC_PARTICIPANT_ID", "MPID", "INTERNAL"};
    return std::string(schemes[idx % 10]);
}()

2.4. id_value

The identifier value.

The actual identifier string within the scheme. Part of the natural key alongside counterparty_id and id_scheme — a counterparty can hold more than one identifier under the same scheme as long as the value differs.

std::string(faker::string::alphanumeric(20))

2.5. description

Optional description of this identifier.

Free text description providing additional context.

std::string("Test identifier")

2.6. is_authoritative

Whether this is the identifier the tenant resolves the counterparty by. At most one live identifier per counterparty may hold it.

A counterparty carries identifiers under several schemes, and nothing in them says which one decides who the counterparty is. A screen that needs one applies a precedence of its own, LEI first and then BIC. Once the tenant can state the choice, that precedence is what it starts from.

// The first row a batch generates carries the LEI scheme, which is the
// precedence a screen applied while the column did not exist. Ten schemes
// rotate per counterparty, so at most one of its rows is marked.
[idx]{
    return idx % 10 == 0;
}()

3. Artefact columns

An ORE document names a counterparty by a name its position carries, such as CPTY_A, and the import carries the counterparty's LEI beside it. The store holds the counterparty's uuid, which does not exist until publishing, so the staging row names the counterparty by LEI instead.

3.1. id_value

3.2. version

3.3. id_scheme

3.4. lei

3.5. description

4. Artefact indexes

4.1. lei

5. SQL

5.1. Flags

5.2. Indexes

An ORE alias is a name an ORE document uses, and an import resolves the name to one counterparty, so within a tenant a name may be the alias of one counterparty only. Other schemes keep the per-counterparty key above.

name columns unique current_only where_extra
ore_alias tenant_id, id_scheme, id_value true true id_scheme = 'ORE'
authoritative_identifier_uniq counterparty_id true false is_authoritative and valid_to = ores_utility_infinity_timestamp_fn()

A second identifier cannot claim the mark while the first holds it. The write is refused rather than quietly leaving two rows that both say they are authoritative.

6. Foreign keys

6.1. counterparty_id

7. Insert trigger

7.1. Validations

column validation_function cardinality_limit_table cardinality_limit_column cardinality_scope_column cardinality_noun
id_scheme ores_refdata_validate_party_id_scheme_fn ores_refdata_party_id_schemes_tbl max_cardinality counterparty_id identifier

8. C++

8.1. Flags

8.2. Repository

8.3. Domain includes

#include <string>
#include <boost/uuid/uuid.hpp>

8.4. Entity includes

#include <string>

8.5. Conventions

8.6. Table display

column header
counterparty_id Counterparty
id_scheme Scheme
id_value Value
description Description
modified_by Modified By
version Version

8.7. Custom repository methods

8.8. Presentation

Note: counterparty_id is deliberately not exposed as a Detail field – like Book's parent_portfolio_id, it's always known from the owning context (the counterparty's own Identifiers tab) and set programmatically before the dialog is shown, never user-chosen.

8.8.1. Detail fields

field label widget type is_key is_required placeholder 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 badge_key
id Id idEdit line_edit true true Counterparty identifier id                    
id_scheme Scheme idSchemeCombo dynamic_combo false true   refdata::domain::party_id_scheme   fetch_party_id_schemes idSchemeWatcher code description display_order id schemes IdSchemeCombo  
id_value Value idValueEdit line_edit false true Enter identifier value                    
description Description descriptionEdit line_edit false false Enter description                    

8.8.2. Columns

enum_name field header type width
IdScheme id_scheme Scheme string 100
IdValue id_value Value string 180
Description description Description string 200
Version version Version int 80
ModifiedBy modified_by Modified By string 120
RecordedAt recorded_at Recorded At timestamp 150

9. See also

Emacs 29.3 (Org mode 9.6.15)