private void StopStrategy()
{
lock (this)
{
Console.WriteLine($"{DateTime.Now} StrategyManager::StopStrategy {Strategy.Name}");
SetStatusType(StrategyStatusType.Stopped);
if (!this.framework.IsExternalDataQueue)
this.subscriptions.ToList().ForEach(p => this.framework.SubscriptionManager?.Unsubscribe(p.Key, p.Value));
if (Strategy.Status == StrategyStatus.Stopped)
{
Console.WriteLine($"StrategyManager::StopStrategy Error: Can not stop stopped strategy ({Strategy.Name})");
}
else
{
Strategy.EmitStrategyStop();
if (this.framework.Mode == FrameworkMode.Simulation)
{
this.framework.ProviderManager.DataSimulator.Disconnect();
this.framework.ProviderManager.ExecutionSimulator.Disconnect();
}
// TODO: figure out function name
Strategy.vmethod_2();
Status = StrategyStatus.Stopped;
}
}
}