ores.refdata.currency_pair

Table of Contents

Currency pair identity: base/quote legs, deliverability, classification, and fixing source. Conventions (pip factor, tick size, calendars, business day convention) live 1:1 in ores.refdata.currency_pair_convention, matching the codebase's existing *_convention entity family. spot_days, calendars, and G11 membership are derived at read time from the two legs, not stored here — see Currency pair support in reference data for the full design rationale.

1. Flags

2. Columns

2.1. pair_code

Canonical base/quote pair code, e.g. "EUR/USD", always stored in canonical base-currency-precedence order.

std::string(faker::finance::currencyCode()) + "/" + std::string(faker::finance::currencyCode())

2.2. base_currency

Base (first) leg of the pair. Soft FK to currency.iso_code.

std::string("EUR")

2.3. quote_currency

Quote (second) leg of the pair. Soft FK to currency.iso_code.

std::string("USD")

2.4. classification

Liquidity classification; soft FK to ores_refdata_currency_pair_classifications_tbl (e.g. "major", "minor", "exotic"). Free-text pending a working dynamic-combo mechanism for aux-type reference data (tracked separately; out of scope for this entity — see Currency pair support in reference data).

std::string("major")

3. SQL

3.1. Flags

3.2. Extra drops

drop function if exists ores_refdata_validate_currency_pair_fn;

4. Foreign keys

4.1. base_currency

4.2. quote_currency

4.3. classification

5. Validation function

6. Insert trigger

6.1. Validations

column validation_function
base_currency ores_refdata_validate_currency_fn
quote_currency ores_refdata_validate_currency_fn
classification ores_refdata_validate_currency_pair_classification_fn
change_reason_code ores_dq_validate_change_reason_fn

7. C++

7.1. Flags

7.2. Repository

7.3. Domain includes

#include <chrono>
#include <optional>
#include <string>

7.4. Entity includes

#include <optional>
#include <string>
#include "sqlgen/Timestamp.hpp"

7.5. Conventions

7.6. Table display

column header
pair_code Pair
base_currency Base
quote_currency Quote
classification Classification
modified_by Modified By
version Version

7.7. Presentation

7.7.1. Columns

enum_name field header type width is_badge badge_key formatter formatter_include
PairCode pair_code Pair string 100        
BaseCurrency base_currency Base string 80        
QuoteCurrency quote_currency Quote string 80        
Classification classification Classification string 100 true currency_pair_classification    
Version version Version int 70        
ModifiedBy modified_by Modified By string auto        
RecordedAt recorded_at Recorded At timestamp auto        

7.7.2. Icon columns

Composites base+quote flags into the PairCode column's decoration (same cell as the "EUR/USD" text), matching the FX Spot grid's existing hand-written pattern (see currency_flag_icon() in FlagIconHelper.hpp).

column accessor field1 field2
PairCode currency_flag_icon base_currency quote_currency
BaseCurrency currency_flag_icon base_currency  
QuoteCurrency currency_flag_icon quote_currency  

7.7.3. Detail fields

field label widget type is_key is_required placeholder flag_source combo_fetch combo_fetch_include combo_allow_blank combo_values badge_key immutable
pair_code Pair Code pairCodeEdit line_edit true true e.g. EUR/USD              
base_currency Base Currency baseCurrencyCombo flagged_combo   true   currency fetch_currency_codes   false     true
quote_currency Quote Currency quoteCurrencyCombo flagged_combo   true   currency fetch_currency_codes   false     true
classification Classification classificationCombo static_combo               major,minor,exotic,commodity currency_pair_classification  

7.8. Custom repository methods

8. See also

Emacs 29.3 (Org mode 9.6.15)