Skip to main content

Module reducer

Module reducer 

Expand description

Pure state reducer for event-sourced portfolio state (JOURNAL_SPEC §9).

reduce applies a single EngineEvent to a PortfolioState. state_hash produces a deterministic blake3 digest of the state.

Enums§

ReduceError
Recoverable errors produced by the reducer.

Functions§

checkpoint_state_hash
Public wrapper for callers that only need the hash (e.g. replay verification). Serializes PortfolioState once to Value.
clear_retiring_order_target
Remove order_id from all retiring target sets and direct-retiring set.
create_checkpoint
Create a Checkpoint from the current portfolio state.
lookup_order_attribution
Resolve correlation/strategy attribution for an order lifecycle event.
lookup_order_intent
Resolve originating ClientIntentId for an order lifecycle event.
reduce
Apply a single event to the portfolio state.
severity
Severity ordering for risk stop states. Higher = more severe.
state_hash
Produce a deterministic hash of the portfolio state.