StrategyEngine

StockSharp.Algo.Strategies.Decomposed

State machine + message processing. Handles ProcessState transitions and market data routing to PnLManager.

Constructors

StrategyEngine
public StrategyEngine(IStrategyHost host, IPnLManager pnlManager)
strategyEngine = StrategyEngine(host, pnlManager)

State machine + message processing. Handles ProcessState transitions and market data routing to PnLManager.

host
Strategy host.
pnlManager
PnL manager.

Properties

ProcessState
public ProcessStates ProcessState { get; private set; }
value = strategyEngine.ProcessState
strategyEngine.ProcessState = value

Current process state.

UnrealizedPnLInterval
public TimeSpan UnrealizedPnLInterval { get; set; }
value = strategyEngine.UnrealizedPnLInterval
strategyEngine.UnrealizedPnLInterval = value

Interval for unrealized PnL refresh.

Methods

ForceStop
public void ForceStop()
strategyEngine.ForceStop()

Force state to Stopped (for reset).

OnMessage
public void OnMessage(Message message)
strategyEngine.OnMessage(message)

Process incoming message — state transitions + market data routing.

RequestStartAsync
public ValueTask RequestStartAsync(CancellationToken cancellationToken)
result = strategyEngine.RequestStartAsync(cancellationToken)

Request strategy start. Sends state change message through host.

RequestStopAsync
public ValueTask RequestStopAsync(CancellationToken cancellationToken)
result = strategyEngine.RequestStopAsync(cancellationToken)

Request strategy stop. Sends state change message through host.

Events

CurrentPriceUpdated
public event Action<SecurityId, decimal, DateTime, DateTime> CurrentPriceUpdated
strategyEngine.CurrentPriceUpdated += handler

Fires when current price updates from market data.

PnLRefreshRequired
public event Action<DateTime> PnLRefreshRequired
strategyEngine.PnLRefreshRequired += handler

Fires when PnL should be recalculated.

StateChanged
public event Action<ProcessStates> StateChanged
strategyEngine.StateChanged += handler

Fires when ProcessState changes.