ores.trading.trade_additional_field

Table of Contents

One field a trade carries in a document's own vocabulary: ORE's AdditionalFields is open content, any element name with any content, and it is where a document states what ORE Studio does not model. The row keeps the element's name and its text, so nothing is decoded and both round trip. The order is the document's order, and the ordinal preserves it.

The row is keyed by the trade and the ordinal, and references the trade anchor with a database foreign key. It copies the anchor's party, pinned to the anchor, because row-level security needs the party on every row. It replaces the envelope's additional field table, which the ORE import moves off in its own task.

1. Flags

2. Columns

2.1. trade_id

The trade this field belongs to.

ctx.generate_uuid()

2.2. trade_activity_id

The activity that wrote this version.

2.3. sequence_number

Ordinal of this field among the trade's additional fields, from one.

1

2.4. name

Element name of the field, as the document spelled it.

std::string("MyField")

2.5. value

Text content of the field, as the document spelled it.

std::string("MyValue")

3. SQL

3.1. Flags

3.2. Checks

expression
"sequence_number" > 0

4. Foreign keys

4.1. trade_id

A database foreign key: the anchor is immutable.

4.2. trade_activity_id

The activity that wrote this version. A database foreign key: the activity is immutable.

#include "ores.trading.api/generators/trade_activity_generator.hpp"
#include "ores.trading.core/repository/trade_activity_repository.hpp"
{
    auto activity = ores::trading::generators::generate_synthetic_trade_activity(ctx);
    activity.party_id = *party_ctx.party_id();
    ores::trading::repository::trade_activity_repository().write(party_ctx, activity);
    v.trade_activity_id = activity.id;
}

5. C++

5.1. Flags

5.2. Repository

5.3. Domain includes

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

5.4. Conventions

5.5. Table display

column header
sequence_number Sequence
name Name
value Value
modified_by Modified By
version Version

6. See also

Emacs 29.3 (Org mode 9.6.15)