Table of Contents

Class LiveExecutorBase<TState, TAction, TEvent>

Namespace
Virtufin.Base.Execution
Assembly
Virtufin.Base.dll

Live executor base for routing actions to a real exchange. Subclasses define the exchange-routing strategy in ProcessAsync(TState, TAction). No assumptions about routing, fallback, or state evolution — all in the subclass.

public abstract class LiveExecutorBase<TState, TAction, TEvent> : IExecutor<TState, TAction, TEvent> where TState : IExecutionState where TAction : ITradeAction where TEvent : ITradeEvent<TAction, DateTimeOffset>

Type Parameters

TState
TAction
TEvent
Inheritance
LiveExecutorBase<TState, TAction, TEvent>
Implements
IExecutor<TState, TAction, TEvent>
Inherited Members

Remarks

Template method pattern. ExecuteAsync(TState, TAction) delegates directly to ProcessAsync(TState, TAction); subclasses own the full routing flow. The base previously held a deterministic fallback for development; that has been removed to keep the base free of routing-strategy assumptions. Subclasses may compose a fallback of their own if they want one. Unlike DeterministicExecutorBase<TState, TAction, TEvent>/ SlippageExecutorBase<TState, TAction, TEvent>, this hook is genuinely async: a production subclass is expected to actually await the exchange's response here, not merely wrap a synchronous result.

Properties

Initial

The initial state of the executor.

public abstract TState Initial { get; }

Property Value

TState

Methods

ExecuteAsync(TState, TAction)

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

public 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).

ProcessAsync(TState, TAction)

Subclass hook: route the action to the exchange and emit the resulting event.

protected abstract Task<(TState NextState, TEvent Event)> ProcessAsync(TState state, TAction action)

Parameters

state TState

Current executor state.

action TAction

The trade action to route.

Returns

Task<(TState NextState, TEvent Event)>

Tuple of (next state, outcome event).

Remarks

Production subclasses will marshal the action to a wire protocol (REST, FIX, gRPC, native API), await the exchange's response, and translate it to a TEvent. In development subclasses may choose to no-op, log, or delegate to a local simulation — the base does not constrain this.