/// <summary> /// Create a dataDelivery delivery component, corresponding to the given sourceSourceId and account /// </summary> /// <param name="sourceSourceId"></param> /// <param name="account"></param> /// <returns></returns> protected ISourceDataDelivery CreateDataDelivery(ComponentId sourceId) { if (sourceId == _dataStoreSourceInfo.ComponentId) { List <PlatformComponent> components = Platform.GetComponentsByType(typeof(DataStoreManagementComponent)); if (components.Count == 0) { SystemMonitor.Error("Failed to find data store management component."); return(null); } DataStoreDataDelivery delivery = new DataStoreDataDelivery(_dataStoreSourceInfo.ComponentId); if (delivery.Initialize() == false) { SystemMonitor.OperationError("Failed to initialize data store data delivery."); return(null); } return(delivery); } SourceInfo?sourceInfo = GetSourceInfo(sourceId, SourceTypeEnum.DataProvider); if (sourceInfo.HasValue == false) { SystemMonitor.OperationError("Source info not found for source [" + sourceId.Print() + "].", TracerItem.PriorityEnum.High); return(null); } if ((sourceInfo.Value.SourceType & SourceTypeEnum.DataProvider) == 0) { SystemMonitor.OperationError("Can not create data delivery to source that does not implement data provider [" + sourceId.Print() + "].", TracerItem.PriorityEnum.Critical); return(null); } TransportInfo info = GetSourceTransportInfoToMe(sourceId); if (info == null) { return(null); } // This is a remote dataDelivery source, create a corresponding delivery. DataSourceClientStub stubDelivery = new DataSourceClientStub(); Arbiter.AddClient(stubDelivery); stubDelivery.SetInitialParameters(sourceId, info); return(stubDelivery); }
/// <summary> /// /// </summary> public bool SetInitialParameters(TradePlatformComponent manager, ComponentId sourceId, ComponentId dataSourced) { SystemMonitor.CheckError(_manager == null, "Session member already assigned."); _manager = manager; _dataSourced = dataSourced; _tradeEntities.SetInitialParameters(manager, this, manager.GetDataDelivery(_dataSourced)); SourceInfo?info = _manager.GetSourceInfo(sourceId, SourceTypeEnum.OrderExecution); if (info.HasValue) { return(base.SetInitialParameters(sourceId, info.Value.TransportInfo)); } SystemMonitor.Warning("Failed to establish source information [" + sourceId.Print() + "]"); return(false); }
/// <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> /// /// </summary> public bool SetInitialParameters(TradePlatformComponent manager, ComponentId sourceId, ComponentId dataSourced) { SystemMonitor.CheckError(_manager == null, "Session member already assigned."); _manager = manager; _dataSourced = dataSourced; _tradeEntities.SetInitialParameters(manager, this, manager.GetDataDelivery(_dataSourced)); SourceInfo? info = _manager.GetSourceInfo(sourceId, SourceTypeEnum.OrderExecution); if (info.HasValue) { return base.SetInitialParameters(sourceId, info.Value.TransportInfo); } SystemMonitor.Warning("Failed to establish source information [" + sourceId.Print() + "]"); return false; }
/// <summary> /// Create a dataDelivery delivery component, corresponding to the given sourceSourceId and account /// </summary> /// <param name="sourceSourceId"></param> /// <param name="account"></param> /// <returns></returns> protected ISourceDataDelivery CreateDataDelivery(ComponentId sourceId) { if (sourceId == _dataStoreSourceInfo.ComponentId) { List<PlatformComponent> components = Platform.GetComponentsByType(typeof(DataStoreManagementComponent)); if (components.Count == 0) { SystemMonitor.Error("Failed to find data store management component."); return null; } DataStoreDataDelivery delivery = new DataStoreDataDelivery(_dataStoreSourceInfo.ComponentId); if (delivery.Initialize() == false) { SystemMonitor.OperationError("Failed to initialize data store data delivery."); return null; } return delivery; } SourceInfo? sourceInfo = GetSourceInfo(sourceId, SourceTypeEnum.DataProvider); if (sourceInfo.HasValue == false) { SystemMonitor.OperationError("Source info not found for source [" + sourceId.Print() + "].", TracerItem.PriorityEnum.High); return null; } if ((sourceInfo.Value.SourceType & SourceTypeEnum.DataProvider) == 0) { SystemMonitor.OperationError("Can not create data delivery to source that does not implement data provider [" + sourceId.Print() + "].", TracerItem.PriorityEnum.Critical); return null; } TransportInfo info = GetSourceTransportInfoToMe(sourceId); if (info == null) { return null; } // This is a remote dataDelivery source, create a corresponding delivery. DataSourceClientStub stubDelivery = new DataSourceClientStub(); Arbiter.AddClient(stubDelivery); stubDelivery.SetInitialParameters(sourceId, info); return stubDelivery; }
/// <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; } }