我现在正在寻找Bloomberg Data License Web Services。请注意,这与Bloomberg API(会话/服务/请求,b管道等)不同。它是基于SOAP的解决方案,用于从Bloomberg DB中检索参考数据。我创建了一个测试应用程序,只是为了快速评估这个解决方案:
var client = new PerSecurityWSClient("PerSecurityWSPort");
client.ClientCredentials.ClientCertificate.Certificate = new X509Certificate2("{path-to-certificate}", "{password}");
client.ClientCredentials.UserName.UserName = "";
client.ClientCredentials.UserName.Password = "";
client.ClientCredentials.Windows.ClientCredential.Domain = "";
var companyFields = new string[] { "ID_BB_COMPANY", "ID_BB_ULTIMATE_PARENT_CO_NAME" , /* ... all other fields I'm interested in */ };
var getCompanyRequest = new SubmitGetCompanyRequest {
headers = new GetCompanyHeaders { creditrisk = true },
instruments = new Instruments {
instrument = new Instrument[] {
new Instrument { id = "AAPL US", yellowkey = MarketSector.Equity, yellowkeySpecified = true },
new Instrument { id = "PRVT US", yellowkey = MarketSector.Equity, yellowkeySpecified = true }
}
},
fields = companyFields
};
var response = client.submitGetCompanyRequest(getCompanyRequest);
if(response.statusCode.code != SUCCESS) {
System.Console.Error.WriteLine("Response status is " + response.statusCode);
return;
}
var retrieve = new RetrieveGetCompanyRequest { responseId = response.responseId };
RetrieveGetCompanyResponse getCompanyResponse = null;
do {
System.Console.Write("*");
Thread.Sleep(1000);
getCompanyResponse = client.retrieveGetCompanyResponse(retrieve);
} while (getCompanyResponse.statusCode.code == DATA_NOT_AVAILABLE);
if (getCompanyResponse.statusCode.code != SUCCESS) {
System.Console.Error.WriteLine("Response status is " + response.statusCode);
return;
}
System.Console.WriteLine();
foreach (var instrumentData in getCompanyResponse.instrumentDatas) {
Console.WriteLine("Data for: " + instrumentData.instrument.id + " [" + instrumentData.instrument.yellowkey + "]");
int fieldIndex = 0;
foreach (var dataEntry in instrumentData.data) {
if (dataEntry.isArray) {
Console.WriteLine(companyFields[fieldIndex] + ":");
foreach(var arrayEntry in dataEntry.bulkarray) {
foreach(var arrayEntryData in arrayEntry.data) {
Console.WriteLine("\t" + arrayEntryData.value);
}
}
}
else {
Console.WriteLine(companyFields[fieldIndex] + ": " + dataEntry.value);
}
++fieldIndex;
}
System.Console.WriteLine("-- -- -- -- -- -- -- -- -- -- -- -- --");
}
代码看起来有些臃肿(好吧,确实,2015年基于SOAP)。因此,我的问题是 - 我认为应该有一些包装器,助手,其他任何便于参考数据检索的东西,but even on SO there is only one question regarding BB DLWS。在这里有人使用DLWS吗? BB DLWS周围是否有任何已知的库?是假设那么慢吗?
感谢。
答案 0 :(得分:0)
我自己就是这样做的。请求数据有两种选择:SFTP和Web服务。据我了解,SFTP选项需要Bloomberg应用程序(“请求构建器”)才能检索数据。
第二个选项(Web服务)似乎没有详细记录,至少对于那些使用R的人(像我一样)。所以,我怀疑此时Web服务是否存在库。 Bloomberg提供身份验证证书,以便访问其网络,以及他们的Web服务主机和端口信息。现在,在使用这些信息连接和下载数据方面,这仍然超出了我的范围。
如果您或其他任何人能够使用Bloomberg Web Services和R成功连接和提取数据,请将详细代码发布到此博客!