/// <summary> /// Get all sources that match the given criteria; multiple criteria can be combined in one sourceType /// using bitwise operators (for ex. operationResult = operationResult | SourceTypeEnum.Remote). /// </summary> /// <param name="sourceType"></param> /// <param name="partialMatch">Should we try to match filtering criteria fully or partially.</param> /// <returns></returns> public Dictionary <Symbol, TimeSpan[]> SearchSymbols(ComponentId sourceId, string symbolMatch) { if (IsLocalSource(sourceId)) { ISourceDataDelivery delivery = ObtainDataDelivery(sourceId); return(delivery.SearchSymbols(symbolMatch)); } List <ArbiterClientId?> sourcePath; if (GetSourcePath(sourceId, out sourcePath) == false) { SystemMonitor.OperationError("Failed to establish source path."); return(new Dictionary <Symbol, TimeSpan[]>()); } RequestSymbolsMessage request = new RequestSymbolsMessage() { SymbolMatch = symbolMatch }; ResponceMessage result = this.SendAndReceiveForwarding <ResponceMessage>(sourcePath, request); if (result != null && result.OperationResult) { return(((RequestSymbolsResponceMessage)result).SymbolsPeriods); } return(new Dictionary <Symbol, TimeSpan[]>()); }
protected virtual RequestSymbolsResponceMessage Receive(RequestSymbolsMessage message) { RequestSymbolsResponceMessage responce = new RequestSymbolsResponceMessage(true); DataSourceStub.IImplementation implementation = Implementation; if (implementation != null && OperationalState == OperationalStateEnum.Operational) {// Synchronous. responce.SymbolsPeriods = implementation.SearchSymbols(message.SymbolMatch, message.ResultLimit); } else { responce.OperationResult = false; } return(responce); }
/// <summary> /// /// </summary> public Dictionary <Symbol, TimeSpan[]> SearchSymbols(string symbolMatchPattern) { if (OperationalState != OperationalStateEnum.Operational) { return(new Dictionary <Symbol, TimeSpan[]>()); } RequestSymbolsMessage request = new RequestSymbolsMessage() { SymbolMatch = symbolMatchPattern }; ResponseMessage response = SendAndReceiveResponding <ResponseMessage>(SourceTransportInfo, request); if (response != null && response.OperationResult) { return(((RequestSymbolsResponseMessage)response).SymbolsPeriods); } return(new Dictionary <Symbol, TimeSpan[]>()); }
protected virtual RequestSymbolsResponseMessage Receive(RequestSymbolsMessage message) { RequestSymbolsResponseMessage response = new RequestSymbolsResponseMessage(true); DataSourceStub.IImplementation implementation = Implementation; if (implementation != null && OperationalState == OperationalStateEnum.Operational) {// Synchronous. response.SymbolsPeriods = implementation.SearchSymbols(message.SymbolMatch, message.ResultLimit); } else { response.OperationResult = false; } return response; }
protected RequestSymbolsResponseMessage Receive(RequestSymbolsMessage message) { RequestSymbolsResponseMessage response = new RequestSymbolsResponseMessage(true); foreach(Symbol symbol in _dataSessions.Keys) { if (_dataSessions[symbol].SessionInformation.Info.Symbol.MatchesSearchCriteria(message.SymbolMatch)) { response.SymbolsPeriods.Add(_dataSessions[symbol].SessionInformation.Info.Symbol, _dataSessions[symbol].SessionInformation.AvailableDataBarPeriods.ToArray()); } } return response; }
/// <summary> /// Get all sources that match the given criteria; multiple criteria can be combined in one sourceType /// using bitwise operators (for ex. operationResult = operationResult | SourceTypeEnum.Remote). /// </summary> /// <param name="sourceType"></param> /// <param name="partialMatch">Should we try to match filtering criteria fully or partially.</param> /// <returns></returns> public Dictionary<Symbol, TimeSpan[]> SearchSymbols(ComponentId sourceId, string symbolMatch) { if (IsLocalSource(sourceId)) { ISourceDataDelivery delivery = ObtainDataDelivery(sourceId); return delivery.SearchSymbols(symbolMatch); } List<ArbiterClientId?> sourcePath; if (GetSourcePath(sourceId, out sourcePath) == false) { SystemMonitor.OperationError("Failed to establish source path."); return new Dictionary<Symbol, TimeSpan[]>(); } RequestSymbolsMessage request = new RequestSymbolsMessage() { SymbolMatch = symbolMatch }; ResponceMessage result = this.SendAndReceiveForwarding<ResponceMessage>(sourcePath, request); if (result != null && result.OperationResult) { return ((RequestSymbolsResponceMessage)result).SymbolsPeriods; } return new Dictionary<Symbol, TimeSpan[]>(); }
/// <summary> /// /// </summary> public Dictionary<Symbol, TimeSpan[]> SearchSymbols(string symbolMatchPattern) { if (OperationalState != OperationalStateEnum.Operational) { return new Dictionary<Symbol, TimeSpan[]>(); } RequestSymbolsMessage request = new RequestSymbolsMessage() { SymbolMatch = symbolMatchPattern }; ResponceMessage responce = SendAndReceiveResponding<ResponceMessage>(SourceTransportInfo, request); if (responce != null && responce.OperationResult) { return ((RequestSymbolsResponceMessage)responce).SymbolsPeriods; } return new Dictionary<Symbol, TimeSpan[]>(); }