/// <summary> /// Get source orderInfo, by aplying filter, since more than one source may be on same id, but always from different type. /// </summary> /// <returns></returns> public SourceInfo?GetSourceInfo(ComponentId sourceId, SourceTypeEnum?filter) { if (sourceId == _dataStoreSourceInfo.ComponentId) { return(_dataStoreSourceInfo); } if (sourceId == _backtestingExecutionSourceInfo.ComponentId) { return(_backtestingExecutionSourceInfo); } SourcesUpdateMessage responce = this.SendAndReceive <SourcesUpdateMessage>( new GetSourceInfoMessage(sourceId)); if (responce == null || responce.OperationResult == false || responce.Sources.Count < 1) { return(null); } List <SourceTypeEnum> types = new List <SourceTypeEnum>(); foreach (SourceInfo info in responce.Sources) { if (filter.HasValue == false || (info.SourceType & filter.Value) != 0) { return(info); } } return(null); }
/// <summary> /// Get sources by filtering criteria. /// </summary> public List <ComponentId> GetSources(SourceTypeEnum filteringSourceType, bool partialMatch) { List <ComponentId> result = new List <ComponentId>(); SourcesUpdateMessage responce = this.SendAndReceive <SourcesUpdateMessage>( new RequestSourcesMessage(filteringSourceType, partialMatch)); if (responce != null && responce.OperationResult != false && responce.SourcesIds.Count > 0) { result.AddRange(responce.SourcesIds); } // Add local sources last, since they are of less interest usually. if (_dataStoreSourceInfo.MatchesSearchCritera(filteringSourceType, partialMatch)) { result.Add(_dataStoreSourceInfo.ComponentId); } if (_backtestingExecutionSourceInfo.MatchesSearchCritera(filteringSourceType, partialMatch)) { result.Add(_backtestingExecutionSourceInfo.ComponentId); } return(result); }
protected void Receive(SourcesUpdateMessage message) { if (SourcesUpdateEvent != null) { SourcesUpdateEvent(this); } }
/// <summary> /// Helper. /// </summary> protected bool GetSourcePath(ComponentId sourceId, out List <ArbiterClientId?> sourcePath) { SystemMonitor.CheckError(sourceId != _dataStoreSourceInfo.ComponentId, "Data store source has no path."); SystemMonitor.CheckError(sourceId != _backtestingExecutionSourceInfo.ComponentId, "Local execution source has no path."); sourcePath = null; SourcesUpdateMessage responce = this.SendAndReceive <SourcesUpdateMessage>(new GetSourceInfoMessage(sourceId)); if (responce == null || responce.OperationResult == false) { return(false); } if (responce.Sources.Count > 0) { if (responce.Sources[0].TransportInfo != null) { sourcePath = responce.Sources[0].TransportInfo.CreateRespondingClientList(); } else { sourcePath = null; } return(true); } return(false); }
protected TransportInfo GetSourceTransportInfoToMe(ComponentId sourceId) { SourcesUpdateMessage responce = this.SendAndReceive <SourcesUpdateMessage>(new GetSourceInfoMessage(sourceId)); if (responce == null || responce.OperationResult == false) { return(null); } TransportInfo info = null; if (responce.Sources.Count > 0 && responce.Sources[0].TransportInfo != null) { info = responce.Sources[0].TransportInfo.Clone(); info.PopForwardTransportInfo(); info.AddForwardTransportId(this.SubscriptionClientID); } return(info); }