ores.refdata.book

Table of Contents

Operational ledger leaves. The only entity that holds trades. Serves as the basis for accounting, ownership, and regulatory capital treatment. Must belong to exactly one portfolio.

Flags

Columns

id

UUID uniquely identifying this book.

Surrogate key for the book record.

party_id

Party that owns this book.

References the parties table.

ctx.generate_uuid()

name

Book name, unique within party.

e.g., 'FXO_EUR_VOL_01'.

std::string("BOOK_") + std::to_string(faker::number::integer(1, 999))

description

Optional free-text description of the book.

std::string(faker::lorem::sentence())

parent_portfolio_id

Links to exactly one portfolio.

Mandatory: Every book must belong to a portfolio.

ctx.generate_uuid()

owner_unit_id

Business unit that owns this book.

Optional FK to business_units. Should reference a unit that is an owner_unit_id in the book's portfolio ancestry chain.

std::nullopt

functional_currency

Functional/accounting currency, designated by the ledger.

ISO 4217 currency code.

// "X-0" is the first code the synthetic currency generator emits (see
// the currency entity's own generator): the functional-currency
// validation only accepts 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, so X-0 is present whenever any synthetic currency exists.
std::string("X-0")

gl_account_ref

Reference to external General Ledger.

e.g., 'GL-10150-FXO'. Nullable if not integrated.

std::string("GL-10150-TEST")

cost_center

Internal finance code for P&L attribution.

Links to cost center in finance system.

std::string("CC-001")

book_status

Lifecycle status of the book.

References book_statuses lookup (Active, Closed, Frozen). Defaults to Active so a freshly-constructed book (the Add dialog, before the Status combo's async populate completes) always carries a value the FK-validation trigger accepts.

std::string("Active")

regulatory_book_type

Basel III/IV FRTB trading book / banking book classification.

References regulatory_book_types lookup (Trading, Banking). Defaults to Trading for the same reason book_status defaults to Active.

std::string("Trading")

is_sweepable

Whether this book is eligible for spot-sweep transfers to the designated Sweep target book – independent of ledger_feed_type and book_purpose_type; see Book classification.

false

rates_centre_code

Rates centre determining which revaluation market data snapshot this book uses at end-of-day; see Book groups and rates centres.

Soft FK to business_centres by code (e.g. "GBLO", "USNY"), reusing the same location reference already used by counterparty/party/business_unit rather than modeling a dedicated rates-centre entity. Defaults to WRLD (the global sentinel business centre, seeded for every tenant) for the same reason book_status defaults to Active – a freshly-constructed book always carries a value the FK-validation trigger accepts.

std::string("WRLD")

SQL

Flags

Foreign keys

functional_currency

party_id

parent_portfolio_id

owner_unit_id

Insert trigger

Validations

column validation_function
functional_currency ores_refdata_validate_currency_fn
book_status ores_refdata_validate_book_status_fn
regulatory_book_type ores_refdata_validate_regulatory_book_type_fn
rates_centre_code ores_refdata_validate_business_centre_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
party_id Party
functional_currency Currency
book_status Status
regulatory_book_type Regulatory Book Type
is_sweepable Sweepable
rates_centre_code Rates Centre
modified_by Modified By
version Version

Qt

Detail fields

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_as_of_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 Book id                            
name Name nameEdit line_edit   true Enter book name                            
functional_currency Functional Currency functionalCurrencyEdit flagged_combo       currency                          
gl_account_ref GL Account Ref glAccountRefEdit line_edit     Enter GL account reference                            
cost_center Cost Center costCenterEdit line_edit     Enter cost center                            
book_status Status bookStatusCombo dynamic_combo             refdata::domain::book_status ores.qt/LookupFetcher.hpp fetch_book_statuses fetch_book_statuses_at_timepoint bookStatusWatcher code description display_order book statuses BookStatusCombo book_status
regulatory_book_type Regulatory Book Type regulatoryBookTypeCombo dynamic_combo             refdata::domain::regulatory_book_type ores.qt/LookupFetcher.hpp fetch_regulatory_book_types fetch_regulatory_book_types_at_timepoint regulatoryBookTypeWatcher code description display_order regulatory book types RegulatoryBookTypeCombo regulatory_book_type
is_sweepable Sweepable isSweepableCheckBox check_box                                  
rates_centre_code Rates Centre ratesCentreCodeCombo flagged_combo       business_centre false fetch_business_centre_codes   ores.qt/LookupFetcher.hpp                  

Columns (Qt model)

enum_name field header type width is_badge badge_key formatter formatter_include
Name name Name string 200        
FunctionalCurrency functional_currency Functional Currency string 130        
BookStatus book_status Status string 100 true book_status    
CostCenter cost_center Cost Center string 120        
RegulatoryBookType regulatory_book_type Regulatory Book Type string 130 true regulatory_book_type    
IsSweepable is_sweepable Sweepable bool 90 true is_sweepable    
RatesCentreCode rates_centre_code Rates Centre string 110        
Version version Version int 80        
ModifiedBy modified_by Modified By string 120        
RecordedAt recorded_at Recorded At timestamp 150        

Icon columns (Qt model)

Ledger currency gets its own flag icon, same as any other single-currency cell (e.g. Currency's own code column) — no compositing needed since it's a single column.

column accessor field1 field2
FunctionalCurrency currency_flag_icon functional_currency  
RatesCentreCode business_centre_flag_icon rates_centre_code  

Related entity shortcuts

signal icon label tooltip
BookStatuses Flag Statuses Open Book Statuses list
RegulatoryBookTypes Flag Regulatory Types Open Regulatory Book Types list
BookPurposeTypes Flag Purpose Types Open Book Purpose Types list
LedgerFeedTypes Flag Ledger Feed Types Open Ledger Feed Types list

Custom repository methods

See also

Emacs 29.3 (Org mode 9.6.15)