Expand description
State machine apply() interface for the unified engine.
This module provides a deterministic, side-effect free core for the trading engine.
The apply() function takes an engine command and returns the resulting events,
enabling:
- Reasoning about correctness as a pure state transition
- Observing “input command -> output events” per request
- Testing determinism and replay
Structs§
- Accrue
PmSettlement Interest Command - Apply
Output - Output from applying a command to the engine state.
- Apply
PmSettlement Repayment Command - Approve
Agent Payload - Wire-serializable payload for ApproveAgent NATS commands.
- Balance
Command Payload - Wire-serializable payload for LiquidationBonusUpdate.
- Command
Envelope - Envelope containing a command with metadata about when it was received.
- Deposit
Update Payload - Wire-serializable payload for DepositUpdate cash ledger delta commands.
- Expiry
Settlement Intent - Idempotent durable settlement intent emitted by apply(TickExpiry).
- Hypercore
Equity Update Payload - Wire-serializable payload for HypercoreEquityUpdate NATS commands.
- Hypercore
Position Update Payload - Wire-serializable payload for HypercorePositionUpdate NATS commands.
- IvUpdate
Payload - Wire-serializable payload for IvUpdate journal entries.
- Journal
PmRecovery Plan Command - Mark
PmRecovery Action Submitted Command - Market
Action Command - MmpConfig
Update Payload - Wire-serializable payload for MmpConfigUpdate NATS commands.
- MmpFill
Update - Per-leg MMP fill update data for post-journal processing. Moved here from rfq_handler so it’s accessible in ApplyOutput.
- Nonce
Advance Payload - Wire-serializable payload for NonceAdvance NATS commands.
- PmRecovery
Action Command - PmRecovery
Plan Command - Price
Update Payload - Wire-serializable payload for PriceUpdate journal entries.
- Record
PmVault Deposit Command - Request
PmVault Withdrawal Command - Resolve
PmRecovery Action Command - Revoke
Agent Payload - Wire-serializable payload for RevokeAgent NATS commands.
- RfqExecute
Command - RfqExecute
Leg - RfqPlan
Output - Successful RFQ execution plan output returned from apply().
- SetPm
Settlement Pool Config Command - Tick
Expiry Context - Tick
Expiry DueGroup - Tick
Expiry Pending Group - Tick
Expiry PmSettlement - Tick
Expiry Settlement Price - Tick
Expiry Wallet Margin Mode - Tier
Margin Mode Update Payload - Wire-serializable payload for margin-mode-only TierUpdate NATS commands.
- Tier
Update Payload - Wire-serializable payload for TierUpdate journal entries.
- Trading
Mode Update Payload - Wire-serializable payload for TradingModeUpdate NATS commands.
Enums§
- Engine
Command - Commands that mutate engine state.
- Expiry
Effect - Runtime side effects requested by a TickExpiry transition.
- Market
Effect - Runtime side effects requested by a MarketAction transition.
- PmRecovery
Action Kind - PmRecovery
Action Result - PmRecovery
External Kind - PmRecovery
Reason - PmRecovery
Trigger - RfqExecute
Result