ores.trading.activity_type

Table of Contents

Internal trade activity classification. Each activity type states what happened to a trade (e.g. new_booking, amendment, novation). It optionally maps to an FpML event type code for wire-format messages, and optionally links to an FSM transition that drives the trade's operational status change.

The table is bi-temporal and audited: it carries version, the four audit columns and the valid_from=/=valid_to pair with the GIST exclusion and the delete rule, so the model takes the ordinary audited shape and needs no shape flag.

1. Flags

2. Natural keys

3. Columns

3.1. code

Unique activity type code.

Examples: 'new_booking', 'amendment', 'novation'.

std::string(faker::word::noun()) + "_activity"

3.2. category

High-level category grouping this activity type.

One of: new_activity, lifecycle_event, misbooking, valuation_change, cancellation.

Soft FK to ores_trading_activity_categories_tbl: the values are the closed activity category set. PR 4 tightens the soft reference into a real foreign key.

std::string("new_activity")

3.3. requires_confirmation

True when this activity type requires counterparty confirmation. This is the confirmable axis of Trade activity: a confirmable activity changes the terms the counterparty agreed, so a new confirmation is issued.

false

3.4. is_economic

True when an activity of this type changes what the trade pays, so the trade must be revalued. This is the economic axis.

false

3.5. is_real

True when an activity of this type changes anything at all. This is the real axis. Only a null amend is not real: the value entered equals the value held, so the activity is recorded for the audit trail and versions nothing.

true

3.6. priority

Where this activity type sits when several causes land on one version: the lowest number names the version. Ranks 1 to 8 follow the order in Trade versioning (book moves, funding roll or reserve, CEM charge or contra revenue, close outs, triggered, exercised or expired, fixing, misbooking); 9 is every other cause.

9

3.7. description

Detailed description of the activity type.

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

3.8. fpml_event_type_code

Optional FpML event type code for wire-format mapping.

Soft FK to ores_trading_fpml_event_types_tbl. Empty when no FpML equivalent is stated.

std::string("")

3.9. fsm_transition_id

Optional FSM transition that this activity triggers.

Soft FK to ores_dq_fsm_transitions_tbl. Null when the activity drives no status change.

std::nullopt

4. SQL

4.1. Flags

4.2. Extra drops

drop function if exists ores_trading_validate_activity_type_fn;

4.3. Checks

expression
"category" in ('new_activity', 'lifecycle_event', 'misbooking', 'valuation_change', 'cancellation')
"fpml_event_type_code" is null or "fpml_event_type_code" in ('New', 'Amendment', 'Novation', 'PartialTermination', 'FullTermination')
"priority" between 1 and 9
"is_real" or not ("is_economic" or "requires_confirmation")

5. C++

5.1. Flags

5.2. Repository

5.3. Domain includes

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

5.4. Conventions

5.5. Table display

column header
code Code
category Category
requires_confirmation Requires Confirmation
description Description
fpml_event_type_code FpML Event Type
fsm_transition_id FSM Transition ID
modified_by Modified By
version Version

5.6. Custom repository methods

6. See also

Emacs 29.3 (Org mode 9.6.15)