Class LiveExecutorBase<TState, TAction, TEvent>
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
TStateTActionTEvent
- 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
stateTStateCurrent executor state.
actionTActionThe action to execute.
Returns
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
stateTStateCurrent executor state.
actionTActionThe trade action to route.
Returns
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.