/// <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[]>()); }
private void toolStripButtonAddSymbol_Click(object sender, EventArgs e) { if (_dataDelivery != null && _provider != null) { Dictionary <Symbol, TimeSpan[]> symbols = _dataDelivery.SearchSymbols(toolStripTextBoxSymbol.Text); if (symbols == null || symbols.Count == 0) { MessageBox.Show("Failed to find position.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (symbols.Count > 1) { MessageBox.Show("More than one symbol found containing [" + toolStripTextBoxSymbol.Text + "]. Please specify symbol more precisely.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _provider.TradeEntities.ObtainPositionBySymbol(GeneralHelper.EnumerableToList <Symbol>(symbols.Keys)[0]); } }
public Dictionary <Symbol, TimeSpan[]> SearchSymbols(string symbolMatchPattern) { return(_sourceDataDelivery.SearchSymbols(symbolMatchPattern)); }