Table of Contents

Interface IExecutor<TState, TAction, TEvent>

Namespace
Virtufin.Core.Execution
Assembly
Virtufin.Core.dll

Signature of an execution engine: given the current TState and a TAction, produce the next state and an TEvent describing the outcome. The event type is constrained to be parameterised by the action type so the executor statically cannot emit events for the wrong action universe.

public interface IExecutor<TState, TAction, TEvent> where TState : IExecutionState where TAction : ITradeAction where TEvent : ITradeEvent<TAction, DateTimeOffset>

Type Parameters

TState

Execution state type.

TAction

Trade action type the executor consumes.

TEvent

Trade event type parameterised by TAction.

Remarks

This is the Kleisli morphism A → IO E from the domain spec, with the executor state exposed explicitly and Task as the concrete IO. A deterministic/backtest executor is the degenerate case that never actually suspends (its own hook stays synchronous internally and wraps the result in a completed Task); a live executor genuinely awaits the venue's response inside its own hook. Both satisfy the same signature -- callers never need to know which they're driving.

Properties

Initial

The initial state of the executor.

TState Initial { get; }

Property Value

TState

Methods

ExecuteAsync(TState, TAction)

Execute one TAction, producing the next state and an outcome event.

Task<(TState NextState, TEvent Event)> ExecuteAsync(TState state, TAction action)

Parameters

state TState

Current executor state.

action TAction

The action to execute.

Returns

Task<(TState NextState, TEvent Event)>

Tuple of (next state, outcome event).