/// <summary> /// Create an execution provider to match the given sourceSourceId. /// </summary> /// <param name="sourceSourceId"></param> /// <param name="account"></param> /// <returns></returns> public ISourceOrderExecution CreateExecutionProvider(ComponentId sourceId, ComponentId dataSourceId) { SourceTypeEnum?mode = GetSourceTypeFlags(sourceId, SourceTypeEnum.OrderExecution); if (sourceId == _backtestingExecutionSourceInfo.ComponentId) { BackTestOrderExecutionProvider provider = new BackTestOrderExecutionProvider(sourceId); if (provider.SetInitialParameters(this, ObtainDataDelivery(dataSourceId)) == false) { SystemMonitor.OperationError("Failed to initialize backtesting data provider."); return(null); } return(provider); } else { SourceInfo?sourceInfo = GetSourceInfo(sourceId, SourceTypeEnum.OrderExecution); if (sourceInfo.HasValue == false) { SystemMonitor.OperationError("Source info not found for source [" + sourceId.Print() + "].", TracerItem.PriorityEnum.High); return(null); } if ((sourceInfo.Value.SourceType & SourceTypeEnum.OrderExecution) == 0) { SystemMonitor.OperationError("Can not create order execution to source that does not implement data provider [" + sourceId.Print() + "].", TracerItem.PriorityEnum.Critical); return(null); } PlatformSourceOrderExecutionProvider platformExecutionProvider = new PlatformSourceOrderExecutionProvider(); Arbiter.AddClient(platformExecutionProvider); platformExecutionProvider.SetInitialParameters(this, sourceId, dataSourceId); return(platformExecutionProvider); } }
/// <summary> /// Create an execution provider to match the given sourceSourceId. /// </summary> /// <param name="sourceSourceId"></param> /// <param name="account"></param> /// <returns></returns> public ISourceOrderExecution CreateExecutionProvider(ComponentId sourceId, ComponentId dataSourceId) { SourceTypeEnum? mode = GetSourceTypeFlags(sourceId, SourceTypeEnum.OrderExecution); if (sourceId == _backtestingExecutionSourceInfo.ComponentId) { BackTestOrderExecutionProvider provider = new BackTestOrderExecutionProvider(sourceId); if (provider.SetInitialParameters(this, ObtainDataDelivery(dataSourceId)) == false) { SystemMonitor.OperationError("Failed to initialize backtesting data provider."); return null; } return provider; } else { SourceInfo? sourceInfo = GetSourceInfo(sourceId, SourceTypeEnum.OrderExecution); if (sourceInfo.HasValue == false) { SystemMonitor.OperationError("Source info not found for source [" + sourceId.Print() + "].", TracerItem.PriorityEnum.High); return null; } if ((sourceInfo.Value.SourceType & SourceTypeEnum.OrderExecution) == 0) { SystemMonitor.OperationError("Can not create order execution to source that does not implement data provider [" + sourceId.Print() + "].", TracerItem.PriorityEnum.Critical); return null; } PlatformSourceOrderExecutionProvider platformExecutionProvider = new PlatformSourceOrderExecutionProvider(); Arbiter.AddClient(platformExecutionProvider); platformExecutionProvider.SetInitialParameters(this, sourceId, dataSourceId); return platformExecutionProvider; } }