彭博数据许可网络服务的包装器



我现在正在寻找彭博数据许可网络服务。注意,这与Bloomberg API (Session/Service/Request, b-pipe等)不同。它是一种基于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的)。这就是我的问题——我认为应该有一些包装器、帮助器或其他任何东西来促进参考数据检索,但即使在SO上,也只有一个关于BB DLWS的问题。这里有人在使用DLWS吗?关于BB DLWS有什么已知的库吗?应该那么慢吗?

谢谢。

我自己也刚刚开始。请求数据有两种选择:SFTP和Web服务。根据我的理解,SFTP选项需要Bloomberg应用程序("请求生成器")来检索数据。

第二个选项(Web Services)似乎没有很好的文档,至少对于那些使用R的人(像我一样)来说是这样。因此,我怀疑目前是否存在针对Web服务的库。Bloomberg提供了一个身份验证证书,以便访问他们的网络,以及他们的web服务主机和端口信息。现在,在使用这些信息来连接和下载数据方面,我仍然无法做到。

如果您或其他任何人已经能够成功地使用Bloomberg Web Services和R连接和提取数据,请将详细的代码发布到这个博客!

最新更新