Skip to main content

Module apply

Module apply 

Source
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§

AccruePmSettlementInterestCommand
ApplyOutput
Output from applying a command to the engine state.
ApplyPmSettlementRepaymentCommand
ApproveAgentPayload
Wire-serializable payload for ApproveAgent NATS commands.
BalanceCommandPayload
Wire-serializable payload for LiquidationBonusUpdate.
CommandEnvelope
Envelope containing a command with metadata about when it was received.
DepositUpdatePayload
Wire-serializable payload for DepositUpdate cash ledger delta commands.
ExpirySettlementIntent
Idempotent durable settlement intent emitted by apply(TickExpiry).
HypercoreEquityUpdatePayload
Wire-serializable payload for HypercoreEquityUpdate NATS commands.
HypercorePositionUpdatePayload
Wire-serializable payload for HypercorePositionUpdate NATS commands.
IvUpdatePayload
Wire-serializable payload for IvUpdate journal entries.
JournalPmRecoveryPlanCommand
MarkPmRecoveryActionSubmittedCommand
MarketActionCommand
MmpConfigUpdatePayload
Wire-serializable payload for MmpConfigUpdate NATS commands.
MmpFillUpdate
Per-leg MMP fill update data for post-journal processing. Moved here from rfq_handler so it’s accessible in ApplyOutput.
NonceAdvancePayload
Wire-serializable payload for NonceAdvance NATS commands.
PmRecoveryActionCommand
PmRecoveryPlanCommand
PriceUpdatePayload
Wire-serializable payload for PriceUpdate journal entries.
RecordPmVaultDepositCommand
RequestPmVaultWithdrawalCommand
ResolvePmRecoveryActionCommand
RevokeAgentPayload
Wire-serializable payload for RevokeAgent NATS commands.
RfqExecuteCommand
RfqExecuteLeg
RfqPlanOutput
Successful RFQ execution plan output returned from apply().
SetPmSettlementPoolConfigCommand
TickExpiryContext
TickExpiryDueGroup
TickExpiryPendingGroup
TickExpiryPmSettlement
TickExpirySettlementPrice
TickExpiryWalletMarginMode
TierMarginModeUpdatePayload
Wire-serializable payload for margin-mode-only TierUpdate NATS commands.
TierUpdatePayload
Wire-serializable payload for TierUpdate journal entries.
TradingModeUpdatePayload
Wire-serializable payload for TradingModeUpdate NATS commands.

Enums§

EngineCommand
Commands that mutate engine state.
ExpiryEffect
Runtime side effects requested by a TickExpiry transition.
MarketEffect
Runtime side effects requested by a MarketAction transition.
PmRecoveryActionKind
PmRecoveryActionResult
PmRecoveryExternalKind
PmRecoveryReason
PmRecoveryTrigger
RfqExecuteResult