ores.trading.trade_party_role

Table of Contents

Associates a counterparty with a specific role on a trade. The internal party (the house) is derived from book_id via books.party_id. Supports multiple counterparties per trade in different roles.

1. Flags

2. Columns

2.1. id

UUID uniquely identifying this party role assignment.

Surrogate key for the trade party role record.

2.2. trade_id

Trade this role assignment belongs to.

Soft FK to ores_trading_trades_tbl.

ctx.generate_uuid()

2.3. counterparty_id

Counterparty fulfilling the role.

Soft FK to ores_refdata_counterparties_tbl.

ctx.generate_uuid()

2.4. role

Role the counterparty plays on this trade.

Soft FK to ores_trading_party_role_types_tbl.

std::string("Counterparty")

3. SQL

3.1. Flags

3.2. Indexes

name columns unique current_only where_extra
trade tenant_id, trade_id false true  
counterparty tenant_id, counterparty_id false true  

4. Foreign keys

4.1. trade_id

Trade this role assignment belongs to; must exist in ores_trading_trades_tbl.

4.2. counterparty_id

Counterparty fulfilling the role; must exist in ores_refdata_counterparties_tbl.

5. Insert trigger

5.1. Validations

column validation_function
role ores_trading_validate_party_role_type_fn

6. C++

6.1. Flags

6.2. Repository

6.3. Domain includes

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

6.4. Conventions

6.5. Table display

column header
id ID
trade_id Trade ID
counterparty_id Counterparty ID
role Role
modified_by Modified By
version Version

6.6. Custom repository methods

7. See also

Emacs 29.3 (Org mode 9.6.15)