Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::DecisionRecord Struct Reference

A single AI-driven trading decision with full provenance. More...

#include <decision_log.hpp>

Public Member Functions

std::vector< uint8_t > serialize () const
 Serialize the record to a deterministic byte sequence.
 

Static Public Member Functions

static expected< DecisionRecorddeserialize (const uint8_t *data, size_t size)
 Reconstruct a DecisionRecord from its serialized byte representation.
 

Public Attributes

int64_t timestamp_ns {0}
 Decision timestamp (nanoseconds since epoch)
 
int32_t strategy_id {0}
 Which strategy made this decision.
 
std::string model_version
 Model version hash or identifier.
 
DecisionType decision_type {DecisionType::NO_ACTION}
 What type of decision.
 
std::vector< float > input_features
 Input feature vector to the model.
 
float model_output {0.0f}
 Primary model output (e.g., signal strength)
 
float confidence {0.0f}
 Model confidence [0.0, 1.0].
 
RiskGateResult risk_result {RiskGateResult::PASSED}
 Risk gate outcome.
 
std::string order_id
 Associated order ID (empty if none)
 
std::string symbol
 Trading symbol.
 
double price {0.0}
 Decision price.
 
double quantity {0.0}
 Decision quantity.
 
std::string venue
 Execution venue.
 
std::string notes
 Optional free-text notes.
 
BuySellIndicator buy_sell {BuySellIndicator::BUY}
 Field 6: Buy/sell direction.
 
OrderType order_type {OrderType::MARKET}
 Field 7: Order type.
 
TimeInForce time_in_force {TimeInForce::DAY}
 Field 8: Time-in-force.
 
std::string isin
 Field 5: ISIN (ISO 6166, 12 chars)
 
std::string currency
 Field 9: Currency (ISO 4217, 3 chars, e.g. "USD")
 
bool short_selling_flag {false}
 Field 16: Short selling indicator.
 
bool aggregated_order {false}
 Field 17: Aggregated order flag.
 
int64_t validity_period_ns {0}
 Field 10: GTD validity timestamp (0=N/A)
 
std::string parent_order_id
 R-17: Parent order for lifecycle linking.
 

Detailed Description

A single AI-driven trading decision with full provenance.

Each record captures the complete decision context: what the model saw (input features), what it decided (decision type, price, quantity), how confident it was (confidence), and whether risk management approved (risk result). All fields are serialized deterministically for hashing.

Gap R-4 (MiFID II RTS 24 Annex I): Includes all mandatory fields from Table 2: buy_sell_indicator, order_type, time_in_force, isin, currency, short_selling_flag, aggregated_order, validity_period, parent_order_id.

Definition at line 106 of file decision_log.hpp.

Member Function Documentation

◆ deserialize()

static expected< DecisionRecord > signet::forge::DecisionRecord::deserialize ( const uint8_t *  data,
size_t  size 
)
inlinestatic

Reconstruct a DecisionRecord from its serialized byte representation.

Parameters
dataPointer to the serialized bytes.
sizeNumber of bytes available at data.
Returns
The deserialized record, or an error if the data is truncated.

Definition at line 205 of file decision_log.hpp.

◆ serialize()

std::vector< uint8_t > signet::forge::DecisionRecord::serialize ( ) const
inline

Serialize the record to a deterministic byte sequence.

Format: each field written sequentially as little-endian values. Strings: 4-byte LE length prefix + raw bytes. Vectors: 4-byte LE count + float data (4 bytes each, LE).

Definition at line 137 of file decision_log.hpp.

Member Data Documentation

◆ aggregated_order

bool signet::forge::DecisionRecord::aggregated_order {false}

Field 17: Aggregated order flag.

Definition at line 129 of file decision_log.hpp.

◆ buy_sell

BuySellIndicator signet::forge::DecisionRecord::buy_sell {BuySellIndicator::BUY}

Field 6: Buy/sell direction.

Definition at line 123 of file decision_log.hpp.

◆ confidence

float signet::forge::DecisionRecord::confidence {0.0f}

Model confidence [0.0, 1.0].

Definition at line 113 of file decision_log.hpp.

◆ currency

std::string signet::forge::DecisionRecord::currency

Field 9: Currency (ISO 4217, 3 chars, e.g. "USD")

Definition at line 127 of file decision_log.hpp.

◆ decision_type

DecisionType signet::forge::DecisionRecord::decision_type {DecisionType::NO_ACTION}

What type of decision.

Definition at line 110 of file decision_log.hpp.

◆ input_features

std::vector<float> signet::forge::DecisionRecord::input_features

Input feature vector to the model.

Definition at line 111 of file decision_log.hpp.

◆ isin

std::string signet::forge::DecisionRecord::isin

Field 5: ISIN (ISO 6166, 12 chars)

Definition at line 126 of file decision_log.hpp.

◆ model_output

float signet::forge::DecisionRecord::model_output {0.0f}

Primary model output (e.g., signal strength)

Definition at line 112 of file decision_log.hpp.

◆ model_version

std::string signet::forge::DecisionRecord::model_version

Model version hash or identifier.

Definition at line 109 of file decision_log.hpp.

◆ notes

std::string signet::forge::DecisionRecord::notes

Optional free-text notes.

Definition at line 120 of file decision_log.hpp.

◆ order_id

std::string signet::forge::DecisionRecord::order_id

Associated order ID (empty if none)

Definition at line 115 of file decision_log.hpp.

◆ order_type

OrderType signet::forge::DecisionRecord::order_type {OrderType::MARKET}

Field 7: Order type.

Definition at line 124 of file decision_log.hpp.

◆ parent_order_id

std::string signet::forge::DecisionRecord::parent_order_id

R-17: Parent order for lifecycle linking.

Definition at line 131 of file decision_log.hpp.

◆ price

double signet::forge::DecisionRecord::price {0.0}

Decision price.

Definition at line 117 of file decision_log.hpp.

◆ quantity

double signet::forge::DecisionRecord::quantity {0.0}

Decision quantity.

Definition at line 118 of file decision_log.hpp.

◆ risk_result

RiskGateResult signet::forge::DecisionRecord::risk_result {RiskGateResult::PASSED}

Risk gate outcome.

Definition at line 114 of file decision_log.hpp.

◆ short_selling_flag

bool signet::forge::DecisionRecord::short_selling_flag {false}

Field 16: Short selling indicator.

Definition at line 128 of file decision_log.hpp.

◆ strategy_id

int32_t signet::forge::DecisionRecord::strategy_id {0}

Which strategy made this decision.

Definition at line 108 of file decision_log.hpp.

◆ symbol

std::string signet::forge::DecisionRecord::symbol

Trading symbol.

Definition at line 116 of file decision_log.hpp.

◆ time_in_force

TimeInForce signet::forge::DecisionRecord::time_in_force {TimeInForce::DAY}

Field 8: Time-in-force.

Definition at line 125 of file decision_log.hpp.

◆ timestamp_ns

int64_t signet::forge::DecisionRecord::timestamp_ns {0}

Decision timestamp (nanoseconds since epoch)

Definition at line 107 of file decision_log.hpp.

◆ validity_period_ns

int64_t signet::forge::DecisionRecord::validity_period_ns {0}

Field 10: GTD validity timestamp (0=N/A)

Definition at line 130 of file decision_log.hpp.

◆ venue

std::string signet::forge::DecisionRecord::venue

Execution venue.

Definition at line 119 of file decision_log.hpp.


The documentation for this struct was generated from the following file: