private void DeleteView(GetDataService service) { DeleteViewDefinitionRequest deleteRequest = new DeleteViewDefinitionRequest(); deleteRequest.viewName = "BamGenevaView"; Response deleteResponse = service.deleteViewDefinition(deleteRequest); Console.Write("Delete View Status Description: " + deleteResponse.statusCodes.description + "\n"); Console.Write("Delete View RequestId: " + deleteResponse.dlwsHeader.dlwsRequestId + "\n\n"); }
private GetDataService ConnectToBloombergService(string certPath) { GetDataService service = new GetDataService(); X509Certificate2 clientCert = new X509Certificate2(certPath, "IANTLMAU"); //X509Certificate2 clientCert = new X509Certificate2(certPath, "WOBMXEYQ"); service.ClientCertificates.Add(clientCert); return service; }
private bool CreateView(int jobkeycode, GetDataService service, string _bbFieldsPath) { try { if (File.Exists(_bbFieldsPath)) { CreateOrUpdateViewDefinitionRequest createRequest = new CreateOrUpdateViewDefinitionRequest(); ViewOptions viewOptions = new ViewOptions(); viewOptions.dateFormat = DateFormat.yyyymmdd; createRequest.viewOptions = viewOptions; createRequest.viewName = "BamGenevaView"; if (!_bbFieldsPath.Equals(String.Empty)) { xdocBbFields = new XmlDocument(); xdocBbFields.Load(_bbFieldsPath); } Field[] fields = null; if (xdocBbFields.DocumentElement.ChildNodes != null && xdocBbFields.DocumentElement.ChildNodes.Count > 0) { int i = 0; fields = new Field[xdocBbFields.DocumentElement.ChildNodes.Count]; foreach (XmlNode field in xdocBbFields.DocumentElement.ChildNodes) { fields[i] = new Field(); fields[i].mnemonic = field.Attributes["name"].Value.ToString(); fields[i].overrideSpecified = Convert.ToBoolean(field.Attributes["overrideSpecified"].Value.ToString()); fields[i].@override = Convert.ToBoolean(field.Attributes["override"].Value.ToString()); i++; } } createRequest.fields = fields; CreateOrUpdateViewDefinitionResponse createResponse = service.createViewDefinition(createRequest); Console.Write("Create View Status Description: " + createResponse.statusCodes.description + "\n"); Console.Write("Create View RequestId: " + createResponse.dlwsHeader.dlwsRequestId + "\n\n"); } else throw new Exception(String.Format("Bbg fields file does not exist at {0}", _bbFieldsPath)); } catch (Exception ex) { log.Error(jobkeycode, ex); return false; } return true; }
private void BloombergSoapCall(int jobKeyCode, GetDataService service, DataTable dtKickouts, ref XmlDocument xdocBbData, ref XmlDocument xdocBbDataPartialResponse, ref XmlDocument xdocBbDataFailedResponse, int countTotal, ref int countSuccess, ref int countFailed) { int SUCCESS = 0; int PARTIAL_RESPONSE = 107; int NOT_PRIVILEGED_FOR_ALL_DATA = 115; int chunkCounter = 1; htIntlOptions = new Hashtable(); Dictionary<string, string> symbolsProcessed = new Dictionary<string, string>(); Hashtable htAssetTypes = new Hashtable(); XmlNode investments = xdocBbData.SelectSingleNode("/Investments"); XmlNode investmentsPartialResponse = xdocBbDataPartialResponse.SelectSingleNode("/Investments"); XmlNode investmentsFailedResponse = xdocBbDataFailedResponse.SelectSingleNode("/Investments"); dtKickouts.DefaultView.RowFilter = "Type='Investment'"; log.InfoFormat(jobKeyCode, "Preparing Bloomberg call for {0} record in chunks of {1} records.", dtKickouts.DefaultView.Count, BB_CHUNK_SIZE); for (int recordCounter = 0; recordCounter < dtKickouts.Rows.Count; recordCounter++) { try { log.InfoFormat(jobKeyCode, "Chunking request {0} .", chunkCounter++); int chunkIndex = 0; Instrument[] instruments = new Instrument[BB_CHUNK_SIZE]; while (chunkIndex < BB_CHUNK_SIZE && recordCounter < dtKickouts.Rows.Count) { DataRow dr = dtKickouts.Rows[recordCounter++]; if (!dr["Investment"].ToString().Equals(String.Empty) && !symbolsProcessed.ContainsKey(dr["Investment"].ToString())) { if (dr["Type"].ToString().ToUpper() == "INVESTMENT") // && (dr["SourceInvestmentType"].ToString().ToUpper() == "EQUITY" || dr["SourceInvestmentType"].ToString().ToUpper() == "OPTION")) { string sourceInvestment = dr["SourceInvestment"].ToString(); string investmentType = dr["SourceInvestmentType"].ToString(); string investmentSymbol = dr["Investment"].ToString(); //common Instrument bbInstrumentRequest = new Instrument(); bbInstrumentRequest.id = investmentSymbol.Trim(); bbInstrumentRequest.marketSectorSpecified = true; bbInstrumentRequest.idType = InstrumentIdType.TICKER; bbInstrumentRequest.idTypeSpecified = true; //This is the combined asset class designations from BOSS/BRAIN and Eze // BOSS-BRAIN: Cash,CashPR,Equity,Fixed Income,Forward,Future,FX,Index,NA,Option,Other // Eze: CASH,CONV ,EQ ,EQB,EQI,ETFOPT,FI,FIGOV,FUT,FUTIDX,FXUS,IDX, // OPT,OPTFUT,OPTI,OPTIDX,PFD,SWAP,SWAPI,SWAPUS,WRNT,WRNTI switch (investmentType) { case "Bond": case "FI": case "Fixed Income": bbInstrumentRequest.marketSector = MarketSector.Corp; break; case "FIGOV": case "FIGOVI": case "FISOV": bbInstrumentRequest.marketSector = MarketSector.Govt; break; case "FII": case "FICONV": case "FI144A": bbInstrumentRequest.marketSector = MarketSector.Corp; break; case "Index": case "FUTIDX": bbInstrumentRequest.marketSector = MarketSector.Index; break; case "Commodity": bbInstrumentRequest.marketSector = MarketSector.Comdty; break; case "FUT": case "Future": if (dr["FeedSymbol"].ToString().Contains("Index") || dr["Investment"].ToString().Contains("Index") || dr["SourceInvestment"].ToString().Contains("Index")) bbInstrumentRequest.marketSector = MarketSector.Index; else if (dr["FeedSymbol"].ToString().Contains("Comdty") || dr["Investment"].ToString().Contains("Comdty") || dr["SourceInvestment"].ToString().Contains("Comdty")) bbInstrumentRequest.marketSector = MarketSector.Comdty; else if (dr["FeedSymbol"].ToString().Contains("Curncy") || dr["Investment"].ToString().Contains("Curncy") || dr["SourceInvestment"].ToString().Contains("Curncy")) bbInstrumentRequest.marketSector = MarketSector.Curncy; break; case "Option": case "OPT": case "OPTI": bbInstrumentRequest.marketSector = MarketSector.Equity; if (investmentSymbol.EndsWith("-OPTO")) { string[] keys = investmentSymbol.Split(' '); string key = String.Empty; for (int i = 0; i < keys.Length - 1; i++) { key += keys[i] + " "; } key = key.Trim(); htIntlOptions[key] = investmentSymbol; bbInstrumentRequest.id = key; //if (!keys[3].EndsWith(("-OPTO"))) //{ // key = String.Format("{0} {1} {2} {3}", keys[0], keys[1], keys[2], keys[3]); // htIntlOptions[key] = investmentSymbol; // bbInstrumentRequest.id = key; //} } break; case "SWAP": case "SWAPI": case "SWAPUS": bbInstrumentRequest.marketSector = MarketSector.Equity; break; case "FX": case "FXUS": case "Forward": bbInstrumentRequest.marketSector = MarketSector.Index; break; case "Equity": case "EQ": case "EQB": case "EQI": bbInstrumentRequest.marketSector = MarketSector.Equity; break; case "Other": case "NA": case "Cash": case "CASH": case "CashPR": case "CONV": case "ETFOPT": case "IDX": case "OPTFUT": case "OPTIDX": case "PFD": case "WRNT": case "WRNTI": log.WarnFormat(jobKeyCode, "Asset type {0} not handled in automated build", dr["SourceInvestmentType"]); break; } try { if (!symbolsProcessed.ContainsKey(sourceInvestment) && htInvestmentType2AssetType.ContainsKey(investmentType)) { symbolsProcessed.Add(sourceInvestment, bbInstrumentRequest.id); instruments[chunkIndex++] = bbInstrumentRequest; htAssetTypes[investmentSymbol.ToUpper()] = htInvestmentType2AssetType[investmentType].ToString(); } } catch (Exception ex) { log.Error(ex); } } } } getDataRequest request = new getDataRequest(); request.instruments = instruments; request.view = "BamGenevaView"; getDataResponse dataResponse = service.getData(request); string responseString = "GetData Status Description: " + dataResponse.statusCode.description + "\n"; responseString += "GetData RequestId: " + dataResponse.dlwsHeader.dlwsRequestId + "\n"; responseString += "Cummulative Status : " + dataResponse.statusCode.externalCode + "\n"; if (SUCCESS.Equals(dataResponse.statusCode.externalCode) || PARTIAL_RESPONSE.Equals(dataResponse.statusCode.externalCode)) { //Process responses for every security, one at a time for (int i = 0; i < dataResponse.instrumentData.Length; i++) { responseString += "\tInstrument : " + dataResponse.instrumentData[i].instrument.id + " " + dataResponse.instrumentData[i].instrument.marketSector + "\n"; int sc1 = -999; Int32.TryParse(dataResponse.instrumentData[i].statusCode.externalCode.ToString(), out sc1); string rs = sc1 != -999 ? dataResponse.instrumentData[i].statusCode.externalCode.ToString() : "No status available"; responseString += "\tStatus : " + rs + "\n"; //set up nodes for GV load XmlNode investmentNode = xdocBbData.CreateNode(XmlNodeType.Element, "Investment", ""); XmlNode assetTypeNode = xdocBbData.CreateElement("AssetType"); if (SUCCESS.Equals(dataResponse.instrumentData[i].statusCode.externalCode)) { if (htAssetTypes.ContainsKey(dataResponse.instrumentData[i].instrument.id.ToString().ToUpper())) assetTypeNode.InnerXml = htAssetTypes[dataResponse.instrumentData[i].instrument.id].ToString(); for (int j = 0; j < dataResponse.instrumentData[i].data.Length; j++) { try { XmlNode investmentDetailNode = xdocBbData.CreateElement(dataResponse.instrumentData[i].data[j].field); investmentDetailNode.InnerXml = dataResponse.instrumentData[i].data[j].value.ToString().Replace("&", ""); investmentNode.AppendChild(investmentDetailNode); //if (investmentDetailNode.Name.Equals("OPT_PUT_CALL") && investmentDetailNode.InnerXml.Trim().Equals(String.Empty)) // assetTypeNode.InnerXml = "Equity"; //else if (investmentDetailNode.Name.Equals("OPT_PUT_CALL") && !investmentDetailNode.InnerXml.Trim().Equals(String.Empty)) // assetTypeNode.InnerXml = "Option"; //else // if (htInvestmentType2AssetType.ContainsKey(dataResponse.instrumentData[i].instrument.marketSector.ToString())) // assetTypeNode.InnerXml = htInvestmentType2AssetType[dataResponse.instrumentData[i].instrument.marketSector.ToString()].ToString(); responseString += "\t\t" + dataResponse.instrumentData[i].data[j].field + " : " + dataResponse.instrumentData[i].data[j].value + "\n"; } catch (Exception ex1) { log.WarnFormat(jobKeyCode, "Failed to get security attribute {0} from {1}", dataResponse.instrumentData[i].data[j].field, investmentNode.Name); log.Error(jobKeyCode, ex1); } } XmlNode sourceInvestmentCodeNode = xdocBbData.CreateElement("SourceInvestment"); foreach (KeyValuePair<string, string> kvp in symbolsProcessed) if (kvp.Value.Equals(dataResponse.instrumentData[i].instrument.id.Trim())) { sourceInvestmentCodeNode.InnerXml = kvp.Key; investmentNode.AppendChild(sourceInvestmentCodeNode); break; } XmlNode sourceInvestmentTypeNode = xdocBbData.CreateElement("SourceInvestmentType"); DataRow[] drKickoutRows = dtKickouts.Select("SourceInvestment='" + sourceInvestmentCodeNode.InnerXml + "'"); if (drKickoutRows.Length > 0) sourceInvestmentTypeNode.InnerXml = drKickoutRows[0]["SourceInvestmentType"].ToString(); XmlNode investmentCodeNode = xdocBbData.CreateElement("Investment"); if (htIntlOptions.ContainsKey(dataResponse.instrumentData[i].instrument.id.Trim())) investmentCodeNode.InnerXml = htIntlOptions[dataResponse.instrumentData[i].instrument.id.Trim()].ToString(); else investmentCodeNode.InnerXml = dataResponse.instrumentData[i].instrument.id.Trim(); investmentNode.AppendChild(investmentCodeNode); investmentNode.AppendChild(assetTypeNode); BuildGenevaInvestment(jobKeyCode, ref investmentNode, htAssetTypes, xdocBbData); investments.AppendChild(investmentNode); countSuccess++; } else { investmentNode = xdocBbDataPartialResponse.CreateNode(XmlNodeType.Element, "Investment", ""); XmlNode tickerNode = xdocBbDataPartialResponse.CreateElement("Ticker"); tickerNode.InnerXml = dataResponse.instrumentData[i].instrument.id; investmentNode.AppendChild(tickerNode); assetTypeNode = xdocBbDataPartialResponse.CreateElement("AssetType"); if (htInvestmentType2AssetType.ContainsKey(dataResponse.instrumentData[i].instrument.marketSector.ToString())) assetTypeNode.InnerXml = htInvestmentType2AssetType[dataResponse.instrumentData[i].instrument.marketSector.ToString()].ToString(); investmentNode.AppendChild(assetTypeNode); investmentsPartialResponse.AppendChild(investmentNode); responseString += "\t\tPartial Response\n"; } } } else if (NOT_PRIVILEGED_FOR_ALL_DATA.Equals(dataResponse.statusCode)) { log.Warn(jobKeyCode, "The user is not privileged to access the Bloomberg data"); } log.Info(jobKeyCode, responseString + "\n"); countFailed = countTotal - countSuccess; } catch (Exception ex) { log.Error(jobKeyCode, ex); } } return; }
private void GetDataFromBloombergInvestmentType(string investmentType, ref XmlDocument xdocNewInvestmentData, XmlDocument xdocPartial, ref int countSuccess, ref int countFailed, DataTable dtKickouts, ref XmlDocument xdocBbDataPartialResponse, ref XmlDocument xdocBbDataFailedResponse, SecMasterDataRetrieve bbWebService, GetDataService service, ref bool isContingency, ref DateTime runStartTime) { while (ifRetry) { try { log.InfoFormat(job.KeyCode, "Attempting Bloomberg SOAP call"); string fieldsFilename = String.Format("{0}\\{1}.xml", fieldsPath, investmentType); if (bbWebService.CreateView(job.KeyCode, service, fieldsFilename)) { bbWebService.BloombergSoapCall(job.KeyCode, service, dtKickouts, ref xdocNewInvestmentData, ref xdocBbDataPartialResponse, ref xdocBbDataFailedResponse, recCountTotal, ref countSuccess, ref countFailed); if (isContingency) SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, "Bloomberg SOAP call succeeded."); } ifRetry = false; } catch (Exception ex) { log.Error(job.KeyCode, ex); if (DateTime.Now.CompareTo(runStartTime.AddMinutes(minutesSoapRetry)) < 0) { isContingency = true; if (!ListTo.Equals(String.Empty)) SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, ex.ToString()); Thread.Sleep(60000); } else { SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, "Bloomberg SOAP call failed too many times and timed out. Giving up now."); ifRetry = false; } } } bbWebService.DeleteView(service); foreach (XmlNode node in xdocBbDataPartialResponse.DocumentElement.ChildNodes) { XmlNode newNode = xdocPartial.ImportNode(node, true); xdocPartial.FirstChild.FirstChild.AppendChild(newNode); } }
private void GetDataFromBloomberg(int jobKeyCode, GetDataService service, DataTable dt, ref XmlDocument xdocBbData, ref XmlDocument xdocBbDataPartialResponse, ref XmlDocument xdocBbDataFailedResponse, int countTotal, ref int countSuccess, ref int countFailed) { int SUCCESS = 0; int PARTIAL_RESPONSE = 107; int NOT_PRIVILEGED_FOR_ALL_DATA = 115; Hashtable htInstrumentTypes = new Hashtable(); XmlNode investments = null; XmlNode investmentsPartialResponse = null; XmlNode investmentsFailedResponse = null; if (xdocBbData.SelectSingleNode("/Investments") == null) { investments = xdocBbData.CreateNode(XmlNodeType.Element, "Investments", ""); xdocBbData.AppendChild(investments); } else investments = xdocBbData.SelectSingleNode("/Investments"); if (xdocBbDataPartialResponse.SelectSingleNode("/Investments") == null) { investmentsPartialResponse = xdocBbDataPartialResponse.CreateNode(XmlNodeType.Element, "Investments", ""); xdocBbDataPartialResponse.AppendChild(investmentsPartialResponse); } else investmentsPartialResponse = xdocBbDataPartialResponse.SelectSingleNode("/Investments"); if (xdocBbDataFailedResponse.SelectSingleNode("/Investments") == null) { investmentsFailedResponse = xdocBbDataFailedResponse.CreateNode(XmlNodeType.Element, "Investments", ""); xdocBbDataFailedResponse.AppendChild(investmentsFailedResponse); } else investmentsFailedResponse = xdocBbDataFailedResponse.SelectSingleNode("/Investments"); log.InfoFormat(jobKeyCode, "Preparing Bloomberg call for {0} record in chunks of {1} records.", dt.Rows.Count, BB_CHUNK_SIZE); int chunkCounter = 1; htIntlOptions = new Hashtable(); Dictionary<string, string> symbolsProcessed = new Dictionary<string,string> (); for (int recordCounter = 0; recordCounter < dt.Rows.Count; recordCounter++) { try { log.InfoFormat(jobKeyCode, "Chunking request {0} .", chunkCounter++); int chunkIndex = 0; Instrument[] instruments = new Instrument[BB_CHUNK_SIZE]; while (chunkIndex < BB_CHUNK_SIZE && recordCounter < dt.Rows.Count) { DataRow dr = dt.Rows[recordCounter++]; if (!symbolsProcessed.ContainsKey(dr["EzeInvestment"].ToString())) { if (dr["Type"].ToString().ToUpper() == "INVESTMENT") // && (dr["Investment_Type"].ToString().ToUpper() == "EQUITY" || dr["Investment_Type"].ToString().ToUpper() == "OPTION")) { Instrument ticker = new Instrument(); if (dr["Investment"].ToString().IndexOf("-OPTO") > -1) { string[] keys = dr["Investment"].ToString().Split(' '); if (dr["Investment"].ToString().EndsWith("-OPTO")) { string key = String.Empty; if (!keys[3].EndsWith(("-OPTO"))) { key = String.Format("{0} {1} {2} {3}", keys[0], keys[1], keys[2], keys[3]); htIntlOptions[key] = dr["Investment"].ToString(); ticker.id = key; } else { // FUTURE OPTION CASE break; } } } else ticker.id = dr["Investment"].ToString(); ticker.marketSector = dr["Investment_Type"].ToString().Equals("Bond") || dr["Investment_Type"].ToString().Equals("FI") ? MarketSector.Corp : MarketSector.Equity; ticker.marketSectorSpecified = true; ticker.idType = InstrumentIdType.TICKER; ticker.idTypeSpecified = true; instruments[chunkIndex++] = ticker; htInstrumentTypes[dr["Investment"].ToString()] = dr["Investment_Type"].ToString(); symbolsProcessed.Add(dr["EzeInvestment"].ToString(), ticker.id); } } } getDataRequest request = new getDataRequest(); request.instruments = instruments; request.view = "BamGenevaView"; getDataResponse dataResponse = service.getData(request); string responseString = "GetData Status Description: " + dataResponse.statusCode.description + "\n"; responseString += "GetData RequestId: " + dataResponse.dlwsHeader.dlwsRequestId + "\n"; responseString += "Cummulative Status : " + dataResponse.statusCode.externalCode + "\n"; if (SUCCESS.Equals(dataResponse.statusCode.externalCode) || PARTIAL_RESPONSE.Equals(dataResponse.statusCode.externalCode)) { //Process responses for every security, one at a time for (int i = 0; i < dataResponse.instrumentData.Length; i++) { responseString += "\tInstrument : " + dataResponse.instrumentData[i].instrument.id + " " + dataResponse.instrumentData[i].instrument.marketSector + "\n"; int sc1 = -999; Int32.TryParse(dataResponse.instrumentData[i].statusCode.externalCode.ToString(), out sc1); string rs = sc1 != -999 ? dataResponse.instrumentData[i].statusCode.externalCode.ToString() : "No status available"; responseString += "\tStatus : " + rs + "\n"; //set up nodes for GV load XmlNode investmentNode = xdocBbData.CreateNode(XmlNodeType.Element, "Investment", ""); XmlNode assetTypeNode = xdocBbData.CreateElement("AssetType"); if (SUCCESS.Equals(dataResponse.instrumentData[i].statusCode.externalCode)) { for (int j = 0; j < dataResponse.instrumentData[i].data.Length; j++) { try { XmlNode investmentDetailNode = xdocBbData.CreateElement(dataResponse.instrumentData[i].data[j].field); investmentDetailNode.InnerXml = dataResponse.instrumentData[i].data[j].value.ToString().Replace("&", ""); investmentNode.AppendChild(investmentDetailNode); if (investmentDetailNode.Name.Equals("OPT_PUT_CALL") && investmentDetailNode.InnerXml.Trim().Equals(String.Empty)) assetTypeNode.InnerXml = "Equity"; else if (investmentDetailNode.Name.Equals("OPT_PUT_CALL") && !investmentDetailNode.InnerXml.Trim().Equals(String.Empty)) assetTypeNode.InnerXml = "Option"; else if (htInstrumentTypes.ContainsKey(dataResponse.instrumentData[i].instrument.id) && htInstrumentTypes[dataResponse.instrumentData[i].instrument.id].Equals("FI")) assetTypeNode.InnerXml = "Bond"; responseString += "\t\t" + dataResponse.instrumentData[i].data[j].field + " : " + dataResponse.instrumentData[i].data[j].value + "\n"; } catch (Exception ex1) { log.WarnFormat(jobKeyCode, "Failed to get security attribute {0} from {1}", dataResponse.instrumentData[i].data[j].field, investmentNode.Name); log.Error(jobKeyCode, ex1); } } XmlNode ezeInvestmentCodeNode = xdocBbData.CreateElement("EzeInvestment"); foreach(KeyValuePair <string,string> kvp in symbolsProcessed) if (kvp.Value.Equals(dataResponse.instrumentData[i].instrument.id.Trim())) { ezeInvestmentCodeNode.InnerXml = kvp.Key; investmentNode.AppendChild(ezeInvestmentCodeNode); break; } XmlNode investmentCodeNode = xdocBbData.CreateElement("Investment"); if (htIntlOptions.ContainsKey(dataResponse.instrumentData[i].instrument.id.Trim())) investmentCodeNode.InnerXml = htIntlOptions[dataResponse.instrumentData[i].instrument.id.Trim()].ToString(); else investmentCodeNode.InnerXml = dataResponse.instrumentData[i].instrument.id.Trim(); investmentNode.AppendChild(investmentCodeNode); investmentNode.AppendChild(assetTypeNode); DecorateInvestment(jobKeyCode, ref investmentNode, htInstrumentTypes, xdocBbData); investments.AppendChild(investmentNode); countSuccess++; } else { investmentNode = xdocBbDataPartialResponse.CreateNode(XmlNodeType.Element, "Investment", ""); XmlNode tickerNode = xdocBbDataPartialResponse.CreateElement("Ticker"); tickerNode.InnerXml = dataResponse.instrumentData[i].instrument.id; investmentNode.AppendChild(tickerNode); assetTypeNode = xdocBbDataPartialResponse.CreateElement("AssetType"); assetTypeNode.InnerXml = dataResponse.instrumentData[i].instrument.marketSector.ToString(); investmentNode.AppendChild(assetTypeNode); investmentsPartialResponse.AppendChild(investmentNode); responseString += "\t\tPartial Response\n"; } } } else if (NOT_PRIVILEGED_FOR_ALL_DATA.Equals(dataResponse.statusCode)) { log.Warn(jobKeyCode, "The user is not privileged to access the Bloomberg data"); } log.Info(jobKeyCode, responseString + "\n"); countFailed = countTotal - countSuccess; } catch (Exception ex) { log.Error(jobKeyCode, ex); } } return; }
private void CreateView(GetDataService service, string _bbFieldsPath) { CreateOrUpdateViewDefinitionRequest createRequest = new CreateOrUpdateViewDefinitionRequest(); ViewOptions viewOptions = new ViewOptions(); viewOptions.dateFormat = DateFormat.yyyymmdd; createRequest.viewOptions = viewOptions; createRequest.viewName = "BamGenevaView"; if (!_bbFieldsPath.Equals(String.Empty)) { xdocBbFields = new XmlDocument(); xdocBbFields.Load(_bbFieldsPath); } Field[] fields = null; if (xdocBbFields.DocumentElement.ChildNodes != null && xdocBbFields.DocumentElement.ChildNodes.Count > 0) { int i = 0; fields = new Field[xdocBbFields.DocumentElement.ChildNodes.Count]; foreach (XmlNode field in xdocBbFields.DocumentElement.ChildNodes) { fields[i] = new Field(); fields[i].mnemonic = field.Attributes["name"].Value.ToString(); fields[i].overrideSpecified = Convert.ToBoolean(field.Attributes["overrideSpecified"].Value.ToString()); fields[i].@override = Convert.ToBoolean(field.Attributes["override"].Value.ToString()); i++; } } createRequest.fields = fields; CreateOrUpdateViewDefinitionResponse createResponse = service.createViewDefinition(createRequest); Console.Write("Create View Status Description: " + createResponse.statusCodes.description + "\n"); Console.Write("Create View RequestId: " + createResponse.dlwsHeader.dlwsRequestId + "\n\n"); }
private GetDataService getService(string certPath) { GetDataService service = new GetDataService(); X509Certificate2 clientCert = new X509Certificate2(certPath, "WOBMXEYQ"); service.ClientCertificates.Add(clientCert); return service; }